Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_loads_xml_no_key():
with pytest.raises(ValueError) as excinfo:
loads_xml('value')
assert ' is missing "key" attribute' in str(excinfo.value)
def test_loads_xml_bad_root():
with pytest.raises(ValueError) as excinfo:
loads_xml('value')
assert 'not rooted at ' in str(excinfo.value)
def test_loads_xml(s,d):
assert loads_xml(s) == d
def test_loads_xml_multiple_ordereddict():
assert loads_xml('''
value
bar
''', object_pairs_hook=OrderedDict) == \
OrderedDict([("key", "value"), ("foo", "bar")])
def test_loads_xml_multiple_ordereddict_rev():
assert loads_xml('''
bar
value
''', object_pairs_hook=OrderedDict) == \
OrderedDict([("foo", "bar"), ("key", "value")])