Ejemplo n.º 1
0
    def test_load_store(self):
        with TempFile(no_create=True) as tmp:
            with open(tmp, 'w') as f:
                f.write(pickle.dumps({("view", "cache", "grid"): [(0, 1), (2, 4)]}))
            store = ProgressStore(tmp)
            assert store.get(('view', 'cache', 'grid')) == [(0, 1), (2, 4)]
            assert store.get(('view', 'cache', 'grid2')) == None
            store.add(('view', 'cache', 'grid'), [])
            store.add(('view', 'cache', 'grid2'), [(0, 1)])
            store.write()

            store = ProgressStore(tmp)
            assert store.get(('view', 'cache', 'grid')) == []
            assert store.get(('view', 'cache', 'grid2')) == [(0, 1)]
Ejemplo n.º 2
0
 def test_load_empty(self):
     store = ProgressStore("doesnotexist.no_realy.txt")
     store.load()
     assert store.get(("foo", "bar", "baz")) == None
Ejemplo n.º 3
0
 def test_load_empty(self):
     store = ProgressStore('doesnotexist.no_realy.txt')
     store.load()
     assert store.get(('foo', 'bar', 'baz')) == None
Ejemplo n.º 4
0
 def test_load_empty(self):
     store = ProgressStore('doesnotexist.no_realy.txt')
     store.load()
     assert store.get(('foo', 'bar', 'baz')) == None