def test_before_update_hook(backend, small_test_data):

    my_document = MyDerivedDocument({'test': 123})
    backend.save(my_document)

    assert hasattr(my_document, 'foo')
    assert my_document.foo == "bar"

    backend.update(my_document,{'foo' : 'baz'})
    backend.commit()

    assert my_document.foo == 'baz'
    assert 'updated_at' in my_document
    assert isinstance(my_document.updated_at,datetime.datetime)
dataset/ETHPy150Open adewes/blitzdb/blitzdb/tests/test_hooks.py/test_before_update_hook/original