mirror of
https://github.com/simon987/hexlib.git
synced 2025-04-10 14:06:43 +00:00
Handle bool values in state
This commit is contained in:
parent
b2efaa99a4
commit
58d150279f
@ -162,6 +162,8 @@ def _serialize(value):
|
||||
return base64.b64encode(value)
|
||||
if value is None:
|
||||
return None
|
||||
if isinstance(value, bool):
|
||||
return value
|
||||
return str(value)
|
||||
|
||||
|
||||
|
2
setup.py
2
setup.py
@ -2,7 +2,7 @@ from setuptools import setup
|
||||
|
||||
setup(
|
||||
name="hexlib",
|
||||
version="1.21",
|
||||
version="1.22",
|
||||
description="Misc utility methods",
|
||||
author="simon987",
|
||||
author_email="me@simon987.net",
|
||||
|
@ -61,3 +61,17 @@ class TestPersistentState(TestCase):
|
||||
val["id"] = 1
|
||||
|
||||
self.assertDictEqual(val, s["a"][1])
|
||||
|
||||
def test_bool(self):
|
||||
s = PersistentState()
|
||||
|
||||
val = {"a": True, "b": False}
|
||||
s["a"][1] = val
|
||||
s["a"][1] = {
|
||||
"a": True
|
||||
}
|
||||
|
||||
val["a"] = True
|
||||
val["id"] = 1
|
||||
|
||||
self.assertDictEqual(val, s["a"][1])
|
||||
|
Loading…
x
Reference in New Issue
Block a user