diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-12-11 08:28:14 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-12-11 08:28:14 (GMT) |
commit | c02d188a84a5144232827d35adbc1349cd4463b7 (patch) | |
tree | 3862404b65d98596474b9b00da2579f3e6cb4f90 /Lib/unittest | |
parent | afd6f63739cba92abc5f23384fbe30980ff25131 (diff) | |
download | cpython-c02d188a84a5144232827d35adbc1349cd4463b7.zip cpython-c02d188a84a5144232827d35adbc1349cd4463b7.tar.gz cpython-c02d188a84a5144232827d35adbc1349cd4463b7.tar.bz2 |
Issue #22823: Use set literals instead of creating a set from a list.
Fixed an output of sets in examples.
Diffstat (limited to 'Lib/unittest')
-rw-r--r-- | Lib/unittest/mock.py | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py index 1c2dd1c..6b261d6 100644 --- a/Lib/unittest/mock.py +++ b/Lib/unittest/mock.py @@ -275,13 +275,11 @@ def _copy(value): return value -_allowed_names = set( - [ - 'return_value', '_mock_return_value', 'side_effect', - '_mock_side_effect', '_mock_parent', '_mock_new_parent', - '_mock_name', '_mock_new_name' - ] -) +_allowed_names = { + 'return_value', '_mock_return_value', 'side_effect', + '_mock_side_effect', '_mock_parent', '_mock_new_parent', + '_mock_name', '_mock_new_name' +} def _delegating_property(name): @@ -1679,11 +1677,12 @@ right = ' '.join('r%s' % n for n in numerics.split()) # (as they are metaclass methods) # __del__ is not supported at all as it causes problems if it exists -_non_defaults = set('__%s__' % method for method in [ - 'get', 'set', 'delete', 'reversed', 'missing', 'reduce', 'reduce_ex', - 'getinitargs', 'getnewargs', 'getstate', 'setstate', 'getformat', - 'setformat', 'repr', 'dir', 'subclasses', 'format', -]) +_non_defaults = { + '__get__', '__set__', '__delete__', '__reversed__', '__missing__', + '__reduce__', '__reduce_ex__', '__getinitargs__', '__getnewargs__', + '__getstate__', '__setstate__', '__getformat__', '__setformat__', + '__repr__', '__dir__', '__subclasses__', '__format__', +) def _get_method(name, func): @@ -1694,19 +1693,19 @@ def _get_method(name, func): return method -_magics = set( +_magics = { '__%s__' % method for method in ' '.join([magic_methods, numerics, inplace, right]).split() -) +} _all_magics = _magics | _non_defaults -_unsupported_magics = set([ +_unsupported_magics = { '__getattr__', '__setattr__', '__init__', '__new__', '__prepare__' '__instancecheck__', '__subclasscheck__', '__del__' -]) +} _calculate_return_value = { '__hash__': lambda self: object.__hash__(self), |