Пример #1
0
 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)
Пример #2
0
 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)
Пример #3
0
 def test_integer(self):
     for x in [-1, "-1", 0, "0", 65535, "65535"]:
         integer(x)
Пример #4
0
 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))
Пример #5
0
 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))