def test_diff_element_str_with_diffs():
    element = DiffElement("interface", "eth0", {"device_name": "device1", "name": "eth0"})
    element.add_attrs(source={"interface_type": "ethernet", "description": "my interface"})
    assert element.str() == "interface: eth0 MISSING in dest"
    element.add_attrs(dest={"description": "your interface"})
    assert (
        element.str()
        == """\
interface: eth0
  description    source(my interface)    dest(your interface)\
"""
    )
def test_diff_element_str_with_no_diffs():
    element = DiffElement("interface", "eth0", {"device_name": "device1", "name": "eth0"})
    assert element.str() == "interface: eth0 (no diffs)"