Skip to content

Commit

Permalink
Add a proof of concept for issue #74
Browse files Browse the repository at this point in the history
  • Loading branch information
brunato committed Aug 20, 2024
1 parent abca165 commit ad6f556
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,26 @@ def test_issue_058(self):
else:
self.assertEqual(k, 2)

def test_issue_074(self):
root = lxml_etree.XML("<root><trunk><branch></branch></trunk></root>")

result = select(root, "trunk")
self.assertListEqual(result, [root[0]]) # [<Element trunk at 0x...>]

result = select(root, "/root/trunk")
self.assertListEqual(result, [root[0]]) # [<Element trunk at 0x...>]

root = lxml_etree.XML("<!--comment--><root><trunk><branch></branch></trunk></root>")

result = select(root, "trunk")
self.assertListEqual(result, [])

result = select(root, "root/trunk")
self.assertListEqual(result, [root[0]]) # [<Element trunk at 0x...>]

result = select(root, "/root/trunk")
self.assertListEqual(result, [root[0]]) # [<Element trunk at 0x...>]


if __name__ == '__main__':
unittest.main()

0 comments on commit ad6f556

Please sign in to comment.