diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-10-31 22:39:44 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-10-31 22:39:44 +0600 |
commit | 578c074575f45ffdfd032d7b84f6fe449614f511 (patch) | |
tree | 009d49c675a8abc9b2b43ad6bb4a7081ad11b3e1 /test | |
parent | 8cdb5c845336ad3dc48c85a0558a38bd42972b00 (diff) |
[utils] Support list of xpath in xpath_element
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test_utils.py b/test/test_utils.py index 0c34f0e55..5a56ad776 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -275,9 +275,16 @@ class TestUtil(unittest.TestCase): p = xml.etree.ElementTree.SubElement(div, 'p') p.text = 'Foo' self.assertEqual(xpath_element(doc, 'div/p'), p) + self.assertEqual(xpath_element(doc, ['div/p']), p) + self.assertEqual(xpath_element(doc, ['div/bar', 'div/p']), p) self.assertEqual(xpath_element(doc, 'div/bar', default='default'), 'default') + self.assertEqual(xpath_element(doc, ['div/bar'], default='default'), 'default') self.assertTrue(xpath_element(doc, 'div/bar') is None) + self.assertTrue(xpath_element(doc, ['div/bar']) is None) + self.assertTrue(xpath_element(doc, ['div/bar'], 'div/baz') is None) self.assertRaises(ExtractorError, xpath_element, doc, 'div/bar', fatal=True) + self.assertRaises(ExtractorError, xpath_element, doc, ['div/bar'], fatal=True) + self.assertRaises(ExtractorError, xpath_element, doc, ['div/bar', 'div/baz'], fatal=True) def test_xpath_text(self): testxml = '''<root> |