mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Preserve the invariant tostring(elem) == b''.join(tostringlist(elem)) and add a test to make sure it keeps working
This commit is contained in:
parent
daa4c6b2e6
commit
426e248feb
2 changed files with 15 additions and 0 deletions
|
|
@ -2286,6 +2286,15 @@ class IOTest(unittest.TestCase):
|
|||
'''<?xml version='1.0' encoding='utf-16'?>\n'''
|
||||
'''<site />'''.encode("utf-16"))
|
||||
|
||||
def test_tostringlist_invariant(self):
|
||||
root = ET.fromstring('<tag>foo</tag>')
|
||||
self.assertEqual(
|
||||
ET.tostring(root, 'unicode'),
|
||||
''.join(ET.tostringlist(root, 'unicode')))
|
||||
self.assertEqual(
|
||||
ET.tostring(root, 'utf-16'),
|
||||
b''.join(ET.tostringlist(root, 'utf-16')))
|
||||
|
||||
|
||||
class ParseErrorTest(unittest.TestCase):
|
||||
def test_subclass(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue