Пример #1
0
 def test_bool(self):
     assert Bool(True) is True
     assert Bool('y') is True
     assert Bool('YES') is True
     assert Bool('t') is True
     assert Bool('true') is True
     assert Bool('1') is True
     assert Bool(False) is False
     assert Bool('n') is False
     assert Bool('NO') is False
     assert Bool('f') is False
     assert Bool('false') is False
     assert Bool('0') is False
     assert Bool() is False
     assert Bool.test(None) is False
     assert Bool(True) is True
     assert Bool.test('foo') is False
     with self.assertRaises(InvalidTypeError):
         Bool('foo')
Пример #2
0
 def test_bool(self):
     assert Bool(True) is True
     assert Bool(1) is True
     assert Bool("y") is True
     assert Bool("YES") is True
     assert Bool("t") is True
     assert Bool("true") is True
     assert Bool("1") is True
     assert Bool("on") is True
     assert Bool(False) is False
     assert Bool(0) is False
     assert Bool("n") is False
     assert Bool("NO") is False
     assert Bool("f") is False
     assert Bool("false") is False
     assert Bool("0") is False
     assert Bool("off") is False
     assert Bool() is False
     assert Bool.test(None) is False
     assert Bool(True) is True
     assert Bool.test("foo") is False
     with self.assertRaises(InvalidTypeError):
         Bool("foo")