Commits

Andriy Kornatskyy committed 8aac6ee

Added redundant ignore check to looks like asserts.

  • Participants
  • Parent commits 5fc12db

Comments (0)

Files changed (2)

File src/wheezy/core/introspection.py

         notice = notice or []
         ignore_funcs = ignore_funcs or []
         ignore_argspec = ignore_argspec or []
+        basis = declarations(cls, notice=notice)
         contestee = declarations(self.cls, notice=notice)
-        for name, t in declarations(cls, notice=notice).items():
+        for name in ignore_funcs:
+            if name not in basis:
+                warn("'%s': redundant ignore." % name)
+                return False
+        for name, t in basis.items():
             if name in ignore_funcs:
                 continue
             if name not in contestee:

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

                 def bar(self):
                     pass
 
-            assert looks(Foo).like(IFoo, ignore_funcs='foo')
+            assert looks(Foo).like(IFoo, ignore_funcs=['foo'])
+
+        def test_redundant_ignore(self):
+            """ Tests function is set to be ignored but it is not found.
+            """
+            from wheezy.core.introspection import looks
+
+            class IFoo(object):
+                def bar(self):
+                    pass
+
+            class Foo(object):
+                def bar(self):
+                    pass
+
+            assert not looks(Foo).like(IFoo, ignore_funcs=['foo'])
+            self.assert_warning("'foo': redundant ignore.")
 
         def test_args(self):
             """ Tests if there any function args corresponds.