Commits

Andriy Kornatskyy  committed 303b213

Added test for types check.

  • Participants
  • Parent commits 401c62b

Comments (0)

Files changed (2)

File src/wheezy/core/introspection.py

                              "have no match." % name)
                         return False
                 elif t2.__class__ is not t.__class__:
-                    warn("'%s': is not %s." % (n, t.__class__.__name__))
+                    warn("'%s': is not %s." % (name, t.__class__.__name__))
                     return False
         return True
 

File src/wheezy/core/tests/test_introspection.py

             assert looks(Foo).like(IFoo, notice=['__len__'])
 
         def test_decorator(self):
-            """
+            """ Decorator argspec doesn't match.
             """
             from wheezy.core.introspection import looks
 
             self.assert_warning("'foo': argument names or defaults "
                                 "have no match.")
 
+        def test_type(self):
+            """ Test if decorator types do not match.
+            """
+            from wheezy.core.descriptors import attribute
+            from wheezy.core.introspection import looks
+
+            class IFoo(object):
+                @attribute
+                def foo(self):
+                    pass
+
+            class Foo(IFoo):
+                @property
+                def foo(self):
+                    pass
+
+            assert not looks(Foo).like(IFoo)
+            self.assert_warning("'foo': is not attribute.")
+
         def test_various(self):
             """ Tests if there are no errors.
             """