def testTuplePrecondition(self):
     c = preconditions._TuplePrecondition(
         preconditions._ClassNamePrecondition("int"))
     c.check(())
     c.check((1, ))
     c.check((1, 2))
     self.assertError("actual=int.*expected=tuple", c, 1)
示例#2
0
 def test_tuple_precondition(self):
     c = preconditions._TuplePrecondition(
         preconditions._ClassNamePrecondition("int"))
     self.assertEqual({"int"}, c.allowed_types())
     c.check(())
     c.check((1, ))
     c.check((1, 2))
     self.assertError("actual=int.*expected=tuple", c, 1)