Ejemplo n.º 1
0
class TestBinaryEquipment(DatabaseTest):
    def setup(self):
        self.equip = BinaryEquipment("output", "equip")
        super().setup()

    def _test_val(self, setpoint, exp):
        value = self.equip.update_state(setpoint)
        ok_(isinstance(value, Equipment.value_type),
            "Type of value should be EquipmentDataValues, got {}".format(
                    type(value)))
        eq_(value.value, exp)

    def test_binary_coercion(self):
        tests = [
            (0.0, 0.0),
            (0.1, 0.0),
            (0.4, 0.0),
            (-1.0, 0.0),
            (0.6, 1.0),
            (0.9, 1.0),
            (5.0, 1.0),
        ]
        for val, exp in tests:
            yield self._test_val, val, exp
Ejemplo n.º 2
0
 def setup(self):
     self.equip = BinaryEquipment("output", "equip")
     super().setup()