示例#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"
示例#2
0
    def test_serialize_ignores_unknown_color(self):
        cv = types.LogColor()

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

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

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