def testNotEqual(self): v = BoolProxy(True) assert v != False assert False != v v = BoolProxy(False) assert v != True assert True != v
def testTextual(self): v=BoolProxy(textual="on") self.assert_(v) self.assertEqual(str(v),'on') v=BoolProxy(textual="off") self.assert_(not v) self.assertEqual(str(v),'off')
def testEqualNormalBool(self): t = BoolProxy(True) f = BoolProxy(False) self.assertEqual(t == None, True == None) self.assertEqual(f == None, False == None) self.assertEqual(None == t, True == None) self.assertEqual(None == f, False == None) self.assertEqual(t == "", True == "")
def testConstruction(self): with self.assertRaises(TypeError): v=BoolProxy(False,textual="on") with self.assertRaises(TypeError): v=BoolProxy() with self.assertRaises(TypeError): v=BoolProxy(textual="foo") with self.assertRaises(TypeError): v=BoolProxy(textual="foo") with self.assertRaises(TypeError): v=BoolProxy("yes")
def testEqual(self): v=BoolProxy(True) self.assertEqual(v,True) self.assertEqual(True,v) v=BoolProxy(False) self.assertEqual(v,False) self.assertEqual(False,v) v2=BoolProxy(False) self.assertEqual(v,v2) v2=BoolProxy(True) self.assertNotEqual(v,v2) self.assertEqual(v,"no") self.assertEqual(v,"off") self.assertEqual(v2,"yes") self.assertEqual(v2,"on") self.assertEqual("on",v2) self.assertNotEqual(v,"foo")
def testEqual(self): v = BoolProxy(True) assert v == True assert True == v v = BoolProxy(False) assert v == False assert False == v v2 = BoolProxy(False) self.assertEqual(v, v2) v2 = BoolProxy(True) self.assertNotEqual(v, v2) self.assertEqual(v, "no") self.assertEqual(v, "off") self.assertEqual(v2, "yes") self.assertEqual(v2, "on") self.assertEqual("on", v2) self.assertNotEqual(v, "foo")
def testString(self): v=BoolProxy(True) self.assertEqual(str(v),'yes') v=BoolProxy(False) self.assertEqual(str(v),'no')
def testNonZero(self): v=BoolProxy(True) self.assert_(v) v=BoolProxy(False) self.assert_(not v)