If the given key cannot be found from the dictionary, it is ignored.įails if not all of the elements in list2 are found in list1. Keeps the given keys in the dictionary and removes all other. An index can be given either as an integer or a string that can be converted to an integer. If the absolute value of the index is greater than the length of the list, the value is added at the end (positive index) or the beginning (negative index). Use Append To List to add items to the end of the list. Inserting from right works with negative indices so that '-1' is the second last position, '-2' third last, and so on. Index '0' adds the value into the first position, '1' to the second, and so on. Inserts value into list to the position specified with index. Using start or end not found on the list is the same as using the largest (or smallest) available index.Įxamples (incl. If only end is given, start gets the value 0. 'None' is also a default value, so in this case, it is enough to give only start. To get all items from the beginning, use 0 as the start value, and to get all items until the end, use 'None' as the end value. If both start and end are given, a sublist containing values from start to end is returned. Returns a slice of the given list between start and end indexes. The given list is never altered by this keyword. In case the value is not found, -1 is returned. The search can be narrowed to the selected sublist by the start and end indexes having the same semantics as in the Get Slice From List keyword. Returns the index of the first occurrence of the value on the list. The index can be either an integer or a string that can be converted to an integer.Įxamples (including Python equivalents in comments): Using an index that does not exist on the list causes an error. Similarly, '-1' is the last position, '-2' the second last, and so on. Index '0' means the first position, '1' the second, and so on. Returns the value specified with an index from list. If the given key cannot be found from the dictionary, this keyword fails. Returns a value from the given dictionary based on the given key. The given dictionary is never altered by this keyword. Values are returned sorted according to keys. See List Should Contain Value for an explanation of msg.įails unless all items in dict2 are found from dict1.įails if value is not found from dictionary. The given dictionaries are never altered by this keyword.įails if key is not found from dictionary. See Lists Should Be Equal for an explanation of msg. If there are differences between the values, those are listed in the error message. The given list is never altered by this keyword.Ĭreates and returns a dictionary from the given key_value_pairs.įails if the given dictionaries are not equal.įirst the equality of dictionaries' keys is checked and after that all the key value pairs. Returns the number of occurrences of the given value in list. Use Create List from the BuiltIn library for constructing new lists. Mainly useful for converting tuples and other iterable to lists. The given lists are never altered by this keyword. $.Īppend To List Combine Lists Convert To List Copy Dictionary Copy List Count Values In List Create Dictionary Dictionaries Should Be Equal Dictionary Should Contain Key Dictionary Should Contain Sub Dictionary Dictionary Should Contain Value Dictionary Should Not Contain Key Dictionary Should Not Contain Value Get Dictionary Items Get Dictionary Keys Get Dictionary Values Get From Dictionary Get From List Get Index From List Get Slice From List Insert Into List Keep In Dictionary List Should Contain Sub List List Should Contain Value List Should Not Contain Duplicates List Should Not Contain Value Lists Should Be Equal Log Dictionary Log List Remove From Dictionary Remove From List Remove Values From List Reverse List Set List Value Set To Dictionary Sort List Keywords KeywordĬombines the given lists together and returns the result. Lists Should Be Equal, Dictionary Should Contain Value).įollowing keywords from the BuiltIn library can also be used with lists and dictionaries:Īll list keywords expect a scalar variable (e.g. Append To List, Get From Dictionary) and for verifying their contents (e.g. This library has keywords, for example, for modifying and getting values from lists and dictionaries (e.g. Collections - Documentation Collections - DocumentationĪ test library providing keywords for handling lists and dictionaries.Ĭollections is Robot Framework's standard library that provides a set of keywords for handling Python lists and dictionaries.
0 Comments
Leave a Reply. |