def test_match_bottom_two(self): # This should still match the bottom two nodes root_one = etree.fromstring("<root><first><second><third>Child Node</third></second></first></root>") root_two = etree.fromstring("<root><second><third>Child Node</third></second></root>") matches = match(root_one, root_two) self.assertEqual(2, len(matches))
def test_match_direct(self): # Direct match root_one = etree.fromstring("<root><first><second>Child Node</second></first></root>") root_two = etree.fromstring("<root><first><second>Child Node</second></first></root>") matches = match(root_one, root_two) self.assertEqual(3, len(matches))
def test_match_below_threshold(self): # Should won't meet the threshold root_one = etree.fromstring("<root><first><second>asdfghjkl</second></first></root>") root_two = etree.fromstring("<root><first><second>zxcvbnm</second></first></root>") matches = match(root_one, root_two) self.assertEqual(0, len(matches))
def test_match_nothing(self): root_one = etree.fromstring("<root><first><second>asdfghjkl</second></first></root>") root_two = etree.fromstring("<root><first><second><fourth>zxcvbnm</fourth></second></first></root>") matches = match(root_one, root_two) self.assertEqual(0, len(matches))