mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Merge.
This commit is contained in:
commit
850800f15e
1 changed files with 6 additions and 5 deletions
|
@ -578,13 +578,14 @@ class StreamReaderWriterXmlgenTest(XmlgenTest, unittest.TestCase):
|
||||||
writer.close()
|
writer.close()
|
||||||
support.unlink(self.fname)
|
support.unlink(self.fname)
|
||||||
self.addCleanup(cleanup)
|
self.addCleanup(cleanup)
|
||||||
writer.getvalue = self.getvalue
|
def getvalue():
|
||||||
|
# Windows will not let use reopen without first closing
|
||||||
|
writer.close()
|
||||||
|
with open(writer.name, 'rb') as f:
|
||||||
|
return f.read()
|
||||||
|
writer.getvalue = getvalue
|
||||||
return writer
|
return writer
|
||||||
|
|
||||||
def getvalue(self):
|
|
||||||
with open(self.fname, 'rb') as f:
|
|
||||||
return f.read()
|
|
||||||
|
|
||||||
def xml(self, doc, encoding='iso-8859-1'):
|
def xml(self, doc, encoding='iso-8859-1'):
|
||||||
return ('<?xml version="1.0" encoding="%s"?>\n%s' %
|
return ('<?xml version="1.0" encoding="%s"?>\n%s' %
|
||||||
(encoding, doc)).encode('ascii', 'xmlcharrefreplace')
|
(encoding, doc)).encode('ascii', 'xmlcharrefreplace')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue