summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test.py2
-rw-r--r--viewstate.py7
2 files changed, 6 insertions, 3 deletions
diff --git a/test.py b/test.py
index c0cfc10..f203615 100644
--- a/test.py
+++ b/test.py
@@ -22,7 +22,7 @@ class TestViewState(unittest.TestCase):
def test_parse_const_value(self):
vs = ViewState()
vs.raw = b'\xff\x01\x67'
- self.assertEquals(vs.decode(), True)
+ self.assertEqual(vs.decode(), True)
if __name__ == '__main__':
unittest.main()
diff --git a/viewstate.py b/viewstate.py
index bf14005..b75cd37 100644
--- a/viewstate.py
+++ b/viewstate.py
@@ -9,10 +9,13 @@ CONSTS = {
104: False
}
+def parse_const(b):
+ return CONSTS.get(b, None)
+
def parse(b):
assert type(b) == bytes().__class__
- if len(b) == 1 and b[0] in CONSTS:
- return CONSTS[b[0]]
+ if len(b) == 1:
+ return parse_const(b[0])
return None