Skip to content

Commit

Permalink
Fixed failing tests.
Browse files Browse the repository at this point in the history
NestedDummySerializable's constructor now passed the registry argument through to superclass.

Signed-off-by: Lukas Prediger <lukas.prediger@rwth-aachen.de>
  • Loading branch information
lumip committed Jul 5, 2018
1 parent 1ea0878 commit 441b95b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/serialization_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,9 @@ def get_expected():
self.assertEqual(get_expected(), self.backend.stored_items)

def test_write_through_does_not_overwrite_subpulses(self) -> None:
previous_inner = DummySerializable(identifier='my_id_1', data='hey')
inner_instance = DummySerializable(identifier='my_id_1', data='ho')
outer_instance = NestedDummySerializable(inner_instance, identifier='my_id_2')
previous_inner = DummySerializable(identifier='my_id_1', data='hey', registry=dict())
inner_instance = DummySerializable(identifier='my_id_1', data='ho', registry=dict())
outer_instance = NestedDummySerializable(inner_instance, identifier='my_id_2', registry=dict())

self.storage['my_id_1'] = previous_inner
with self.assertRaises(RuntimeError):
Expand All @@ -528,9 +528,9 @@ def test_write_through_does_not_overwrite_subpulses(self) -> None:

def test_failed_overwrite_does_not_leave_subpulses(self) -> None:
inner_named = DummySerializable(data='bar', identifier='inner')
inner_known = DummySerializable(data='bar', identifier='known')
inner_known = DummySerializable(data='bar', identifier='known', registry=dict())
outer = DummySerializable(data=[inner_named, inner_known], identifier='outer')
inner_known_previous = DummySerializable(data='b38azodhg', identifier='known')
inner_known_previous = DummySerializable(data='b38azodhg', identifier='known', registry=dict())

self.storage['known'] = inner_known_previous

Expand Down Expand Up @@ -673,9 +673,9 @@ def get_serialization_data(self):
self.assertIs(storage['known'], inner_known)

def test_encoding_duplicated_id(self):
inner_named = DummySerializable(data='bar', identifier='inner')
inner_known = DummySerializable(data='bar', identifier='known')
inner_known_previous = DummySerializable(data='abh3h8ga', identifier='known')
inner_named = DummySerializable(data='bar', identifier='inner', registry=dict())
inner_known = DummySerializable(data='bar', identifier='known', registry=dict())
inner_known_previous = DummySerializable(data='abh3h8ga', identifier='known', registry=dict())

outer = DummySerializable(data=[inner_named, inner_known])

Expand All @@ -702,8 +702,8 @@ def test_encoding_duplicated_id(self):

class NestedDummySerializable(Serializable):

def __init__(self, data: Serializable, identifier: Optional[str]=None) -> None:
super().__init__(identifier)
def __init__(self, data: Serializable, identifier: Optional[str]=None, registry: Optional[Dict]=None) -> None:
super().__init__(identifier, registry=registry)
self.data = data

@classmethod
Expand Down

0 comments on commit 441b95b

Please sign in to comment.