WIP selective state sync

This commit is contained in:
lash
2022-05-02 11:21:07 +00:00
parent 53da59c06e
commit 714bf79d22
3 changed files with 61 additions and 7 deletions

View File

@@ -7,6 +7,7 @@ from shep import State
from shep.error import (
StateExists,
StateInvalid,
StateItemNotFound,
)
logging.basicConfig(level=logging.DEBUG)
@@ -250,5 +251,24 @@ class TestState(unittest.TestCase):
self.assertEqual(mask, states.ALL)
def test_remove(self):
states = State(1)
states.add('foo')
states.put('xyzzy', contents='plugh')
v = states.get('xyzzy')
self.assertEqual(v, 'plugh')
states.next('xyzzy')
v = states.state('xyzzy')
self.assertEqual(states.FOO, v)
states.purge('xyzzy')
with self.assertRaises(StateItemNotFound):
states.state('xyzzy')
if __name__ == '__main__':
unittest.main()