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

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

Issue 23670: Modifications to support iOS as a development platform
Patch Set: Created 3 years, 9 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_socketserver.py ('k') | Lib/test/test_subprocess.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 # -*- coding: koi8-r -*- 1 # -*- coding: koi8-r -*-
2 2
3 import unittest 3 import unittest
4 from test.support import TESTFN, unlink, unload, rmtree 4 from test.support import TESTFN, unlink, unload, rmtree
5 import importlib 5 import importlib
6 import os 6 import os
7 import sys 7 import sys
8 import subprocess 8 import subprocess
9 9
10 class SourceEncodingTest(unittest.TestCase): 10 class SourceEncodingTest(unittest.TestCase):
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 # Ensure that check_bom() restores all bytes in the right order if 52 # Ensure that check_bom() restores all bytes in the right order if
53 # check_bom() fails in pydebug mode: a buffer starts with the first 53 # check_bom() fails in pydebug mode: a buffer starts with the first
54 # byte of a valid BOM, but next bytes are different 54 # byte of a valid BOM, but next bytes are different
55 55
56 # one byte in common with the UTF-16-LE BOM 56 # one byte in common with the UTF-16-LE BOM
57 self.assertRaises(SyntaxError, eval, b'\xff\x20') 57 self.assertRaises(SyntaxError, eval, b'\xff\x20')
58 58
59 # two bytes in common with the UTF-8 BOM 59 # two bytes in common with the UTF-8 BOM
60 self.assertRaises(SyntaxError, eval, b'\xef\xbb\x20') 60 self.assertRaises(SyntaxError, eval, b'\xef\xbb\x20')
61 61
62 @unittest.skipUnless(hasattr(subprocess, 'Popen'), "test requires subprocess .Popen()")
62 def test_20731(self): 63 def test_20731(self):
63 sub = subprocess.Popen([sys.executable, 64 sub = subprocess.Popen([sys.executable,
64 os.path.join(os.path.dirname(__file__), 65 os.path.join(os.path.dirname(__file__),
65 'coding20731.py')], 66 'coding20731.py')],
66 stderr=subprocess.PIPE) 67 stderr=subprocess.PIPE)
67 err = sub.communicate()[1] 68 err = sub.communicate()[1]
68 self.assertEqual(sub.returncode, 0) 69 self.assertEqual(sub.returncode, 0)
69 self.assertNotIn(b'SyntaxError', err) 70 self.assertNotIn(b'SyntaxError', err)
70 71
71 def test_error_message(self): 72 def test_error_message(self):
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 with self.assertRaises(SyntaxError) as c: 138 with self.assertRaises(SyntaxError) as c:
138 compile(input, "<string>", "exec") 139 compile(input, "<string>", "exec")
139 expected = "'ascii' codec can't decode byte 0xe2 in position 16: " \ 140 expected = "'ascii' codec can't decode byte 0xe2 in position 16: " \
140 "ordinal not in range(128)" 141 "ordinal not in range(128)"
141 self.assertTrue(c.exception.args[0].startswith(expected), 142 self.assertTrue(c.exception.args[0].startswith(expected),
142 msg=c.exception.args[0]) 143 msg=c.exception.args[0])
143 144
144 145
145 if __name__ == "__main__": 146 if __name__ == "__main__":
146 unittest.main() 147 unittest.main()
OLDNEW
« no previous file with comments | « Lib/test/test_socketserver.py ('k') | Lib/test/test_subprocess.py » ('j') | no next file with comments »

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