fields.Model se permite cambiar el nombre de la etiqueta
FossilOrigin-Name: 896b797629e426a5e366d5be76fc00c3cc272299d6749e40f8317893b1545a9e
This commit is contained in:
@@ -108,6 +108,20 @@ def test_field_model_failed_initialization():
|
||||
person.id = 33
|
||||
assert "<Person><ID>33</ID></Person>" == person.to_xml()
|
||||
|
||||
def test_field_model_with_custom_name():
|
||||
class ID(facho.model.Model):
|
||||
__name__ = 'ID'
|
||||
|
||||
class Person(facho.model.Model):
|
||||
__name__ = 'Person'
|
||||
|
||||
id = fields.Model(ID, name='DID')
|
||||
|
||||
|
||||
person = Person()
|
||||
person.id = 33
|
||||
assert "<Person><DID>33</DID></Person>" == person.to_xml()
|
||||
|
||||
def test_field_model_default_initialization_with_attributes():
|
||||
class ID(facho.model.Model):
|
||||
__name__ = 'ID'
|
||||
|
||||
Reference in New Issue
Block a user