def mapped(): import yorm yorm.settings.fake = True yield decorators.sync(SampleWithMagicMethods(), "sample.yml") yorm.settings.fake = False
def reads_existing_files(instance, path): sample = decorators.sync(instance, path, auto_track=True) expect(sample.abc) == 123
def cannot_be_called_twice(instance, path): sample = decorators.sync(instance, path) with pytest.raises(TypeError): decorators.sync(instance, path)
def with_attrs(instance, path): attrs = {'var1': MockConverter} sample = decorators.sync(instance, path, attrs) expect(sample.__mapper__.path) == "sample.yml" expect(sample.__mapper__.attrs) == {'var1': MockConverter}
def with_no_attrs(instance, path): sample = decorators.sync(instance, path) expect(sample.__mapper__.path) == "sample.yml" expect(sample.__mapper__.attrs) == {}