Skip to content

Commit

Permalink
Added test for issue #17
Browse files Browse the repository at this point in the history
  • Loading branch information
muhrin committed Jun 24, 2022
1 parent 913fb45 commit 2f50345
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/historian/test_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,25 @@ def test_meta_update_operators(historian: mincepy.Historian):
# Now, perform an update operation on the number of owners
historian.meta.update(car_id, {'$inc': {'num_owners': 1}})
assert historian.meta.get(car_id) == dict(num_owners=2)


@pytest.mark.skip(
'Not supported yet, once this passes we can close https://github.com/muhrin/mincepy/issues/17')
def test_saving_unsaved_meta(historian: mincepy.Historian):
child_meta = {'test': 'meta'}

class Info(mincepy.SimpleSavable):
TYPE_ID = uuid.UUID('0d160c5d-b893-44c4-ae9c-545c0bd53df2')

def __init__(self):
super().__init__()
self.child = None

def save_instance_state(self, saver: mincepy.Saver) -> dict:
self.child = Car()
saver.get_historian().meta.set(self.child, child_meta)
return super().save_instance_state(saver)

info = Info()
info.save()
assert historian.meta.get(info.child) == child_meta

0 comments on commit 2f50345

Please sign in to comment.