6 new revisions:

Revision: 587b21dcd462
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 07:59:35 2013 UTC
Log:      fixed typo in comment
http://code.google.com/p/robotframework/source/detail?r=587b21dcd462

Revision: 05a3dcd154bc
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 08:00:08 2013 UTC
Log:      rm incorrect statement from a docstring
http://code.google.com/p/robotframework/source/detail?r=05a3dcd154bc

Revision: 87741bd4f328
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 10:10:29 2013 UTC
Log:      Avoid deprecated has_key....
http://code.google.com/p/robotframework/source/detail?r=87741bd4f328

Revision: 4d65553c67fb
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 10:49:07 2013 UTC
Log: Collections: Proper English in error messages, idiomatic Python, etc. ...
http://code.google.com/p/robotframework/source/detail?r=4d65553c67fb

Revision: d9b46951c52c
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 11:05:54 2013 UTC
Log: Collections: Don't use has_key because collections.Mapping does not ha...
http://code.google.com/p/robotframework/source/detail?r=d9b46951c52c

Revision: 93277ee991ab
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 11:06:04 2013 UTC
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=93277ee991ab

==============================================================================
Revision: 587b21dcd462
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 07:59:35 2013 UTC
Log:      fixed typo in comment
http://code.google.com/p/robotframework/source/detail?r=587b21dcd462

Modified:
 /src/robot/running/model.py

=======================================
--- /src/robot/running/model.py Tue Jun 11 11:48:21 2013 UTC
+++ /src/robot/running/model.py Fri Sep  6 07:59:35 2013 UTC
@@ -25,7 +25,7 @@


 # TODO: This module should be turned into a package with submodules.
-# No time for that prior to 2.8, but ii ought to be safe also in 2.8.x.
+# No time for that prior to 2.8, but it ought to be safe also in 2.8.x.
 # Important to check that references in API docs don't break.


@@ -35,7 +35,6 @@
     message_class = None  # TODO: Remove from base model?

     def __init__(self, name='', args=(), assign=(), type='kw'):
-
         model.Keyword.__init__(self, name=name, args=args, type=type)
         #: Variables to be assigned.
         self.assign = assign

==============================================================================
Revision: 05a3dcd154bc
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 08:00:08 2013 UTC
Log:      rm incorrect statement from a docstring
http://code.google.com/p/robotframework/source/detail?r=05a3dcd154bc

Modified:
 /src/robot/result/keyword.py

=======================================
--- /src/robot/result/keyword.py        Tue Aug 27 13:17:19 2013 UTC
+++ /src/robot/result/keyword.py        Fri Sep  6 08:00:08 2013 UTC
@@ -32,7 +32,6 @@
         #: Keyword execution end time in format ``%Y%m%d %H:%M:%S.%f``.
         self.endtime = endtime
         #: Keyword status message. Used only with suite teardowns.
-        #: A non-empty message means that the teardown has failed.
         self.message = ''

     @property

==============================================================================
Revision: 87741bd4f328
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 10:10:29 2013 UTC
Log:      Avoid deprecated has_key.

Udate issue 1479
Status: Started
Owner: pekka.klarck
Removed has_key in few places where they were used internally. Left few others that are in code that's going to be rewritten in the future anyway.
http://code.google.com/p/robotframework/source/detail?r=87741bd4f328

Modified:
 /src/robot/running/baselibrary.py
 /src/robot/utils/argumentparser.py

=======================================
--- /src/robot/running/baselibrary.py   Thu Jun  6 14:00:44 2013 UTC
+++ /src/robot/running/baselibrary.py   Fri Sep  6 10:10:29 2013 UTC
@@ -24,7 +24,7 @@
raise DataError("No keyword handler with name '%s' found" % name)

     def has_handler(self, name):
-        return self.handlers.has_key(name)
+        return name in self.handlers

     def __len__(self):
         return len(self.handlers)
=======================================
--- /src/robot/utils/argumentparser.py  Thu Jun  6 14:00:44 2013 UTC
+++ /src/robot/utils/argumentparser.py  Fri Sep  6 10:10:29 2013 UTC
@@ -262,7 +262,7 @@
             self._raise_option_multiple_times_in_usage('--' + long_opt)
         self._names.append(long_opt)
         for sopt in short_opts:
-            if self._short_to_long.has_key(sopt):
+            if sopt in self._short_to_long:
                 self._raise_option_multiple_times_in_usage('-' + sopt)
             self._short_to_long[sopt] = long_opt
         if is_multi:

==============================================================================
Revision: 4d65553c67fb
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 10:49:07 2013 UTC
Log: Collections: Proper English in error messages, idiomatic Python, etc. cleanup.
http://code.google.com/p/robotframework/source/detail?r=4d65553c67fb

Modified:
 /atest/robot/standard_libraries/collections/dictionary.txt
 /atest/robot/standard_libraries/collections/list.txt
 /atest/testdata/standard_libraries/collections/dictionary.txt
 /atest/testdata/standard_libraries/collections/list.txt
 /src/robot/libraries/Collections.py

=======================================
--- /atest/robot/standard_libraries/collections/dictionary.txt Fri Jun 14 00:11:30 2013 UTC +++ /atest/robot/standard_libraries/collections/dictionary.txt Fri Sep 6 10:49:07 2013 UTC
@@ -26,9 +26,9 @@

 Remove From Dictionary
     ${tc} =  Check Test Case  ${TEST NAME}
- Check Log Message ${tc.kws[0].msgs[0]} Removed item with key 'b' and value '2'
-    Check Log Message  ${tc.kws[0].msgs[1]}  Key 'x' not found
-    Check Log Message  ${tc.kws[0].msgs[2]}  Key '2' not found
+ Check Log Message ${tc.kws[0].msgs[0]} Removed item with key 'b' and value '2'.
+    Check Log Message  ${tc.kws[0].msgs[1]}  Key 'x' not found.
+    Check Log Message  ${tc.kws[0].msgs[2]}  Key '2' not found.

 Keep In Dictionary
     Check Test Case  ${TEST NAME}
@@ -134,7 +134,11 @@

 Log Dictionary With Different Log Levels
     ${tc} =  Check Test Case  ${TEST NAME}
- ${expected} = Set Variable Dictionary size is 3 and it contains following items:\n 3: None\n a: 1\n b: 2
+    ${expected} =  Catenate  SEPARATOR=\n
+    ...  Dictionary size is 3 and it contains following items:
+    ...  3: None
+    ...  a: 1
+    ...  b: 2
     Check Log Message  ${tc.kws[0].msgs[0]}  ${expected}  INFO
     Should Be Empty    ${tc.kws[1].msgs}
     Check Log Message  ${tc.kws[2].msgs[0]}  ${expected}  WARN
@@ -143,7 +147,7 @@

 Log Dictionary With Different Dictionaries
     ${tc} =  Check Test Case  ${TEST NAME}
-    Check Log Message  ${tc.kws[0].msgs[0]}  Dictionary is empty
- Check Log Message ${tc.kws[1].msgs[0]} Dictionary has one item:\n a: 1
+    Check Log Message  ${tc.kws[0].msgs[0]}  Dictionary is empty.
+    Check Log Message  ${tc.kws[1].msgs[0]}  Dictionary has one item:\na: 1
Check Log Message ${tc.kws[3].msgs[0]} Dictionary size is 3 and it contains following items:\nTrue: xxx\nfoo: []\n(1, 2, 3): 3.14

=======================================
--- /atest/robot/standard_libraries/collections/list.txt Thu Oct 11 14:22:40 2012 UTC +++ /atest/robot/standard_libraries/collections/list.txt Fri Sep 6 10:49:07 2013 UTC
@@ -142,19 +142,19 @@

 List Should Not Contain Duplicates With One Duplicate
     ${tc} =  Check Test Case  ${TEST NAME}
-    Check Log Message  ${tc.kws[1].msgs[0]}  'item' found 2 times
+    Check Log Message  ${tc.kws[1].msgs[0]}  'item' found 2 times.

 List Should Not Contain Duplicates With Multiple Duplicates
     ${tc} =  Check Test Case  ${TEST NAME}
-    Check Log Message  ${tc.kws[1].msgs[0]}  '2' found 2 times
-    Check Log Message  ${tc.kws[1].msgs[1]}  'None' found 2 times
-    Check Log Message  ${tc.kws[1].msgs[2]}  '4' found 4 times
-    Check Log Message  ${tc.kws[1].msgs[3]}  '[1, 2, 3]' found 2 times
-    Check Log Message  ${tc.kws[1].msgs[4]}  '[]' found 10 times
+    Check Log Message  ${tc.kws[1].msgs[0]}  '2' found 2 times.
+    Check Log Message  ${tc.kws[1].msgs[1]}  'None' found 2 times.
+    Check Log Message  ${tc.kws[1].msgs[2]}  '4' found 4 times.
+    Check Log Message  ${tc.kws[1].msgs[3]}  '[1, 2, 3]' found 2 times.
+    Check Log Message  ${tc.kws[1].msgs[4]}  '[]' found 10 times.

 List Should Not Contain Duplicates With Custom Error Message
     ${tc} =  Check Test Case  ${TEST NAME}
-    Check Log Message  ${tc.kws[2].msgs[0]}  '42' found 42 times
+    Check Log Message  ${tc.kws[2].msgs[0]}  '42' found 42 times.

 Lists Should Be Equal
     Check Test Case  ${TEST NAME}
@@ -203,7 +203,11 @@

 Log List With Different Log Levels
     ${tc} =  Check Test Case  ${TEST NAME}
- ${expected} = Set Variable List length is 3 and it contains following items:\n 0: 11\n 1: 12\n 2: 13
+    ${expected} =  Catenate  SEPARATOR=\n
+    ...  List length is 3 and it contains following items:
+    ...  0: 11
+    ...  1: 12
+    ...  2: 13
     Check Log Message  ${tc.kws[0].msgs[0]}  ${expected}  INFO
     Variable Should Not Exist  ${tc.kws[1].msgs[0]}
     Check Log Message  ${tc.kws[2].msgs[0]}  ${expected}  WARN
@@ -212,7 +216,7 @@

 Log List With Different Lists
     ${tc} =  Check Test Case  ${TEST NAME}
-    Check Log Message  ${tc.kws[0].msgs[0]}  List is empty  INFO
+    Check Log Message  ${tc.kws[0].msgs[0]}  List is empty.  INFO
     Check Log Message  ${tc.kws[1].msgs[0]}  List has one item:\n1
Check Log Message ${tc.kws[4].msgs[0]} List length is 2 and it contains following items:\n 0: (1, 2, 3)\n 1: 3.12

=======================================
--- /atest/testdata/standard_libraries/collections/dictionary.txt Fri Jun 14 00:11:30 2013 UTC +++ /atest/testdata/standard_libraries/collections/dictionary.txt Fri Sep 6 10:49:07 2013 UTC
@@ -11,7 +11,7 @@
Compare To Expected String ${dict} {'a': '1', 'b': '2', 3: 3.1, True: {}}

 Create Dictionary with wrong number of arguments
- [Documentation] FAIL ValueError: Creating a dictionary failed. There should be an even number of key-value-pairs. + [Documentation] FAIL ValueError: Creating a dictionary failed. There should be even number of key-value-pairs.
     Create Dictionary  a  1  b

 Create Dictionary With **kwargs
@@ -25,7 +25,7 @@
     Should Be Equal  ${D0}  ${D3}

 Set To Dictionary With wrong number of arguments
- [Documentation] FAIL ValueError: Adding data to a dictionary failed. There should be an even number of key-value-pairs. + [Documentation] FAIL ValueError: Adding data to a dictionary failed. There should be even number of key-value-pairs.
     Set To Dictionary  ${D0}  a

 Set To Dictionary With **kwargs
@@ -69,46 +69,46 @@
     Should Be Equal As Integers  ${value}  2

 Get From Dictionary With Invalid Key
-    [Documentation]  FAIL Dictionary does not contain key 'x'
+    [Documentation]  FAIL Dictionary does not contain key 'x'.
     Get From Dictionary  ${D3}  x

 Dictionary Should Contain Key
     Dictionary Should Contain Key  ${D3}  a

 Dictionary Should Contain Key With Missing Key
-    [Documentation]  FAIL Dictionary does not contain key 'x'
+    [Documentation]  FAIL Dictionary does not contain key 'x'.
     Dictionary Should Contain Key  ${D3}  x

 Dictionary Should Contain Item
     Dictionary Should Contain Item  ${D3}  a   1

 Dictionary Should Contain Item With Missing Key
-    [Documentation]  FAIL Dictionary does not contain key 'x'
+    [Documentation]  FAIL Dictionary does not contain key 'x'.
     Dictionary Should Contain Item  ${D3}  x   1

 Dictionary Should Contain Item With Wrong Value
- [Documentation] FAIL Value of dictionary key 'a' does not match. '1'!='2' + [Documentation] FAIL Value of dictionary key 'a' does not match: 1 != 2
     Dictionary Should Contain Item  ${D3}  a   2

 Dictionary Should Not Contain Key
     Dictionary Should Not Contain Key  ${D3}  x

 Dictionary Should Not Contain Key With Existing Key
-    [Documentation]  FAIL Dictionary contains key 'b'
+    [Documentation]  FAIL Dictionary contains key 'b'.
     Dictionary Should Not Contain Key  ${D3}  b

 Dictionary Should Contain Value
     Dictionary Should Contain Value  ${D3}  ${2}

 Dictionary Should Contain Value With Missing Value
-    [Documentation]  FAIL Dictionary does not contain value 'x'
+    [Documentation]  FAIL Dictionary does not contain value 'x'.
     Dictionary Should Contain Value  ${D3}  x

 Dictionary Should Not Contain Value
     Dictionary Should Not Contain Value  ${D3}  x

 Dictionary Should Not Contain Value With Existing Value
-    [Documentation]  FAIL Dictionary contains value '2'
+    [Documentation]  FAIL Dictionary contains value '2'.
     Dictionary Should Not Contain Value  ${D3}  ${2}

 Dictionaries Should Be Equal
=======================================
--- /atest/testdata/standard_libraries/collections/list.txt Thu Oct 11 14:22:40 2012 UTC +++ /atest/testdata/standard_libraries/collections/list.txt Fri Sep 6 10:49:07 2013 UTC
@@ -3,8 +3,8 @@
 Resource        collections_resources.txt

 *** Variables ***
-${INDEX ERROR}  ValueError: Cannot convert index 'index' to an integer
-${LIST OUT OF RANGE}  IndexError: Given index 10 is out of the range 0-2
+${INDEX ERROR}  ValueError: Cannot convert index 'index' to an integer.
+${LIST OUT OF RANGE}  IndexError: Given index 10 is out of the range 0-2.

 *** Test Cases ***
 Convert To List
@@ -186,7 +186,7 @@
     List Should Contain Value  ${L1}  1

 List Should Contain Value, Value Not Found
-    [Documentation]  FAIL [ 1 ] does not contain value '2'
+    [Documentation]  FAIL [ 1 ] does not contain value '2'.
     List Should Contain Value  ${L1}  2

 List Should Contain Value, Value Not Found And Own Error Message
@@ -197,7 +197,7 @@
     List Should Not Contain Value  ${L1}  2

 List Should Not Contain Value, Value Found
-    [Documentation]  FAIL [ 1 ] contains value '1'
+    [Documentation]  FAIL [ 1 ] contains value '1'.
     List Should Not Contain Value  ${L1}  1

 List Should Not Contain Value, Value Found And Own Error Message
@@ -215,12 +215,12 @@
     List Should Not Contain Duplicates  ${list}

 List Should Not Contain Duplicates With One Duplicate
-    [Documentation]  FAIL 'item' found multiple times
+    [Documentation]  FAIL 'item' found multiple times.
     ${list} =  Create List  item  item  another item  fourth item  ITEM
     List Should Not Contain Duplicates  ${list}

 List Should Not Contain Duplicates With Multiple Duplicates
- [Documentation] FAIL '2', 'None', '4', '[1, 2, 3]' and '[]' found multiple times + [Documentation] FAIL '2', 'None', '4', '[1, 2, 3]' and '[]' found multiple times. ${list} = Evaluate [1, 2, '2', 2, None, '4', '4', '4', '4', '42', [1, 2, 3], {}, False] + [[]]*10 + [[1, 2, 3], None, (1, 2, 3, 4), 'a', 'A']
     List Should Not Contain Duplicates  ${list}

=======================================
--- /src/robot/libraries/Collections.py Fri Jun 14 00:11:30 2013 UTC
+++ /src/robot/libraries/Collections.py Fri Sep  6 10:49:07 2013 UTC
@@ -286,7 +286,7 @@
not contain the value 'x'" is shown in case of a failure. Otherwise,
         the given `msg` is used in case of a failure.
         """
- default = "%s does not contain value '%s'" % (seq2str2(list_), value) + default = "%s does not contain value '%s'." % (seq2str2(list_), value)
         _verify_condition(value in list_, default, msg)

     def list_should_not_contain_value(self, list_, value, msg=None):
@@ -294,7 +294,7 @@

         See `List Should Contain Value` for an explanation of `msg`.
         """
-        default = "%s contains value '%s'" % (seq2str2(list_), value)
+        default = "%s contains value '%s'." % (seq2str2(list_), value)
         _verify_condition(value not in list_, default, msg)

     def list_should_not_contain_duplicates(self, list_, msg=None):
@@ -315,10 +315,11 @@
             if item not in dupes:
                 count = list_.count(item)
                 if count > 1:
-                    logger.info("'%s' found %d times" % (item, count))
+                    logger.info("'%s' found %d times." % (item, count))
                     dupes.append(item)
         if dupes:
- raise AssertionError(msg or '%s found multiple times' % seq2str(dupes))
+            raise AssertionError(msg or
+ '%s found multiple times.' % seq2str(dupes))

     def lists_should_be_equal(self, list1, list2, msg=None, values=True,
                               names=None):
@@ -388,7 +389,7 @@
         """
diffs = ', '.join(unic(item) for item in list2 if item not in list1) default = 'Following values were not found from first list: ' + diffs
-        _verify_condition(diffs == '', default, msg, values)
+        _verify_condition(not diffs, default, msg, values)

     def log_list(self, list_, level='INFO'):
         """Logs the length and contents of the `list` using given `level`.
@@ -402,7 +403,7 @@

     def _log_list(self, list_):
         if not list_:
-            yield 'List is empty'
+            yield 'List is empty.'
         elif len(list_) == 1:
             yield 'List has one item:\n%s' % list_[0]
         else:
@@ -416,10 +417,10 @@
         try:
             return int(index)
         except ValueError:
- raise ValueError("Cannot convert index '%s' to an integer" % index) + raise ValueError("Cannot convert index '%s' to an integer." % index)

     def _index_error(self, list_, index):
-        raise IndexError('Given index %s is out of the range 0-%d'
+        raise IndexError('Given index %s is out of the range 0-%d.'
                          % (index, len(list_)-1))


@@ -447,7 +448,7 @@
         """
         if len(key_value_pairs) % 2 != 0:
raise ValueError("Creating a dictionary failed. There should be "
-                             "an even number of key-value-pairs.")
+                             "even number of key-value-pairs.")
         return self.set_to_dictionary({}, *key_value_pairs, **items)

     def set_to_dictionary(self, dictionary, *key_value_pairs, **items):
@@ -462,7 +463,7 @@
         """
         if len(key_value_pairs) % 2 != 0:
             raise ValueError("Adding data to a dictionary failed. There "
- "should be an even number of key-value-pairs.")
+                             "should be even number of key-value-pairs.")
         for i in range(0, len(key_value_pairs), 2):
             dictionary[key_value_pairs[i]] = key_value_pairs[i+1]
         dictionary.update(items)
@@ -482,9 +483,9 @@
         for key in keys:
             if key in dictionary:
                 value = dictionary.pop(key)
- logger.info("Removed item with key '%s' and value '%s'" % (key, value)) + logger.info("Removed item with key '%s' and value '%s'." % (key, value))
             else:
-                logger.info("Key '%s' not found" % (key))
+                logger.info("Key '%s' not found." % key)

     def keep_in_dictionary(self, dictionary, *keys):
"""Keeps the given `keys` in the `dictionary` and removes all other.
@@ -565,7 +566,7 @@
         try:
             return dictionary[key]
         except KeyError:
- raise RuntimeError("Dictionary does not contain key '%s'" % key) + raise RuntimeError("Dictionary does not contain key '%s'." % key)

     def dictionary_should_contain_key(self, dictionary, key, msg=None):
         """Fails if `key` is not found from `dictionary`.
@@ -574,7 +575,7 @@

         The given dictionary is never altered by this keyword.
         """
-        default = "Dictionary does not contain key '%s'" % key
+        default = "Dictionary does not contain key '%s'." % key
         _verify_condition(dictionary.has_key(key), default, msg)

     def dictionary_should_not_contain_key(self, dictionary, key, msg=None):
@@ -584,7 +585,7 @@

         The given dictionary is never altered by this keyword.
         """
-        default = "Dictionary contains key '%s'" % key
+        default = "Dictionary contains key '%s'." % key
         _verify_condition(not dictionary.has_key(key), default, msg)

def dictionary_should_contain_item(self, dictionary, key, value, msg=None):
@@ -597,7 +598,7 @@
         """
         self.dictionary_should_contain_key(dictionary, key, msg)
         actual, expected = unicode(dictionary[key]), unicode(value)
- default = "Value of dictionary key '%s' does not match. '%s'!='%s'" % (key, actual, expected) + default = "Value of dictionary key '%s' does not match: %s != %s" % (key, actual, expected)
         _verify_condition(actual == expected, default, msg)

     def dictionary_should_contain_value(self, dictionary, value, msg=None):
@@ -607,7 +608,7 @@

         The given dictionary is never altered by this keyword.
         """
-        default = "Dictionary does not contain value '%s'" % value
+        default = "Dictionary does not contain value '%s'." % value
         _verify_condition(value in dictionary.values(), default, msg)

def dictionary_should_not_contain_value(self, dictionary, value, msg=None):
@@ -617,7 +618,7 @@

         The given dictionary is never altered by this keyword.
         """
-        default = "Dictionary contains value '%s'" % value
+        default = "Dictionary contains value '%s'." % value
         _verify_condition(not value in dictionary.values(), default, msg)

def dictionaries_should_be_equal(self, dict1, dict2, msg=None, values=True):
@@ -644,7 +645,7 @@
         diffs = [unic(k) for k in keys if k not in dict1]
         default = "Following keys missing from first dictionary: %s" \
                   % ', '.join(diffs)
-        _verify_condition(diffs == [], default, msg, values)
+        _verify_condition(not diffs, default, msg, values)
         self._key_values_should_be_equal(keys, dict1, dict2, msg, values)

     def log_dictionary(self, dictionary, level='INFO'):
@@ -659,11 +660,11 @@

     def _log_dictionary(self, dictionary):
         if not dictionary:
-            yield 'Dictionary is empty'
+            yield 'Dictionary is empty.'
         elif len(dictionary) == 1:
             yield 'Dictionary has one item:'
         else:
- yield 'Dictionary size is %d and it contains following items:' % len( dictionary) + yield 'Dictionary size is %d and it contains following items:' % len(dictionary)
         for key in self.get_dictionary_keys(dictionary):
             yield '%s: %s' % (key, dictionary[key])

@@ -679,13 +680,13 @@
         if miss2:
             error += ['Following keys missing from second dictionary: %s'
                       % ', '.join(miss2)]
-        _verify_condition(error == [], '\n'.join(error), msg, values)
+        _verify_condition(not error, '\n'.join(error), msg, values)
         return keys1

     def _key_values_should_be_equal(self, keys, dict1, dict2, msg, values):
         diffs = list(self._yield_dict_diffs(keys, dict1, dict2))
default = 'Following keys have different values:\n' + '\n'.join(diffs)
-        _verify_condition(diffs == [], default, msg, values)
+        _verify_condition(not diffs, default, msg, values)

     def _yield_dict_diffs(self, keys, dict1, dict2):
         for key in keys:

==============================================================================
Revision: d9b46951c52c
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 11:05:54 2013 UTC
Log: Collections: Don't use has_key because collections.Mapping does not have it.

Update issue 1479
Status: Done
Fixed with a test.
http://code.google.com/p/robotframework/source/detail?r=d9b46951c52c

Added:
 /atest/testdata/standard_libraries/collections/CollectionsHelperLibrary.py
Modified:
 /atest/robot/standard_libraries/collections/dictionary.txt
 /atest/testdata/standard_libraries/collections/dictionary.txt
 /src/robot/libraries/Collections.py

=======================================
--- /dev/null
+++ /atest/testdata/standard_libraries/collections/CollectionsHelperLibrary.py Fri Sep 6 11:05:54 2013 UTC
@@ -0,0 +1,9 @@
+class DictWithoutHasKey(dict):
+
+    def has_key(self, key):
+        raise NotImplementedError('Emulating collections.Mapping which '
+                                  'does not have `has_key`.')
+
+
+def get_dict_without_has_key(**items):
+    return DictWithoutHasKey(**items)
=======================================
--- /atest/robot/standard_libraries/collections/dictionary.txt Fri Sep 6 10:49:07 2013 UTC +++ /atest/robot/standard_libraries/collections/dictionary.txt Fri Sep 6 11:05:54 2013 UTC
@@ -71,6 +71,9 @@

 Dictionary Should Not Contain Key With Existing Key
     Check Test Case  ${TEST NAME}
+
+Dictionary Should (Not) Contain Key Does Not Require `has_key`
+    Check Test Case  ${TEST NAME}

 Dictionary Should Contain Value
     Check Test Case  ${TEST NAME}
=======================================
--- /atest/testdata/standard_libraries/collections/dictionary.txt Fri Sep 6 10:49:07 2013 UTC +++ /atest/testdata/standard_libraries/collections/dictionary.txt Fri Sep 6 11:05:54 2013 UTC
@@ -1,6 +1,7 @@
 *** Settings ***
 Test Setup      Create Dictionaries For Testing
 Resource        collections_resources.txt
+Library         CollectionsHelperLibrary.py

 *** Test Cases ***
 Create Dictionary
@@ -97,6 +98,11 @@
     [Documentation]  FAIL Dictionary contains key 'b'.
     Dictionary Should Not Contain Key  ${D3}  b

+Dictionary Should (Not) Contain Key Does Not Require `has_key`
+    ${dict} =  Get Dict Without Has Key  name=value
+    Dictionary Should Contain Key  ${dict}  name
+    Dictionary Should Not Contain Key  ${dict}  nonex
+
 Dictionary Should Contain Value
     Dictionary Should Contain Value  ${D3}  ${2}

=======================================
--- /src/robot/libraries/Collections.py Fri Sep  6 10:49:07 2013 UTC
+++ /src/robot/libraries/Collections.py Fri Sep  6 11:05:54 2013 UTC
@@ -576,7 +576,7 @@
         The given dictionary is never altered by this keyword.
         """
         default = "Dictionary does not contain key '%s'." % key
-        _verify_condition(dictionary.has_key(key), default, msg)
+        _verify_condition(key in dictionary, default, msg)

     def dictionary_should_not_contain_key(self, dictionary, key, msg=None):
         """Fails if `key` is found from `dictionary`.
@@ -586,7 +586,7 @@
         The given dictionary is never altered by this keyword.
         """
         default = "Dictionary contains key '%s'." % key
-        _verify_condition(not dictionary.has_key(key), default, msg)
+        _verify_condition(key not in dictionary, default, msg)

def dictionary_should_contain_item(self, dictionary, key, value, msg=None):
         """An item of `key`/`value` must be found in a `dictionary`.

==============================================================================
Revision: 93277ee991ab
Branch:   default
Author:   Pekka Klärck
Date:     Fri Sep  6 11:06:04 2013 UTC
Log:      Automated merge with https://code.google.com/p/robotframework/
http://code.google.com/p/robotframework/source/detail?r=93277ee991ab


--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to