Skip to content

Commit

Permalink
Merge 1d92720 into ada2754
Browse files Browse the repository at this point in the history
  • Loading branch information
terrorfisch committed Jul 6, 2018
2 parents ada2754 + 1d92720 commit cb96de2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/serialization_tests.py
Expand Up @@ -590,6 +590,31 @@ def test_beautified_json(self) -> None:
}"""
self.assertEqual(expected, pulse_storage._storage_backend['foo'])

def test_delitem(self):
instance_1 = DummySerializable(identifier='my_id_1')
instance_2 = DummySerializable(identifier='my_id_2')

backend = DummyStorageBackend()

pulse_storage = PulseStorage(backend)
with self.assertRaises(KeyError):
del pulse_storage[instance_1.identifier]

# write first instance to backend
pulse_storage[instance_1.identifier] = instance_1

del pulse_storage

# now instance_1 is not in the temporary storage
pulse_storage = PulseStorage(backend)
pulse_storage[instance_2.identifier] = instance_2

del pulse_storage[instance_1.identifier]
del pulse_storage[instance_2.identifier]

self.assertEqual({}, backend.stored_items)
self.assertEqual(pulse_storage.temporary_storage, {})


class JSONSerializableDecoderTests(unittest.TestCase):
def test_filter_serializables(self):
Expand Down

0 comments on commit cb96de2

Please sign in to comment.