Robot Framework Integrated Development Environment (RIDE)
Collections.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 import copy
17 
18 from robotide.lib.robot.api import logger
19 from robotide.lib.robot.utils import (is_dict_like, is_list_like, is_number, is_string, is_truthy, plural_or_not,
20  seq2str, seq2str2, type_name, unic, Matcher)
21 from robotide.lib.robot.utils.asserts import assert_equal
22 from robotide.lib.robot.version import get_version
23 
24 
25 class NotSet():
26  def __repr__(self):
27  return ""
28 NOT_SET = NotSet()
29 
30 
31 class _List():
32 
33 
38  def convert_to_list(self, item):
39  return list(item)
40 
41 
50  def append_to_list(self, list_, *values):
51  self._validate_list_validate_list(list_)
52  for value in values:
53  list_.append(value)
54 
55 
75  def insert_into_list(self, list_, index, value):
76  self._validate_list_validate_list(list_)
77  list_.insert(self._index_to_int_index_to_int(index), value)
78 
79 
91  def combine_lists(self, *lists):
92  self._validate_lists_validate_lists(*lists)
93  ret = []
94  for item in lists:
95  ret.extend(item)
96  return ret
97 
98 
112  def set_list_value(self, list_, index, value):
113  self._validate_list_validate_list(list_)
114  try:
115  list_[self._index_to_int_index_to_int(index)] = value
116  except IndexError:
117  self._index_error_index_error(list_, index)
118 
119 
128  def remove_values_from_list(self, list_, *values):
129  self._validate_list_validate_list(list_)
130  for value in values:
131  while value in list_:
132  list_.remove(value)
133 
134 
148  def remove_from_list(self, list_, index):
149  self._validate_list_validate_list(list_)
150  try:
151  return list_.pop(self._index_to_int_index_to_int(index))
152  except IndexError:
153  self._index_error_index_error(list_, index)
154 
155 
162  def remove_duplicates(self, list_):
163  self._validate_list_validate_list(list_)
164  ret = []
165  for item in list_:
166  if item not in ret:
167  ret.append(item)
168  removed = len(list_) - len(ret)
169  logger.info('%d duplicate%s removed.' % (removed, plural_or_not(removed)))
170  return ret
171 
172 
190  def get_from_list(self, list_, index):
191  self._validate_list_validate_list(list_)
192  try:
193  return list_[self._index_to_int_index_to_int(index)]
194  except IndexError:
195  self._index_error_index_error(list_, index)
196 
197 
220  def get_slice_from_list(self, list_, start=0, end=None):
221  self._validate_list_validate_list(list_)
222  start = self._index_to_int_index_to_int(start, True)
223  if end is not None:
224  end = self._index_to_int_index_to_int(end)
225  return list_[start:end]
226 
227 
239  def count_values_in_list(self, list_, value, start=0, end=None):
240  self._validate_list_validate_list(list_)
241  return self.get_slice_from_listget_slice_from_list(list_, start, end).count(value)
242 
243 
256  def get_index_from_list(self, list_, value, start=0, end=None):
257  self._validate_list_validate_list(list_)
258  if start == '':
259  start = 0
260  list_ = self.get_slice_from_listget_slice_from_list(list_, start, end)
261  try:
262  return int(start) + list_.index(value)
263  except ValueError:
264  return -1
265 
266 
273  def copy_list(self, list_, deepcopy=False):
274  self._validate_list_validate_list(list_)
275  if deepcopy:
276  return copy.deepcopy(list_)
277  return list_[:]
278 
279 
288  def reverse_list(self, list_):
289  self._validate_list_validate_list(list_)
290  list_.reverse()
291 
292 
301  def sort_list(self, list_):
302  self._validate_list_validate_list(list_)
303  list_.sort()
304 
305 
309  def list_should_contain_value(self, list_, value, msg=None):
310  self._validate_list_validate_list(list_)
311  default = "%s does not contain value '%s'." % (seq2str2(list_), value)
312  _verify_condition(value in list_, default, msg)
313 
314 
318  def list_should_not_contain_value(self, list_, value, msg=None):
319  self._validate_list_validate_list(list_)
320  default = "%s contains value '%s'." % (seq2str2(list_), value)
321  _verify_condition(value not in list_, default, msg)
322 
323 
333  def list_should_not_contain_duplicates(self, list_, msg=None):
334  self._validate_list_validate_list(list_)
335  if not isinstance(list_, list):
336  list_ = list(list_)
337  dupes = []
338  for item in list_:
339  if item not in dupes:
340  count = list_.count(item)
341  if count > 1:
342  logger.info("'%s' found %d times." % (item, count))
343  dupes.append(item)
344  if dupes:
345  raise AssertionError(msg or
346  '%s found multiple times.' % seq2str(dupes))
347 
348 
382  def lists_should_be_equal(self, list1, list2, msg=None, values=True,
383  names=None):
384  self._validate_lists_validate_lists(list1, list2)
385  len1 = len(list1)
386  len2 = len(list2)
387  default = 'Lengths are different: %d != %d' % (len1, len2)
388  _verify_condition(len1 == len2, default, msg, values)
389  names = self._get_list_index_name_mapping_get_list_index_name_mapping(names, len1)
390  diffs = list(self._yield_list_diffs_yield_list_diffs(list1, list2, names))
391  default = 'Lists are different:\n' + '\n'.join(diffs)
392  _verify_condition(diffs == [], default, msg, values)
393 
394  def _get_list_index_name_mapping(self, names, list_length):
395  if not names:
396  return {}
397  if is_dict_like(names):
398  return dict((int(index), names[index]) for index in names)
399  return dict(zip(range(list_length), names))
400 
401  def _yield_list_diffs(self, list1, list2, names):
402  for index, (item1, item2) in enumerate(zip(list1, list2)):
403  name = ' (%s)' % names[index] if index in names else ''
404  try:
405  assert_equal(item1, item2, msg='Index %d%s' % (index, name))
406  except AssertionError as err:
407  yield unic(err)
408 
409 
417  def list_should_contain_sub_list(self, list1, list2, msg=None, values=True):
418  self._validate_lists_validate_lists(list1, list2)
419  diffs = ', '.join(unic(item) for item in list2 if item not in list1)
420  default = 'Following values were not found from first list: ' + diffs
421  _verify_condition(not diffs, default, msg, values)
422 
423 
430  def log_list(self, list_, level='INFO'):
431  self._validate_list_validate_list(list_)
432  logger.write('\n'.join(self._log_list_log_list(list_)), level)
433 
434  def _log_list(self, list_):
435  if not list_:
436  yield 'List is empty.'
437  elif len(list_) == 1:
438  yield 'List has one item:\n%s' % list_[0]
439  else:
440  yield 'List length is %d and it contains following items:' % len(list_)
441  for index, item in enumerate(list_):
442  yield '%s: %s' % (index, item)
443 
444  def _index_to_int(self, index, empty_to_zero=False):
445  if empty_to_zero and not index:
446  return 0
447  try:
448  return int(index)
449  except ValueError:
450  raise ValueError("Cannot convert index '%s' to an integer." % index)
451 
452  def _index_error(self, list_, index):
453  raise IndexError('Given index %s is out of the range 0-%d.'
454  % (index, len(list_)-1))
455 
456  def _validate_list(self, list_, position=1):
457  if not is_list_like(list_):
458  raise TypeError("Expected argument %d to be a list or list-like, "
459  "got %s instead." % (position, type_name(list_)))
460 
461  def _validate_lists(self, *lists):
462  for index, item in enumerate(lists, start=1):
463  self._validate_list_validate_list(item, index)
464 
465 
466 class _Dictionary():
467 
468 
479  def convert_to_dictionary(self, item):
480  return dict(item)
481 
482 
498  def set_to_dictionary(self, dictionary, *key_value_pairs, **items):
499  self._validate_dictionary_validate_dictionary(dictionary)
500  if len(key_value_pairs) % 2 != 0:
501  raise ValueError("Adding data to a dictionary failed. There "
502  "should be even number of key-value-pairs.")
503  for i in range(0, len(key_value_pairs), 2):
504  dictionary[key_value_pairs[i]] = key_value_pairs[i+1]
505  dictionary.update(items)
506  return dictionary
507 
508 
518  def remove_from_dictionary(self, dictionary, *keys):
519  self._validate_dictionary_validate_dictionary(dictionary)
520  for key in keys:
521  if key in dictionary:
522  value = dictionary.pop(key)
523  logger.info("Removed item with key '%s' and value '%s'." % (key, value))
524  else:
525  logger.info("Key '%s' not found." % key)
526 
527 
541  def pop_from_dictionary(self, dictionary, key, default=NOT_SET):
542  self._validate_dictionary_validate_dictionary(dictionary)
543  if default is NOT_SET:
544  self.dictionary_should_contain_keydictionary_should_contain_key(dictionary, key)
545  return dictionary.pop(key)
546  return dictionary.pop(key, default)
547 
548 
558  def keep_in_dictionary(self, dictionary, *keys):
559  self._validate_dictionary_validate_dictionary(dictionary)
560  remove_keys = [k for k in dictionary if k not in keys]
561  self.remove_from_dictionaryremove_from_dictionary(dictionary, *remove_keys)
562 
563 
574  def copy_dictionary(self, dictionary, deepcopy=False):
575  self._validate_dictionary_validate_dictionary(dictionary)
576  if deepcopy:
577  return copy.deepcopy(dictionary)
578  return dictionary.copy()
579 
580 
600  def get_dictionary_keys(self, dictionary, sort_keys=True):
601  self._validate_dictionary_validate_dictionary(dictionary)
602  keys = dictionary.keys()
603  if sort_keys:
604  try:
605  return sorted(keys)
606  except TypeError:
607  pass
608  return list(keys)
609 
610 
630  def get_dictionary_values(self, dictionary, sort_keys=True):
631  self._validate_dictionary_validate_dictionary(dictionary)
632  keys = self.get_dictionary_keysget_dictionary_keys(dictionary, sort_keys=sort_keys)
633  return [dictionary[k] for k in keys]
634 
635 
659  def get_dictionary_items(self, dictionary, sort_keys=True):
660  self._validate_dictionary_validate_dictionary(dictionary)
661  keys = self.get_dictionary_keysget_dictionary_keys(dictionary, sort_keys=sort_keys)
662  return [i for key in keys for i in (key, dictionary[key])]
663 
664 
676  def get_from_dictionary(self, dictionary, key):
677  self._validate_dictionary_validate_dictionary(dictionary)
678  try:
679  return dictionary[key]
680  except KeyError:
681  raise RuntimeError("Dictionary does not contain key '%s'." % key)
682 
683 
687  def dictionary_should_contain_key(self, dictionary, key, msg=None):
688  self._validate_dictionary_validate_dictionary(dictionary)
689  default = "Dictionary does not contain key '%s'." % key
690  _verify_condition(key in dictionary, default, msg)
691 
692 
696  def dictionary_should_not_contain_key(self, dictionary, key, msg=None):
697  self._validate_dictionary_validate_dictionary(dictionary)
698  default = "Dictionary contains key '%s'." % key
699  _verify_condition(key not in dictionary, default, msg)
700 
701 
707  def dictionary_should_contain_item(self, dictionary, key, value, msg=None):
708  self._validate_dictionary_validate_dictionary(dictionary)
709  self.dictionary_should_contain_keydictionary_should_contain_key(dictionary, key, msg)
710  actual, expected = unic(dictionary[key]), unic(value)
711  default = "Value of dictionary key '%s' does not match: %s != %s" % (key, actual, expected)
712  _verify_condition(actual == expected, default, msg)
713 
714 
718  def dictionary_should_contain_value(self, dictionary, value, msg=None):
719  self._validate_dictionary_validate_dictionary(dictionary)
720  default = "Dictionary does not contain value '%s'." % value
721  _verify_condition(value in dictionary.values(), default, msg)
722 
723 
727  def dictionary_should_not_contain_value(self, dictionary, value, msg=None):
728  self._validate_dictionary_validate_dictionary(dictionary)
729  default = "Dictionary contains value '%s'." % value
730  _verify_condition(not value in dictionary.values(), default, msg)
731 
732 
742  def dictionaries_should_be_equal(self, dict1, dict2, msg=None, values=True):
743  self._validate_dictionary_validate_dictionary(dict1)
744  self._validate_dictionary_validate_dictionary(dict2, 2)
745  keys = self._keys_should_be_equal_keys_should_be_equal(dict1, dict2, msg, values)
746  self._key_values_should_be_equal_key_values_should_be_equal(keys, dict1, dict2, msg, values)
747 
748 
753  def dictionary_should_contain_sub_dictionary(self, dict1, dict2, msg=None,
754  values=True):
755  self._validate_dictionary_validate_dictionary(dict1)
756  self._validate_dictionary_validate_dictionary(dict2, 2)
757  keys = self.get_dictionary_keysget_dictionary_keys(dict2)
758  diffs = [unic(k) for k in keys if k not in dict1]
759  default = "Following keys missing from first dictionary: %s" \
760  % ', '.join(diffs)
761  _verify_condition(not diffs, default, msg, values)
762  self._key_values_should_be_equal_key_values_should_be_equal(keys, dict1, dict2, msg, values)
763 
764 
771  def log_dictionary(self, dictionary, level='INFO'):
772  self._validate_dictionary_validate_dictionary(dictionary)
773  logger.write('\n'.join(self._log_dictionary_log_dictionary(dictionary)), level)
774 
775  def _log_dictionary(self, dictionary):
776  if not dictionary:
777  yield 'Dictionary is empty.'
778  elif len(dictionary) == 1:
779  yield 'Dictionary has one item:'
780  else:
781  yield 'Dictionary size is %d and it contains following items:' % len(dictionary)
782  for key in self.get_dictionary_keysget_dictionary_keys(dictionary):
783  yield '%s: %s' % (key, dictionary[key])
784 
785  def _keys_should_be_equal(self, dict1, dict2, msg, values):
786  keys1 = self.get_dictionary_keysget_dictionary_keys(dict1)
787  keys2 = self.get_dictionary_keysget_dictionary_keys(dict2)
788  miss1 = [unic(k) for k in keys2 if k not in dict1]
789  miss2 = [unic(k) for k in keys1 if k not in dict2]
790  error = []
791  if miss1:
792  error += ['Following keys missing from first dictionary: %s'
793  % ', '.join(miss1)]
794  if miss2:
795  error += ['Following keys missing from second dictionary: %s'
796  % ', '.join(miss2)]
797  _verify_condition(not error, '\n'.join(error), msg, values)
798  return keys1
799 
800  def _key_values_should_be_equal(self, keys, dict1, dict2, msg, values):
801  diffs = list(self._yield_dict_diffs_yield_dict_diffs(keys, dict1, dict2))
802  default = 'Following keys have different values:\n' + '\n'.join(diffs)
803  _verify_condition(not diffs, default, msg, values)
804 
805  def _yield_dict_diffs(self, keys, dict1, dict2):
806  for key in keys:
807  try:
808  assert_equal(dict1[key], dict2[key], msg='Key %s' % (key,))
809  except AssertionError as err:
810  yield unic(err)
811 
812  def _validate_dictionary(self, dictionary, position=1):
813  if is_string(dictionary) or is_number(dictionary):
814  raise TypeError("Expected argument %d to be a dictionary or dictionary-like, "
815  "got %s instead." % (position, type_name(dictionary)))
816 
817 
818 
894  ROBOT_LIBRARY_SCOPE = 'GLOBAL'
895  ROBOT_LIBRARY_VERSION = get_version()
896 
897 
932  def should_contain_match(self, list, pattern, msg=None,
933  case_insensitive=False,
934  whitespace_insensitive=False):
935  _List._validate_list(self, list)
936  matches = _get_matches_in_iterable(list, pattern, case_insensitive,
937  whitespace_insensitive)
938  default = "%s does not contain match for pattern '%s'." \
939  % (seq2str2(list), pattern)
940  _verify_condition(matches, default, msg)
941 
942 
947  def should_not_contain_match(self, list, pattern, msg=None,
948  case_insensitive=False,
949  whitespace_insensitive=False):
950  _List._validate_list(self, list)
951  matches = _get_matches_in_iterable(list, pattern, case_insensitive,
952  whitespace_insensitive)
953  default = "%s contains match for pattern '%s'." \
954  % (seq2str2(list), pattern)
955  _verify_condition(not matches, default, msg)
956 
957 
967  def get_matches(self, list, pattern, case_insensitive=False,
968  whitespace_insensitive=False):
969  _List._validate_list(self, list)
970  return _get_matches_in_iterable(list, pattern, case_insensitive,
971  whitespace_insensitive)
972 
973 
983  def get_match_count(self, list, pattern, case_insensitive=False,
984  whitespace_insensitive=False):
985  _List._validate_list(self, list)
986  return len(self.get_matchesget_matches(list, pattern, case_insensitive,
987  whitespace_insensitive))
988 
989 
990 def _verify_condition(condition, default_msg, msg, values=False):
991  if condition:
992  return
993  if not msg:
994  msg = default_msg
995  elif is_truthy(values) and str(values).upper() != 'NO VALUES':
996  msg += '\n' + default_msg
997  raise AssertionError(msg)
998 
999 
1000 def _get_matches_in_iterable(iterable, pattern, case_insensitive=False,
1001  whitespace_insensitive=False):
1002  if not is_string(pattern):
1003  raise TypeError("Pattern must be string, got '%s'." % type_name(pattern))
1004  regexp = False
1005  if pattern.startswith('regexp='):
1006  pattern = pattern[7:]
1007  regexp = True
1008  elif pattern.startswith('glob='):
1009  pattern = pattern[5:]
1010  matcher = Matcher(pattern,
1011  caseless=is_truthy(case_insensitive),
1012  spaceless=is_truthy(whitespace_insensitive),
1013  regexp=regexp)
1014  return [string for string in iterable
1015  if is_string(string) and matcher.match(string)]
A test library providing keywords for handling lists and dictionaries.
Definition: Collections.py:893
def get_match_count(self, list, pattern, case_insensitive=False, whitespace_insensitive=False)
Returns the count of matches to pattern in list.
Definition: Collections.py:984
def should_not_contain_match(self, list, pattern, msg=None, case_insensitive=False, whitespace_insensitive=False)
Fails if pattern is found in list.
Definition: Collections.py:949
def get_matches(self, list, pattern, case_insensitive=False, whitespace_insensitive=False)
Returns a list of matches to pattern in list.
Definition: Collections.py:968
def should_contain_match(self, list, pattern, msg=None, case_insensitive=False, whitespace_insensitive=False)
Fails if pattern is not found in list.
Definition: Collections.py:934
def convert_to_dictionary(self, item)
Converts the given item to a Python dict type.
Definition: Collections.py:479
def keep_in_dictionary(self, dictionary, *keys)
Keeps the given keys in the dictionary and removes all other.
Definition: Collections.py:558
def dictionary_should_not_contain_value(self, dictionary, value, msg=None)
Fails if value is found from dictionary.
Definition: Collections.py:727
def get_from_dictionary(self, dictionary, key)
Returns a value from the given dictionary based on the given key.
Definition: Collections.py:676
def get_dictionary_values(self, dictionary, sort_keys=True)
Returns values of the given dictionary as a list.
Definition: Collections.py:630
def get_dictionary_items(self, dictionary, sort_keys=True)
Returns items of the given dictionary as a list.
Definition: Collections.py:659
def copy_dictionary(self, dictionary, deepcopy=False)
Returns a copy of the given dictionary.
Definition: Collections.py:574
def log_dictionary(self, dictionary, level='INFO')
Logs the size and contents of the dictionary using given level.
Definition: Collections.py:771
def _key_values_should_be_equal(self, keys, dict1, dict2, msg, values)
Definition: Collections.py:800
def _keys_should_be_equal(self, dict1, dict2, msg, values)
Definition: Collections.py:785
def dictionary_should_contain_key(self, dictionary, key, msg=None)
Fails if key is not found from dictionary.
Definition: Collections.py:687
def dictionary_should_not_contain_key(self, dictionary, key, msg=None)
Fails if key is found from dictionary.
Definition: Collections.py:696
def dictionary_should_contain_sub_dictionary(self, dict1, dict2, msg=None, values=True)
Fails unless all items in dict2 are found from dict1.
Definition: Collections.py:754
def pop_from_dictionary(self, dictionary, key, default=NOT_SET)
Pops the given key from the dictionary and returns its value.
Definition: Collections.py:541
def _validate_dictionary(self, dictionary, position=1)
Definition: Collections.py:812
def remove_from_dictionary(self, dictionary, *keys)
Removes the given keys from the dictionary.
Definition: Collections.py:518
def set_to_dictionary(self, dictionary, *key_value_pairs, **items)
Adds the given key_value_pairs and items to the dictionary.
Definition: Collections.py:498
def dictionary_should_contain_item(self, dictionary, key, value, msg=None)
An item of key / value must be found in a dictionary.
Definition: Collections.py:707
def _yield_dict_diffs(self, keys, dict1, dict2)
Definition: Collections.py:805
def dictionary_should_contain_value(self, dictionary, value, msg=None)
Fails if value is not found from dictionary.
Definition: Collections.py:718
def get_dictionary_keys(self, dictionary, sort_keys=True)
Returns keys of the given dictionary as a list.
Definition: Collections.py:600
def dictionaries_should_be_equal(self, dict1, dict2, msg=None, values=True)
Fails if the given dictionaries are not equal.
Definition: Collections.py:742
def list_should_contain_value(self, list_, value, msg=None)
Fails if the value is not found from list.
Definition: Collections.py:309
def append_to_list(self, list_, *values)
Adds values to the end of list.
Definition: Collections.py:50
def log_list(self, list_, level='INFO')
Logs the length and contents of the list using given level.
Definition: Collections.py:430
def _yield_list_diffs(self, list1, list2, names)
Definition: Collections.py:401
def sort_list(self, list_)
Sorts the given list in place.
Definition: Collections.py:301
def get_from_list(self, list_, index)
Returns the value specified with an index from list.
Definition: Collections.py:190
def remove_values_from_list(self, list_, *values)
Removes all occurrences of given values from list.
Definition: Collections.py:128
def remove_from_list(self, list_, index)
Removes and returns the value specified with an index from list.
Definition: Collections.py:148
def remove_duplicates(self, list_)
Returns a list without duplicates based on the given list.
Definition: Collections.py:162
def _index_to_int(self, index, empty_to_zero=False)
Definition: Collections.py:444
def reverse_list(self, list_)
Reverses the given list in place.
Definition: Collections.py:288
def count_values_in_list(self, list_, value, start=0, end=None)
Returns the number of occurrences of the given value in list.
Definition: Collections.py:239
def convert_to_list(self, item)
Converts the given item to a Python list type.
Definition: Collections.py:38
def list_should_contain_sub_list(self, list1, list2, msg=None, values=True)
Fails if not all of the elements in list2 are found in list1.
Definition: Collections.py:417
def get_slice_from_list(self, list_, start=0, end=None)
Returns a slice of the given list between start and end indexes.
Definition: Collections.py:220
def _validate_list(self, list_, position=1)
Definition: Collections.py:456
def copy_list(self, list_, deepcopy=False)
Returns a copy of the given list.
Definition: Collections.py:273
def _get_list_index_name_mapping(self, names, list_length)
Definition: Collections.py:394
def get_index_from_list(self, list_, value, start=0, end=None)
Returns the index of the first occurrence of the value on the list.
Definition: Collections.py:256
def combine_lists(self, *lists)
Combines the given lists together and returns the result.
Definition: Collections.py:91
def list_should_not_contain_duplicates(self, list_, msg=None)
Fails if any element in the list is found from it more than once.
Definition: Collections.py:333
def insert_into_list(self, list_, index, value)
Inserts value into list to the position specified with index.
Definition: Collections.py:75
def lists_should_be_equal(self, list1, list2, msg=None, values=True, names=None)
Fails if given lists are unequal.
Definition: Collections.py:383
def list_should_not_contain_value(self, list_, value, msg=None)
Fails if the value is found from list.
Definition: Collections.py:318
def set_list_value(self, list_, index, value)
Sets the value of list specified by index to the given value.
Definition: Collections.py:112
def _verify_condition(condition, default_msg, msg, values=False)
Definition: Collections.py:990
def _get_matches_in_iterable(iterable, pattern, case_insensitive=False, whitespace_insensitive=False)
def assert_equal(first, second, msg=None, values=True, formatter=None)
Fail if given objects are unequal as determined by the '==' operator.
Definition: asserts.py:186
def seq2str2(sequence)
Returns sequence in format [ item 1 | item 2 | ...
Definition: misc.py:126
def seq2str(sequence, quote="'", sep=', ', lastsep=' and ')
Returns sequence in format ‘'item 1’, 'item 2' and 'item 3'`.
Definition: misc.py:115
def is_truthy(item)
Returns True or False depending is the item considered true or not.
Definition: robottypes.py:49
def get_version(naked=False)
Definition: version.py:24