def _run_single(self, xml, obj): # Parse raw XML to an object result = tupleparse.parse_any(tupletree.xml_to_tupletree(xml)) # Assert XML parses to particular Python object self.assertEqual(obj, result, 'parsed XML: %s' % result)
def test(self, xml, obj): # Parse raw XML to an object result = parse_any(xml_to_tupletree(xml)) self.log('parsed XML: %s' % result) # Assert XML parses to particular Python object self.assert_equal(obj, result)
def _run_single(self, xml, obj): """ Parse the xml parameter to an object and compare it with the obj parameter """ # Parse raw XML to an object result = tupleparse.parse_any(tupletree.xml_to_tupletree_sax(xml)) # Assert XML parses to particular Python object self.assertEqual(obj, result, 'parsed XML: %s' % result)
def _run_single(self, obj): # Convert object to xml xml = obj.tocimxml().toxml() # Parse back to an object result = tupleparse.parse_any(tupletree.xml_to_tupletree(xml)) # Assert that the before and after objects should be equal self.assertEqual(obj, result, '\nbefore: %s\nafter: %s' %\ (xml, result.tocimxml().toxml()))
def test(self, obj): # Convert object to xml xml = obj.tocimxml().toxml() self.log('before: %s' % xml) # Parse back to an object result = parse_any(xml_to_tupletree(xml)) self.log('after: %s' % result.tocimxml().toxml()) # Assert that the before and after objects should be equal self.assert_equal(obj, result)
def _run_single(self, obj): """ Execute the test on a single object. This test converts the object to xml and then parses it. The result must be the same as the original object. """ # Convert object to xml xml = obj.tocimxml().toxml() # Parse back to an object result = tupleparse.parse_any(tupletree.xml_to_tupletree_sax(xml)) # Assert that the before and after objects should be equal self.assertEqual(obj, result, '\nbefore: %s\nafter: %s' % (xml, result.tocimxml().toxml()))