def test_prefix_from_xpath(self): xpath = "parent/child/grandhild" prefix = get_prefix_from_xpath(xpath) self.assertEqual(prefix, 'parent/child/') xpath = "parent/child" prefix = get_prefix_from_xpath(xpath) self.assertEqual(prefix, 'parent/') xpath = "parent" prefix = get_prefix_from_xpath(xpath) self.assertTrue(prefix is None)