Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(152915)

Side by Side Diff: Lib/test/test_quopri.py

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Lib/test/test_pty.py ('k') | Lib/test/test_select.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import unittest 1 import unittest
2 2
3 import sys, os, io, subprocess 3 import sys, os, io, subprocess
4 import quopri 4 import quopri
5 5
6 6
7 7
8 ENCSAMPLE = b"""\ 8 ENCSAMPLE = b"""\
9 Here's a bunch of special=20 9 Here's a bunch of special=20
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 @withpythonimplementation 173 @withpythonimplementation
174 def test_encode_header(self): 174 def test_encode_header(self):
175 for p, e in self.HSTRINGS: 175 for p, e in self.HSTRINGS:
176 self.assertEqual(quopri.encodestring(p, header=True), e) 176 self.assertEqual(quopri.encodestring(p, header=True), e)
177 177
178 @withpythonimplementation 178 @withpythonimplementation
179 def test_decode_header(self): 179 def test_decode_header(self):
180 for p, e in self.HSTRINGS: 180 for p, e in self.HSTRINGS:
181 self.assertEqual(quopri.decodestring(e, header=True), p) 181 self.assertEqual(quopri.decodestring(e, header=True), p)
182 182
183 @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess .Popen()")
183 def test_scriptencode(self): 184 def test_scriptencode(self):
184 (p, e) = self.STRINGS[-1] 185 (p, e) = self.STRINGS[-1]
185 process = subprocess.Popen([sys.executable, "-mquopri"], 186 process = subprocess.Popen([sys.executable, "-mquopri"],
186 stdin=subprocess.PIPE, stdout=subprocess.PIPE ) 187 stdin=subprocess.PIPE, stdout=subprocess.PIPE )
187 self.addCleanup(process.stdout.close) 188 self.addCleanup(process.stdout.close)
188 cout, cerr = process.communicate(p) 189 cout, cerr = process.communicate(p)
189 # On Windows, Python will output the result to stdout using 190 # On Windows, Python will output the result to stdout using
190 # CRLF, as the mode of stdout is text mode. To compare this 191 # CRLF, as the mode of stdout is text mode. To compare this
191 # with the expected result, we need to do a line-by-line comparison. 192 # with the expected result, we need to do a line-by-line comparison.
192 cout = cout.decode('latin-1').splitlines() 193 cout = cout.decode('latin-1').splitlines()
193 e = e.decode('latin-1').splitlines() 194 e = e.decode('latin-1').splitlines()
194 assert len(cout)==len(e) 195 assert len(cout)==len(e)
195 for i in range(len(cout)): 196 for i in range(len(cout)):
196 self.assertEqual(cout[i], e[i]) 197 self.assertEqual(cout[i], e[i])
197 self.assertEqual(cout, e) 198 self.assertEqual(cout, e)
198 199
200 @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess .Popen()")
199 def test_scriptdecode(self): 201 def test_scriptdecode(self):
200 (p, e) = self.STRINGS[-1] 202 (p, e) = self.STRINGS[-1]
201 process = subprocess.Popen([sys.executable, "-mquopri", "-d"], 203 process = subprocess.Popen([sys.executable, "-mquopri", "-d"],
202 stdin=subprocess.PIPE, stdout=subprocess.PIPE ) 204 stdin=subprocess.PIPE, stdout=subprocess.PIPE )
203 self.addCleanup(process.stdout.close) 205 self.addCleanup(process.stdout.close)
204 cout, cerr = process.communicate(e) 206 cout, cerr = process.communicate(e)
205 cout = cout.decode('latin-1') 207 cout = cout.decode('latin-1')
206 p = p.decode('latin-1') 208 p = p.decode('latin-1')
207 self.assertEqual(cout.splitlines(), p.splitlines()) 209 self.assertEqual(cout.splitlines(), p.splitlines())
208 210
209 if __name__ == "__main__": 211 if __name__ == "__main__":
210 unittest.main() 212 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_pty.py ('k') | Lib/test/test_select.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+