'Test that prefixes passed to serialization are not modified.
This test makes sure that passing a dictionary of prefixes repeatedly
to C{toXml} of elements does not cause serialization errors. A
previous implementation changed the passed in dictionary internally,
causing havoc later on.'

def test_prefixesReuse(self):

    prefixes = {'testns': 'foo'}
    s = domish.SerializerClass(prefixes=prefixes)
    self.assertNotIdentical(prefixes, s.prefixes)
    e = domish.Element(('testns2', 'foo'), localPrefixes={'quux': 'testns2'})
    self.assertEqual("<quux:foo    xmlns:quux='testns2'/>", e.toXml(prefixes=prefixes))
    e = domish.Element(('testns2', 'foo'))
    self.assertEqual("<foo    xmlns='testns2'/>", e.toXml(prefixes=prefixes))
