Exemplo n.º 1
0
 def test_boolean(self):
     for x in [True, "True", "true", 1, "1"]:
         self.assertEqual(boolean(x), True, repr(x))
     for x in [False, "False", "false", 0, "0"]:
         self.assertEqual(boolean(x), False, repr(x))
     for x in ["000", "111", "abc"]:
         with self.assertRaises(ValueError):
             boolean(x)
Exemplo n.º 2
0
 def test_boolean(self):
     for x in [True, "True", "true", 1, "1"]:
         self.assertEqual(boolean(x), "true", repr(x))
     for x in [False, "False", "false", 0, "0"]:
         self.assertEqual(boolean(x), "false", repr(x))
     for x in ["000", "111", "abc"]:
         with self.assertRaises(ValueError):
             boolean(x)
Exemplo n.º 3
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))
Exemplo n.º 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))