def test_value_error(self): @assure(tuple_of(int, int)) def f(x): return x with self.assertRaises(ValueError): f(("bla", "bla")) with self.assertRaises(ValueError): f((1, "bla")) with self.assertRaises(ValueError): f(("bla", 2))
def test_convert(self): @assure(tuple_of(str, int)) def f(x): return x self.assertEquals(("1",0), f(("1", "0")))
def test_pass_through(self): @assure(tuple_of(str, int)) def f(x): return x self.assertEquals(("bla", 1), f(("bla", 1)))