1
1
from test import test_support
2
2
import unittest
3
3
4
- from cStringIO import StringIO
4
+ import sys , os , cStringIO
5
5
import quopri
6
6
7
7
@@ -145,16 +145,16 @@ def test_idempotent_string(self):
145
145
@withpythonimplementation
146
146
def test_encode (self ):
147
147
for p , e in self .STRINGS :
148
- infp = StringIO (p )
149
- outfp = StringIO ()
148
+ infp = cStringIO . StringIO (p )
149
+ outfp = cStringIO . StringIO ()
150
150
quopri .encode (infp , outfp , quotetabs = False )
151
151
self .assert_ (outfp .getvalue () == e )
152
152
153
153
@withpythonimplementation
154
154
def test_decode (self ):
155
155
for p , e in self .STRINGS :
156
- infp = StringIO (e )
157
- outfp = StringIO ()
156
+ infp = cStringIO . StringIO (e )
157
+ outfp = cStringIO . StringIO ()
158
158
quopri .decode (infp , outfp )
159
159
self .assert_ (outfp .getvalue () == p )
160
160
@@ -174,6 +174,20 @@ def test_decode_header(self):
174
174
for p , e in self .HSTRINGS :
175
175
self .assert_ (quopri .decodestring (e , header = True ) == p )
176
176
177
+ def test_scriptencode (self ):
178
+ (p , e ) = self .STRINGS [- 1 ]
179
+ (cin , cout ) = os .popen2 ("%s -mquopri" % sys .executable )
180
+ cin .write (p )
181
+ cin .close ()
182
+ self .assert_ (cout .read () == e )
183
+
184
+ def test_scriptdecode (self ):
185
+ (p , e ) = self .STRINGS [- 1 ]
186
+ (cin , cout ) = os .popen2 ("%s -mquopri -d" % sys .executable )
187
+ cin .write (e )
188
+ cin .close ()
189
+ self .assert_ (cout .read () == p )
190
+
177
191
def test_main ():
178
192
test_support .run_unittest (QuopriTestCase )
179
193
0 commit comments