mirror of
https://github.com/python/cpython.git
synced 2025-09-18 14:40:43 +00:00
Merge 3.1
This commit is contained in:
commit
b43dd4b8ca
1 changed files with 6 additions and 7 deletions
|
@ -514,13 +514,11 @@ class UTF16Test(ReadTest):
|
||||||
s1 = 'Hello\r\nworld\r\n'
|
s1 = 'Hello\r\nworld\r\n'
|
||||||
|
|
||||||
s = s1.encode(self.encoding)
|
s = s1.encode(self.encoding)
|
||||||
try:
|
self.addCleanup(support.unlink, support.TESTFN)
|
||||||
with open(support.TESTFN, 'wb') as fp:
|
with open(support.TESTFN, 'wb') as fp:
|
||||||
fp.write(s)
|
fp.write(s)
|
||||||
with codecs.open(support.TESTFN, 'U', encoding=self.encoding) as reader:
|
with codecs.open(support.TESTFN, 'U', encoding=self.encoding) as reader:
|
||||||
self.assertEqual(reader.read(), s1)
|
self.assertEqual(reader.read(), s1)
|
||||||
finally:
|
|
||||||
support.unlink(support.TESTFN)
|
|
||||||
|
|
||||||
class UTF16LETest(ReadTest):
|
class UTF16LETest(ReadTest):
|
||||||
encoding = "utf-16-le"
|
encoding = "utf-16-le"
|
||||||
|
@ -1624,6 +1622,7 @@ class BomTest(unittest.TestCase):
|
||||||
"utf-32",
|
"utf-32",
|
||||||
"utf-32-le",
|
"utf-32-le",
|
||||||
"utf-32-be")
|
"utf-32-be")
|
||||||
|
self.addCleanup(support.unlink, support.TESTFN)
|
||||||
for encoding in tests:
|
for encoding in tests:
|
||||||
# Check if the BOM is written only once
|
# Check if the BOM is written only once
|
||||||
with codecs.open(support.TESTFN, 'w+', encoding=encoding) as f:
|
with codecs.open(support.TESTFN, 'w+', encoding=encoding) as f:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue