def test_compare_attr_inequality(self): # Attribute inequality, should be quite a bit less than above root_one = etree.fromstring('<foo one="two" two="one">woot</foo>') root_two = etree.fromstring('<foo two="three" one="two">woohoot</foo>') self.assertEqual(compare(root_one, root_two), 1.1515151515151516)
def test_compare_mostly(self): # Mostly matching root_one = etree.fromstring('<foo>woot</foo>') root_two = etree.fromstring('<foo>woohoot</foo>') self.assertEqual(compare(root_one, root_two), 1.8181818181818183)
def test_compare_attr(self): # Attributes match, text mostly matches. Should be the same as # above. root_one = etree.fromstring('<foo one="two" two="one">woot</foo>') root_two = etree.fromstring('<foo two="one" one="two">woohoot</foo>') self.assertEqual(compare(root_one, root_two), 1.8181818181818183)
def test_compare(self): # Straight compare root_one = etree.fromstring('<foo>woot</foo>') root_two = etree.fromstring('<foo>woot</foo>') self.assertEqual(compare(root_one, root_two), 2)