Example #1
0
    def test_deserialize(self):
        cv = types.LogColor()

        assert cv.deserialize(b"RED") == "red"
        assert cv.deserialize("RED") == "red"
        assert cv.deserialize(b"red") == "red"
        assert cv.deserialize("red") == "red"
Example #2
0
    def test_serialize_ignores_unknown_color(self):
        cv = types.LogColor()

        assert cv.serialize("golden") == ""
Example #3
0
    def test_serialize(self):
        cv = types.LogColor()

        assert cv.serialize("red") == "red"
        assert cv.serialize("blue") == "blue"
Example #4
0
    def test_deserialize_enforces_choices(self):
        cv = types.LogColor()

        with pytest.raises(ValueError):
            cv.deserialize("golden")