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

Side by Side Diff: Lib/importlib/test/source/test_file_loader.py

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 years, 10 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/idlelib/PyShell.py ('k') | Lib/inspect.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 importlib 1 import importlib
2 from importlib import _bootstrap 2 from importlib import _bootstrap
3 from .. import abc 3 from .. import abc
4 from .. import util 4 from .. import util
5 from . import util as source_util 5 from . import util as source_util
6 6
7 import imp 7 import imp
8 import marshal 8 import marshal
9 import os 9 import os
10 import py_compile 10 import py_compile
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 file_path = mapping['_temp'] if not del_source else bytecode_path 207 file_path = mapping['_temp'] if not del_source else bytecode_path
208 with self.assertRaises(ImportError): 208 with self.assertRaises(ImportError):
209 self.import_(file_path, '_temp') 209 self.import_(file_path, '_temp')
210 210
211 def _test_bad_marshal(self, *, del_source=False): 211 def _test_bad_marshal(self, *, del_source=False):
212 with source_util.create_modules('_temp') as mapping: 212 with source_util.create_modules('_temp') as mapping:
213 bytecode_path = self.manipulate_bytecode('_temp', mapping, 213 bytecode_path = self.manipulate_bytecode('_temp', mapping,
214 lambda bc: bc[:8] + b'<test>', 214 lambda bc: bc[:8] + b'<test>',
215 del_source=del_source) 215 del_source=del_source)
216 file_path = mapping['_temp'] if not del_source else bytecode_path 216 file_path = mapping['_temp'] if not del_source else bytecode_path
217 with self.assertRaises(EOFError): 217 with self.assertRaises(ValueError):
218 self.import_(file_path, '_temp') 218 self.import_(file_path, '_temp')
219 219
220 def _test_bad_magic(self, test, *, del_source=False): 220 def _test_bad_magic(self, test, *, del_source=False):
221 with source_util.create_modules('_temp') as mapping: 221 with source_util.create_modules('_temp') as mapping:
222 bc_path = self.manipulate_bytecode('_temp', mapping, 222 bc_path = self.manipulate_bytecode('_temp', mapping,
223 lambda bc: b'\x00\x00\x00\x00' + bc[4:]) 223 lambda bc: b'\x00\x00\x00\x00' + bc[4:])
224 test('_temp', mapping, bc_path) 224 test('_temp', mapping, bc_path)
225 225
226 226
227 class SourceLoaderBadBytecodeTest(BadBytecodeTest): 227 class SourceLoaderBadBytecodeTest(BadBytecodeTest):
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 def test_main(): 381 def test_main():
382 from test.support import run_unittest 382 from test.support import run_unittest
383 run_unittest(SimpleTest, 383 run_unittest(SimpleTest,
384 SourceLoaderBadBytecodeTest, 384 SourceLoaderBadBytecodeTest,
385 SourcelessLoaderBadBytecodeTest 385 SourcelessLoaderBadBytecodeTest
386 ) 386 )
387 387
388 388
389 if __name__ == '__main__': 389 if __name__ == '__main__':
390 test_main() 390 test_main()
OLDNEW
« no previous file with comments | « Lib/idlelib/PyShell.py ('k') | Lib/inspect.py » ('j') | no next file with comments »

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