Ejemplo n.º 1
0
  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
Ejemplo n.º 2
0
    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
Ejemplo n.º 3
0
 def test_constructor(self):
   iv = InterfaceValidator(Example1)
   iv.ensure_method("m1(self)")
   InterfaceValidator(Example1(1,2))
   iv.ensure_method("m1(self)")
Ejemplo n.º 4
0
 def test_constructor(self):
     iv = InterfaceValidator(Example1)
     iv.ensure_method("m1(self)")
     InterfaceValidator(Example1(1, 2))
     iv.ensure_method("m1(self)")