summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_parse.py3
-rw-r--r--viewstate/parse.py4
2 files changed, 5 insertions, 2 deletions
diff --git a/tests/test_parse.py b/tests/test_parse.py
index f5a0828..c1e1abb 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -45,6 +45,9 @@ class TestParse(object):
vs = ViewState(raw=b"\xff\x01\n\x8d\x01")
assert vs.decode() == "Color: Red"
+ vs = ViewState(raw=b"\xff\x01\n\xff")
+ assert vs.decode() == "Color: Unknown"
+
def test_rgba(self):
vs = ViewState(raw=b"\xff\x01\x09\x10\x20\x30\x40")
assert vs.decode() == "RGBA(16,32,48,64)"
diff --git a/viewstate/parse.py b/viewstate/parse.py
index 910b21b..b2a85f0 100644
--- a/viewstate/parse.py
+++ b/viewstate/parse.py
@@ -122,10 +122,10 @@ class Color(Parser):
@staticmethod
def parse(b):
try:
- color = "Color: {}".format(COLORS[b[0]])
+ color = COLORS[b[0]]
except IndexError:
color = "Unknown"
- return color, b[1:]
+ return "Color: {}".format(color), b[1:]
class Pair(Parser):