def test_toboolStrOn(self): out = machinestate.tobool("on") self.assertEqual(out, True) out = machinestate.tobool("On") self.assertEqual(out, True) out = machinestate.tobool("ON") self.assertEqual(out, True)
def test_toboolInvalid(self): out = machinestate.tobool("abc") self.assertEqual(out, False) out = machinestate.tobool("-1") self.assertEqual(out, False) out = machinestate.tobool("offf") self.assertEqual(out, False) out = machinestate.tobool("o") self.assertEqual(out, False)
def test_toboolStrOff(self): out = machinestate.tobool("off") self.assertEqual(out, False) out = machinestate.tobool("Off") self.assertEqual(out, False) out = machinestate.tobool("OFf") self.assertEqual(out, False) out = machinestate.tobool("OFF") self.assertEqual(out, False)
def test_toboolStrTrue(self): out = machinestate.tobool("true") self.assertEqual(out, True) out = machinestate.tobool("True") self.assertEqual(out, True) out = machinestate.tobool("TRue") self.assertEqual(out, True) out = machinestate.tobool("TRUe") self.assertEqual(out, True) out = machinestate.tobool("TRUE") self.assertEqual(out, True)
def test_toboolStrFalse(self): out = machinestate.tobool("false") self.assertEqual(out, False) out = machinestate.tobool("False") self.assertEqual(out, False) out = machinestate.tobool("FAlse") self.assertEqual(out, False) out = machinestate.tobool("FALse") self.assertEqual(out, False) out = machinestate.tobool("FALSe") self.assertEqual(out, False) out = machinestate.tobool("FALSE") self.assertEqual(out, False)
def test_toboolStr2(self): out = machinestate.tobool("2") self.assertEqual(out, True)
def test_toboolStr0(self): out = machinestate.tobool("0") self.assertEqual(out, False)
def test_toboolFloatTrueNeg(self): out = machinestate.tobool(-12.2) self.assertEqual(out, True)
def test_toboolFloatTruePos(self): out = machinestate.tobool(1.2) self.assertEqual(out, True)
def test_toboolFloatFalse(self): out = machinestate.tobool(0.0) self.assertEqual(out, False)
def test_toboolIntTrueNeg4(self): out = machinestate.tobool(-4) self.assertEqual(out, True)
def test_toboolIntTrue2(self): out = machinestate.tobool(2) self.assertEqual(out, True)