This test relied on significant trailing whitespace in a string literal.

Evil.
This commit is contained in:
Tim Peters 2003-03-07 15:55:36 +00:00
parent 959c7727f4
commit eabafebfbc
1 changed files with 12 additions and 7 deletions

View File

@ -10,8 +10,8 @@ import unittest
# placement is crucial!!! move the start of _f and you have to adjust the
# line numbers in dis_f
def _f(a):
print a
return 1
print a
return 1
dis_f = """\
13 0 LOAD_FAST 0 (a)
@ -43,7 +43,12 @@ class DisTests(unittest.TestCase):
sys.stdout = s
dis.dis(_f)
sys.stdout = save_stdout
self.assertEqual(dis_f, s.getvalue())
got = s.getvalue()
# Trim trailing blanks (if any).
lines = got.split('\n')
lines = [line.rstrip() for line in lines]
got = '\n'.join(lines)
self.assertEqual(dis_f, got)
def test_main():
run_unittest(DisTests)