def test_xpath_text(self):
    testxml = '<root>\n            <div>\n                <p>Foo</p>\n            </div>\n        </root>'
    doc = compat_etree_fromstring(testxml)
    self.assertEqual(xpath_text(doc, 'div/p'), 'Foo')
    self.assertEqual(xpath_text(doc, 'div/bar', default='default'), 'default')
    self.assertTrue((xpath_text(doc, 'div/bar') is None))
    self.assertRaises(ExtractorError, xpath_text, doc, 'div/bar', fatal=True)
def test_xpath_text(self):
    testxml = '<root>\n            <div>\n                <p>Foo</p>\n            </div>\n        </root>'
    doc = compat_etree_fromstring(testxml)
    self.assertEqual(xpath_text(doc, 'div/p'), 'Foo')
    self.assertEqual(xpath_text(doc, 'div/bar', default='default'), 'default')
    self.assertTrue((xpath_text(doc, 'div/bar') is None))
    self.assertRaises(ExtractorError, xpath_text, doc, 'div/bar', fatal=True)