Exemplo n.º 1
0
def test_element_add_child_must_add_properly(complex_type, string_type):
    name_elem = complex_type.children[0]
    surname_elem = Element('Surname', element_type=string_type)

    f = Element(name='Employee', element_type=complex_type)
    f.add_child(surname_elem)

    assert f.children == [name_elem, surname_elem]
Exemplo n.º 2
0
def test_element_get_child_by_name(complex_type, string_type):
    surname = Element('Surname', element_type=string_type)

    f = Element(name='Employee', element_type=complex_type)
    f.add_child(surname)

    assert f.get_child_by_name('Surname') == surname
    assert f.get_child_by_name('SurnameNotFound') is None