summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_quopri.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2005-12-15 20:17:20 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2005-12-15 20:17:20 (GMT)
commit3b287702dde0758a04d2ec2b93b641bf55a81c26 (patch)
tree14c72051c7c4ad78cd921a82533fa05cee6455f7 /Lib/test/test_quopri.py
parent9235ea4f26c883c37ea6d3655cb96848e25fd87d (diff)
downloadcpython-3b287702dde0758a04d2ec2b93b641bf55a81c26.zip
cpython-3b287702dde0758a04d2ec2b93b641bf55a81c26.tar.gz
cpython-3b287702dde0758a04d2ec2b93b641bf55a81c26.tar.bz2
Add two tests for the script interface.
Diffstat (limited to 'Lib/test/test_quopri.py')
-rw-r--r--Lib/test/test_quopri.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/Lib/test/test_quopri.py b/Lib/test/test_quopri.py
index dbda79d..50098cb 100644
--- a/Lib/test/test_quopri.py
+++ b/Lib/test/test_quopri.py
@@ -1,7 +1,7 @@
from test import test_support
import unittest
-from cStringIO import StringIO
+import sys, os, cStringIO
import quopri
@@ -145,16 +145,16 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''')
@withpythonimplementation
def test_encode(self):
for p, e in self.STRINGS:
- infp = StringIO(p)
- outfp = StringIO()
+ infp = cStringIO.StringIO(p)
+ outfp = cStringIO.StringIO()
quopri.encode(infp, outfp, quotetabs=False)
self.assert_(outfp.getvalue() == e)
@withpythonimplementation
def test_decode(self):
for p, e in self.STRINGS:
- infp = StringIO(e)
- outfp = StringIO()
+ infp = cStringIO.StringIO(e)
+ outfp = cStringIO.StringIO()
quopri.decode(infp, outfp)
self.assert_(outfp.getvalue() == p)
@@ -174,6 +174,20 @@ zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz''')
for p, e in self.HSTRINGS:
self.assert_(quopri.decodestring(e, header=True) == p)
+ def test_scriptencode(self):
+ (p, e) = self.STRINGS[-1]
+ (cin, cout) = os.popen2("%s -mquopri" % sys.executable)
+ cin.write(p)
+ cin.close()
+ self.assert_(cout.read() == e)
+
+ def test_scriptdecode(self):
+ (p, e) = self.STRINGS[-1]
+ (cin, cout) = os.popen2("%s -mquopri -d" % sys.executable)
+ cin.write(e)
+ cin.close()
+ self.assert_(cout.read() == p)
+
def test_main():
test_support.run_unittest(QuopriTestCase)