Beispiel #1
0
 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)
Beispiel #2
0
 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)
Beispiel #3
0
 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)
Beispiel #4
0
 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)
Beispiel #5
0
 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)
Beispiel #6
0
 def test_toboolStr2(self):
     out = machinestate.tobool("2")
     self.assertEqual(out, True)
Beispiel #7
0
 def test_toboolStr0(self):
     out = machinestate.tobool("0")
     self.assertEqual(out, False)
Beispiel #8
0
 def test_toboolFloatTrueNeg(self):
     out = machinestate.tobool(-12.2)
     self.assertEqual(out, True)
Beispiel #9
0
 def test_toboolFloatTruePos(self):
     out = machinestate.tobool(1.2)
     self.assertEqual(out, True)
Beispiel #10
0
 def test_toboolFloatFalse(self):
     out = machinestate.tobool(0.0)
     self.assertEqual(out, False)
Beispiel #11
0
 def test_toboolIntTrueNeg4(self):
     out = machinestate.tobool(-4)
     self.assertEqual(out, True)
Beispiel #12
0
 def test_toboolIntTrue2(self):
     out = machinestate.tobool(2)
     self.assertEqual(out, True)