Fix bad identation
Fix identation
This commit is contained in:
@@ -18,14 +18,14 @@ def with_metaclass(meta, *bases):
|
|||||||
|
|
||||||
class _ObjectProxyMethods(object):
|
class _ObjectProxyMethods(object):
|
||||||
|
|
||||||
# We use properties to override the values of __module__ and
|
# We use properties to override the values of __module__ and
|
||||||
# __doc__. If we add these in ObjectProxy, the derived class
|
# __doc__. If we add these in ObjectProxy, the derived class
|
||||||
# __dict__ will still be setup to have string variants of these
|
# __dict__ will still be setup to have string variants of these
|
||||||
# attributes and the rules of descriptors means that they appear to
|
# attributes and the rules of descriptors means that they appear to
|
||||||
# take precedence over the properties in the base class. To avoid
|
# take precedence over the properties in the base class. To avoid
|
||||||
# that, we copy the properties into the derived class type itself
|
# that, we copy the properties into the derived class type itself
|
||||||
# via a meta class. In that way the properties will always take
|
# via a meta class. In that way the properties will always take
|
||||||
# precedence.
|
# precedence.
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def __module__(self):
|
def __module__(self):
|
||||||
@@ -61,10 +61,10 @@ class _ObjectProxyMethods(object):
|
|||||||
|
|
||||||
class _ObjectProxyMetaType(type):
|
class _ObjectProxyMetaType(type):
|
||||||
def __new__(cls, name, bases, dictionary):
|
def __new__(cls, name, bases, dictionary):
|
||||||
# Copy our special properties into the class so that they
|
# Copy our special properties into the class so that they
|
||||||
# always take precedence over attributes of the same name added
|
# always take precedence over attributes of the same name added
|
||||||
# during construction of a derived class. This is to save
|
# during construction of a derived class. This is to save
|
||||||
# duplicating the implementation for them in all derived classes.
|
# duplicating the implementation for them in all derived classes.
|
||||||
|
|
||||||
dictionary.update(vars(_ObjectProxyMethods))
|
dictionary.update(vars(_ObjectProxyMethods))
|
||||||
|
|
||||||
|
@@ -52,7 +52,7 @@ class TestAdapterAttributes(unittest.TestCase):
|
|||||||
self.assertEqual(function1d.__qualname__, __qualname__)
|
self.assertEqual(function1d.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_module_name(self):
|
def test_module_name(self):
|
||||||
# Test preservation of function __module__ attribute.
|
# Test preservation of function __module__ attribute.
|
||||||
|
|
||||||
self.assertEqual(function1d.__module__, __name__)
|
self.assertEqual(function1d.__module__, __name__)
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ class TestArguments(unittest.TestCase):
|
|||||||
|
|
||||||
def test_getcallargs(self):
|
def test_getcallargs(self):
|
||||||
def function(a, b=2, c=3, d=4, e=5, *args, **kwargs):
|
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,
|
expected = {'a': 10, 'c': 3, 'b': 20, 'e': 5, 'd': 40,
|
||||||
'args': (), 'kwargs': {'f': 50}}
|
'args': (), 'kwargs': {'f': 50}}
|
||||||
|
@@ -50,7 +50,7 @@ class TestNamingFunction(unittest.TestCase):
|
|||||||
self.assertEqual(function1d.__qualname__, __qualname__)
|
self.assertEqual(function1d.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_module_name(self):
|
def test_module_name(self):
|
||||||
# Test preservation of function __module__ attribute.
|
# Test preservation of function __module__ attribute.
|
||||||
|
|
||||||
self.assertEqual(function1d.__module__, __name__)
|
self.assertEqual(function1d.__module__, __name__)
|
||||||
|
|
||||||
|
@@ -69,13 +69,13 @@ class TestNamingInnerClassMethod(unittest.TestCase):
|
|||||||
self.assertEqual(Class().function.__qualname__, __qualname__)
|
self.assertEqual(Class().function.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_class_module_name(self):
|
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__,
|
self.assertEqual(Class.function.__module__,
|
||||||
Original.function.__module__)
|
Original.function.__module__)
|
||||||
|
|
||||||
def test_instance_module_name(self):
|
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__,
|
self.assertEqual(Class().function.__module__,
|
||||||
Original().function.__module__)
|
Original().function.__module__)
|
||||||
|
@@ -49,7 +49,7 @@ class TestNamingInnerStaticMethod(unittest.TestCase):
|
|||||||
Original().function.__name__)
|
Original().function.__name__)
|
||||||
|
|
||||||
def test_class_module_name(self):
|
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__,
|
self.assertEqual(Class.function.__module__,
|
||||||
Original.function.__module__)
|
Original.function.__module__)
|
||||||
@@ -75,7 +75,7 @@ class TestNamingInnerStaticMethod(unittest.TestCase):
|
|||||||
self.assertEqual(Class().function.__qualname__, __qualname__)
|
self.assertEqual(Class().function.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_instance_module_name(self):
|
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__,
|
self.assertEqual(Class().function.__module__,
|
||||||
Original().function.__module__)
|
Original().function.__module__)
|
||||||
|
@@ -69,13 +69,13 @@ class TestNamingInstanceMethodOldStyle(unittest.TestCase):
|
|||||||
self.assertEqual(OldClass1d().function.__qualname__, __qualname__)
|
self.assertEqual(OldClass1d().function.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_class_module_name(self):
|
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__,
|
self.assertEqual(OldClass1d.function.__module__,
|
||||||
OldClass1o.function.__module__)
|
OldClass1o.function.__module__)
|
||||||
|
|
||||||
def test_instance_module_name(self):
|
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__,
|
self.assertEqual(OldClass1d().function.__module__,
|
||||||
OldClass1o().function.__module__)
|
OldClass1o().function.__module__)
|
||||||
@@ -172,13 +172,13 @@ class TestNamingInstanceMethodNewStyle(unittest.TestCase):
|
|||||||
self.assertEqual(NewClass1d().function.__qualname__, __qualname__)
|
self.assertEqual(NewClass1d().function.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_class_module_name(self):
|
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__,
|
self.assertEqual(NewClass1d.function.__module__,
|
||||||
NewClass1o.function.__module__)
|
NewClass1o.function.__module__)
|
||||||
|
|
||||||
def test_instance_module_name(self):
|
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__,
|
self.assertEqual(NewClass1d().function.__module__,
|
||||||
NewClass1o().function.__module__)
|
NewClass1o().function.__module__)
|
||||||
|
@@ -54,7 +54,7 @@ class TestNamingNestedFunction(unittest.TestCase):
|
|||||||
self.assertEqual(function1d().__qualname__, __qualname__)
|
self.assertEqual(function1d().__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_module_name(self):
|
def test_module_name(self):
|
||||||
# Test preservation of function __module__ attribute.
|
# Test preservation of function __module__ attribute.
|
||||||
|
|
||||||
self.assertEqual(function1d().__module__, __name__)
|
self.assertEqual(function1d().__module__, __name__)
|
||||||
|
|
||||||
|
@@ -167,7 +167,7 @@ class TestNamingObjectProxy(unittest.TestCase):
|
|||||||
self.assertEqual(wrapper.__qualname__, __qualname__)
|
self.assertEqual(wrapper.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_class_module_name(self):
|
def test_class_module_name(self):
|
||||||
# Test preservation of class __module__ attribute.
|
# Test preservation of class __module__ attribute.
|
||||||
|
|
||||||
target = objects.Target
|
target = objects.Target
|
||||||
wrapper = wrapt.ObjectProxy(target)
|
wrapper = wrapt.ObjectProxy(target)
|
||||||
@@ -183,7 +183,7 @@ class TestNamingObjectProxy(unittest.TestCase):
|
|||||||
self.assertEqual(wrapper.__doc__, target.__doc__)
|
self.assertEqual(wrapper.__doc__, target.__doc__)
|
||||||
|
|
||||||
def test_instance_module_name(self):
|
def test_instance_module_name(self):
|
||||||
# Test preservation of instance __module__ attribute.
|
# Test preservation of instance __module__ attribute.
|
||||||
|
|
||||||
target = objects.Target()
|
target = objects.Target()
|
||||||
wrapper = wrapt.ObjectProxy(target)
|
wrapper = wrapt.ObjectProxy(target)
|
||||||
@@ -220,7 +220,7 @@ class TestNamingObjectProxy(unittest.TestCase):
|
|||||||
self.assertEqual(wrapper.__qualname__, __qualname__)
|
self.assertEqual(wrapper.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_function_module_name(self):
|
def test_function_module_name(self):
|
||||||
# Test preservation of function __module__ attribute.
|
# Test preservation of function __module__ attribute.
|
||||||
|
|
||||||
target = objects.target
|
target = objects.target
|
||||||
wrapper = wrapt.ObjectProxy(target)
|
wrapper = wrapt.ObjectProxy(target)
|
||||||
|
@@ -69,13 +69,13 @@ class TestNamingOuterClassMethod(unittest.TestCase):
|
|||||||
self.assertEqual(Class().function.__qualname__, __qualname__)
|
self.assertEqual(Class().function.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_class_module_name(self):
|
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__,
|
self.assertEqual(Class.function.__module__,
|
||||||
Original.function.__module__)
|
Original.function.__module__)
|
||||||
|
|
||||||
def test_instance_module_name(self):
|
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__,
|
self.assertEqual(Class().function.__module__,
|
||||||
Original().function.__module__)
|
Original().function.__module__)
|
||||||
|
@@ -69,13 +69,13 @@ class TestNamingOuterStaticMethod(unittest.TestCase):
|
|||||||
self.assertEqual(Class().function.__qualname__, __qualname__)
|
self.assertEqual(Class().function.__qualname__, __qualname__)
|
||||||
|
|
||||||
def test_class_module_name(self):
|
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__,
|
self.assertEqual(Class.function.__module__,
|
||||||
Original.function.__module__)
|
Original.function.__module__)
|
||||||
|
|
||||||
def test_instance_module_name(self):
|
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__,
|
self.assertEqual(Class().function.__module__,
|
||||||
Original().function.__module__)
|
Original().function.__module__)
|
||||||
|
Reference in New Issue
Block a user