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

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

Issue 10639: reindent.py converts newlines to platform default
Patch Set: Created 8 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_descr.py ('k') | Lib/test/test_email/test_email.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 # Minimal tests for dis module 1 # Minimal tests for dis module
2 2
3 from test.support import run_unittest, captured_stdout 3 from test.support import run_unittest, captured_stdout
4 import difflib 4 import difflib
5 import unittest 5 import unittest
6 import sys 6 import sys
7 import dis 7 import dis
8 import io 8 import io
9 9
10 class _C: 10 class _C:
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 def do_disassembly_test(self, func, expected): 193 def do_disassembly_test(self, func, expected):
194 lines = self.get_disassembly(func) 194 lines = self.get_disassembly(func)
195 expected = expected.splitlines() 195 expected = expected.splitlines()
196 if expected != lines: 196 if expected != lines:
197 self.fail( 197 self.fail(
198 "events did not match expectation:\n" + 198 "events did not match expectation:\n" +
199 "\n".join(difflib.ndiff(expected, 199 "\n".join(difflib.ndiff(expected,
200 lines))) 200 lines)))
201 201
202 def test_opmap(self): 202 def test_opmap(self):
203 self.assertEqual(dis.opmap["NOP"], 9) 203 self.assertEqual(dis.opmap["STOP_CODE"], 0)
204 self.assertIn(dis.opmap["LOAD_CONST"], dis.hasconst) 204 self.assertIn(dis.opmap["LOAD_CONST"], dis.hasconst)
205 self.assertIn(dis.opmap["STORE_NAME"], dis.hasname) 205 self.assertIn(dis.opmap["STORE_NAME"], dis.hasname)
206 206
207 def test_opname(self): 207 def test_opname(self):
208 self.assertEqual(dis.opname[dis.opmap["LOAD_FAST"]], "LOAD_FAST") 208 self.assertEqual(dis.opname[dis.opmap["LOAD_FAST"]], "LOAD_FAST")
209 209
210 def test_boundaries(self): 210 def test_boundaries(self):
211 self.assertEqual(dis.opmap["EXTENDED_ARG"], dis.EXTENDED_ARG) 211 self.assertEqual(dis.opmap["EXTENDED_ARG"], dis.EXTENDED_ARG)
212 self.assertEqual(dis.opmap["STORE_NAME"], dis.HAVE_ARGUMENT) 212 self.assertEqual(dis.opmap["STORE_NAME"], dis.HAVE_ARGUMENT)
213 213
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 449
450 def test_pretty_flags_no_flags(self): 450 def test_pretty_flags_no_flags(self):
451 self.assertEqual(dis.pretty_flags(0), '0x0') 451 self.assertEqual(dis.pretty_flags(0), '0x0')
452 452
453 453
454 def test_main(): 454 def test_main():
455 run_unittest(DisTests, CodeInfoTests) 455 run_unittest(DisTests, CodeInfoTests)
456 456
457 if __name__ == "__main__": 457 if __name__ == "__main__":
458 test_main() 458 test_main()
OLDNEW
« no previous file with comments | « Lib/test/test_descr.py ('k') | Lib/test/test_email/test_email.py » ('j') | no next file with comments »

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