diff --git a/tests/test_model.py b/tests/test_model.py index 9d27d35..b2c63b4 100644 --- a/tests/test_model.py +++ b/tests/test_model.py @@ -194,6 +194,23 @@ def test_field_function_with_attribute(): person = Person() assert '' +def test_field_function_with_model(): + class Hash(facho.model.Model): + __name__ = 'Hash' + + id = fields.Attribute('id') + + class Person(facho.model.Model): + __name__ = 'Person' + + hash = fields.Function('get_hash', field=fields.Model(Hash)) + + def get_hash(self, name, field): + field.id = 'calculate' + + person = Person() + assert '' + def test_field_function(): class Person(facho.model.Model): __name__ = 'Person'