Commit 3fa5e6ee authored by Andrew M. Kuchling's avatar Andrew M. Kuchling

[Bug #776202] Apply Walter Doerwald's patch to use text mode for encoded files

parent 9ef0ef5b
...@@ -114,11 +114,11 @@ class UUFileTest(unittest.TestCase): ...@@ -114,11 +114,11 @@ class UUFileTest(unittest.TestCase):
def test_encode(self): def test_encode(self):
try: try:
fin = open(self.tmpin, 'wb') fin = open(self.tmpin, 'w')
fin.write(plaintext) fin.write(plaintext)
fin.close() fin.close()
fin = open(self.tmpin, 'rb') fin = open(self.tmpin, 'r')
fout = open(self.tmpout, 'w') fout = open(self.tmpout, 'w')
uu.encode(fin, fout, self.tmpin, mode=0644) uu.encode(fin, fout, self.tmpin, mode=0644)
fin.close() fin.close()
...@@ -130,7 +130,7 @@ class UUFileTest(unittest.TestCase): ...@@ -130,7 +130,7 @@ class UUFileTest(unittest.TestCase):
self.assertEqual(s, encodedtextwrapped % (0644, self.tmpin)) self.assertEqual(s, encodedtextwrapped % (0644, self.tmpin))
# in_file and out_file as filenames # in_file and out_file as filenames
uu.encode(self.tmpin, self.tmpout, mode=0644) uu.encode(self.tmpin, self.tmpout, self.tmpin, mode=0644)
fout = open(self.tmpout, 'r') fout = open(self.tmpout, 'r')
s = fout.read() s = fout.read()
fout.close() fout.close()
...@@ -142,11 +142,11 @@ class UUFileTest(unittest.TestCase): ...@@ -142,11 +142,11 @@ class UUFileTest(unittest.TestCase):
def test_decode(self): def test_decode(self):
try: try:
f = open(self.tmpin, 'wb') f = open(self.tmpin, 'w')
f.write(encodedtextwrapped % (0644, self.tmpout)) f.write(encodedtextwrapped % (0644, self.tmpout))
f.close() f.close()
f = open(self.tmpin, 'rb') f = open(self.tmpin, 'r')
uu.decode(f) uu.decode(f)
f.close() f.close()
...@@ -163,11 +163,11 @@ class UUFileTest(unittest.TestCase): ...@@ -163,11 +163,11 @@ class UUFileTest(unittest.TestCase):
try: try:
f = cStringIO.StringIO(encodedtextwrapped % (0644, self.tmpout)) f = cStringIO.StringIO(encodedtextwrapped % (0644, self.tmpout))
f = open(self.tmpin, 'rb') f = open(self.tmpin, 'r')
uu.decode(f) uu.decode(f)
f.close() f.close()
f = open(self.tmpin, 'rb') f = open(self.tmpin, 'r')
self.assertRaises(uu.Error, uu.decode, f) self.assertRaises(uu.Error, uu.decode, f)
f.close() f.close()
finally: finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment