def test_badobj_baddictreptag(self): for d in [{'':1}, {' ':1}, {'xml':1}, {123:1}, {'123':1}]: try: res = xmlser.serialize('<root<.0*?&.1>>', d) except xmlser.exc.SerializationFormatError: self.fail("Serializing object with valid format string produced SerializationFormatError") except ValueError: pass else: self.fail("Serializing object to bad XML %r did not raise an exception" % res)
def test_badobj_badtag(self): for s in ['', ' ', 'xml', 123, '123']: try: res = xmlser.serialize('<root<?>>', s) except xmlser.exc.SerializationFormatError: self.fail("Serializing object with valid format string produced SerializationFormatError") except ValueError: pass else: self.fail("Serializing object to bad XML %r did not raise an exception" % res)