def test_integer(self): self.assertEqual(integer(-1), -1) self.assertEqual(integer("-1"), "-1") self.assertEqual(integer(0), 0) self.assertEqual(integer("0"), "0") self.assertEqual(integer(65535), 65535) self.assertEqual(integer("65535"), "65535") self.assertEqual(integer(1.0), 1.0) with self.assertRaises(ValueError): integer("string") with self.assertRaises(ValueError): integer(object) with self.assertRaises(ValueError): integer(None)
def test_integer(self): for x in [-1, "-1", 0, "0", 65535, "65535"]: integer(x)
def test_integer(self): for x in [-1, "-1", 0, "0", 65535, "65535"]: integer(x) for x in [False, "False", "false", 0, "0"]: self.assertEqual(boolean(x), False, repr(x))