diff --git a/src/wrapt/wrappers.py b/src/wrapt/wrappers.py index 1be4aba..2d5935b 100644 --- a/src/wrapt/wrappers.py +++ b/src/wrapt/wrappers.py @@ -18,14 +18,14 @@ def with_metaclass(meta, *bases): class _ObjectProxyMethods(object): - # We use properties to override the values of __module__ and - # __doc__. If we add these in ObjectProxy, the derived class - # __dict__ will still be setup to have string variants of these - # attributes and the rules of descriptors means that they appear to - # take precedence over the properties in the base class. To avoid - # that, we copy the properties into the derived class type itself - # via a meta class. In that way the properties will always take - # precedence. + # We use properties to override the values of __module__ and + # __doc__. If we add these in ObjectProxy, the derived class + # __dict__ will still be setup to have string variants of these + # attributes and the rules of descriptors means that they appear to + # take precedence over the properties in the base class. To avoid + # that, we copy the properties into the derived class type itself + # via a meta class. In that way the properties will always take + # precedence. @property def __module__(self): @@ -61,10 +61,10 @@ class _ObjectProxyMethods(object): class _ObjectProxyMetaType(type): def __new__(cls, name, bases, dictionary): - # Copy our special properties into the class so that they - # always take precedence over attributes of the same name added - # during construction of a derived class. This is to save - # duplicating the implementation for them in all derived classes. + # Copy our special properties into the class so that they + # always take precedence over attributes of the same name added + # during construction of a derived class. This is to save + # duplicating the implementation for them in all derived classes. dictionary.update(vars(_ObjectProxyMethods)) diff --git a/tests/test_adapter.py b/tests/test_adapter.py index bbd2426..8c75f11 100644 --- a/tests/test_adapter.py +++ b/tests/test_adapter.py @@ -52,7 +52,7 @@ class TestAdapterAttributes(unittest.TestCase): self.assertEqual(function1d.__qualname__, __qualname__) def test_module_name(self): - # Test preservation of function __module__ attribute. + # Test preservation of function __module__ attribute. self.assertEqual(function1d.__module__, __name__) diff --git a/tests/test_arguments.py b/tests/test_arguments.py index ca5fecb..5c688ec 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -8,7 +8,7 @@ class TestArguments(unittest.TestCase): def test_getcallargs(self): def function(a, b=2, c=3, d=4, e=5, *args, **kwargs): - pass + pass expected = {'a': 10, 'c': 3, 'b': 20, 'e': 5, 'd': 40, 'args': (), 'kwargs': {'f': 50}} diff --git a/tests/test_function.py b/tests/test_function.py index 906336a..7660ea2 100644 --- a/tests/test_function.py +++ b/tests/test_function.py @@ -50,7 +50,7 @@ class TestNamingFunction(unittest.TestCase): self.assertEqual(function1d.__qualname__, __qualname__) def test_module_name(self): - # Test preservation of function __module__ attribute. + # Test preservation of function __module__ attribute. self.assertEqual(function1d.__module__, __name__) diff --git a/tests/test_inner_classmethod.py b/tests/test_inner_classmethod.py index babd621..6454421 100644 --- a/tests/test_inner_classmethod.py +++ b/tests/test_inner_classmethod.py @@ -69,13 +69,13 @@ class TestNamingInnerClassMethod(unittest.TestCase): self.assertEqual(Class().function.__qualname__, __qualname__) def test_class_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(Class.function.__module__, Original.function.__module__) def test_instance_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(Class().function.__module__, Original().function.__module__) diff --git a/tests/test_inner_staticmethod.py b/tests/test_inner_staticmethod.py index 897be06..1e4816c 100644 --- a/tests/test_inner_staticmethod.py +++ b/tests/test_inner_staticmethod.py @@ -49,7 +49,7 @@ class TestNamingInnerStaticMethod(unittest.TestCase): Original().function.__name__) def test_class_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(Class.function.__module__, Original.function.__module__) @@ -75,7 +75,7 @@ class TestNamingInnerStaticMethod(unittest.TestCase): self.assertEqual(Class().function.__qualname__, __qualname__) def test_instance_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(Class().function.__module__, Original().function.__module__) diff --git a/tests/test_instancemethod.py b/tests/test_instancemethod.py index 7d2de50..23bba8a 100644 --- a/tests/test_instancemethod.py +++ b/tests/test_instancemethod.py @@ -69,13 +69,13 @@ class TestNamingInstanceMethodOldStyle(unittest.TestCase): self.assertEqual(OldClass1d().function.__qualname__, __qualname__) def test_class_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(OldClass1d.function.__module__, OldClass1o.function.__module__) def test_instance_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(OldClass1d().function.__module__, OldClass1o().function.__module__) @@ -172,13 +172,13 @@ class TestNamingInstanceMethodNewStyle(unittest.TestCase): self.assertEqual(NewClass1d().function.__qualname__, __qualname__) def test_class_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(NewClass1d.function.__module__, NewClass1o.function.__module__) def test_instance_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(NewClass1d().function.__module__, NewClass1o().function.__module__) diff --git a/tests/test_nested_function.py b/tests/test_nested_function.py index f9bc497..4f55a36 100644 --- a/tests/test_nested_function.py +++ b/tests/test_nested_function.py @@ -54,7 +54,7 @@ class TestNamingNestedFunction(unittest.TestCase): self.assertEqual(function1d().__qualname__, __qualname__) def test_module_name(self): - # Test preservation of function __module__ attribute. + # Test preservation of function __module__ attribute. self.assertEqual(function1d().__module__, __name__) diff --git a/tests/test_object_proxy.py b/tests/test_object_proxy.py index a77e13f..97a6e89 100644 --- a/tests/test_object_proxy.py +++ b/tests/test_object_proxy.py @@ -167,7 +167,7 @@ class TestNamingObjectProxy(unittest.TestCase): self.assertEqual(wrapper.__qualname__, __qualname__) def test_class_module_name(self): - # Test preservation of class __module__ attribute. + # Test preservation of class __module__ attribute. target = objects.Target wrapper = wrapt.ObjectProxy(target) @@ -183,7 +183,7 @@ class TestNamingObjectProxy(unittest.TestCase): self.assertEqual(wrapper.__doc__, target.__doc__) def test_instance_module_name(self): - # Test preservation of instance __module__ attribute. + # Test preservation of instance __module__ attribute. target = objects.Target() wrapper = wrapt.ObjectProxy(target) @@ -220,7 +220,7 @@ class TestNamingObjectProxy(unittest.TestCase): self.assertEqual(wrapper.__qualname__, __qualname__) def test_function_module_name(self): - # Test preservation of function __module__ attribute. + # Test preservation of function __module__ attribute. target = objects.target wrapper = wrapt.ObjectProxy(target) diff --git a/tests/test_outer_classmethod.py b/tests/test_outer_classmethod.py index a571491..6a12832 100644 --- a/tests/test_outer_classmethod.py +++ b/tests/test_outer_classmethod.py @@ -69,13 +69,13 @@ class TestNamingOuterClassMethod(unittest.TestCase): self.assertEqual(Class().function.__qualname__, __qualname__) def test_class_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(Class.function.__module__, Original.function.__module__) def test_instance_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(Class().function.__module__, Original().function.__module__) diff --git a/tests/test_outer_staticmethod.py b/tests/test_outer_staticmethod.py index 3862b22..0a0d0f7 100644 --- a/tests/test_outer_staticmethod.py +++ b/tests/test_outer_staticmethod.py @@ -69,13 +69,13 @@ class TestNamingOuterStaticMethod(unittest.TestCase): self.assertEqual(Class().function.__qualname__, __qualname__) def test_class_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(Class.function.__module__, Original.function.__module__) def test_instance_module_name(self): - # Test preservation of instance method __module__ attribute. + # Test preservation of instance method __module__ attribute. self.assertEqual(Class().function.__module__, Original().function.__module__)