Preserve the invariant tostring(elem) == b''.join(tostringlist(elem)) and add a test to make sure it keeps working

This commit is contained in:
Eli Bendersky 2012-07-17 05:45:11 +03:00
parent daa4c6b2e6
commit 426e248feb
2 changed files with 15 additions and 0 deletions

View file

@ -1190,9 +1190,15 @@ class DataStream(io.BufferedIOBase):
def writable(self):
return True
def seekable(self):
return True
def write(self, b):
data.append(b)
def tell(self):
return len(data)
ElementTree(element).write(DataStream(), encoding, method=method)
return data