summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2013-01-13 13:26:07 (GMT)
committerEli Bendersky <eliben@gmail.com>2013-01-13 13:26:07 (GMT)
commit25771b3749cac588ad2ecc8fc796a496d35769e5 (patch)
treea52dd4608188b760df8202c60501f51fa275bd4c /Lib
parenta9edb6c4d1daa0749547a115ee4b02cc5b8d8ecd (diff)
downloadcpython-25771b3749cac588ad2ecc8fc796a496d35769e5.zip
cpython-25771b3749cac588ad2ecc8fc796a496d35769e5.tar.gz
cpython-25771b3749cac588ad2ecc8fc796a496d35769e5.tar.bz2
Issue #16922: fixed findtext() to return empty Unicode string instead of empty bytes object when there's no text.
Patch by Serhiy Storchaka.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_xml_etree.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_xml_etree.py b/Lib/test/test_xml_etree.py
index 59a8508..b4edd74 100644
--- a/Lib/test/test_xml_etree.py
+++ b/Lib/test/test_xml_etree.py
@@ -1773,6 +1773,9 @@ class ElementFindTest(unittest.TestCase):
self.assertIsNone(e.findtext('tog'))
self.assertEqual(e.findtext('tog', 'default'), 'default')
+ # Issue #16922
+ self.assertEqual(ET.XML('<tag><empty /></tag>').findtext('empty'), '')
+
def test_findall(self):
e = ET.XML(SAMPLE_XML)
e[2] = ET.XML(SAMPLE_SECTION)