def test_args(self): e1 = Example1(1,2) iv = InterfaceValidator(e1) self.assertRaises(Exception, iv.ensure_method("foo")) self.assertRaises(Exception, iv.ensure_method("foo (bar)")) self.assertRaises(Exception, iv.ensure_method("foo( bar)")) self.assertRaises(Exception, iv.ensure_method("foo(bar )")) self.assertRaises(Exception, iv.ensure_method("foo( bar )")) self.assertRaises(Exception, iv.ensure_method("foo(bar,baz)")) self.assertRaises(Exception, iv.ensure_method("foo(bar, baz)")) iv.ensure_method("foo()") # should not raise exception iv.ensure_method("foo (bar)") # should not raise exception
def test_args(self): e1 = Example1(1, 2) iv = InterfaceValidator(e1) self.assertRaises(Exception, iv.ensure_method("foo")) self.assertRaises(Exception, iv.ensure_method("foo (bar)")) self.assertRaises(Exception, iv.ensure_method("foo( bar)")) self.assertRaises(Exception, iv.ensure_method("foo(bar )")) self.assertRaises(Exception, iv.ensure_method("foo( bar )")) self.assertRaises(Exception, iv.ensure_method("foo(bar,baz)")) self.assertRaises(Exception, iv.ensure_method("foo(bar, baz)")) iv.ensure_method("foo()") # should not raise exception iv.ensure_method("foo (bar)") # should not raise exception
def test_constructor(self): iv = InterfaceValidator(Example1) iv.ensure_method("m1(self)") InterfaceValidator(Example1(1,2)) iv.ensure_method("m1(self)")
def test_constructor(self): iv = InterfaceValidator(Example1) iv.ensure_method("m1(self)") InterfaceValidator(Example1(1, 2)) iv.ensure_method("m1(self)")