summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2003-03-07 15:55:36 (GMT)
committerTim Peters <tim.peters@gmail.com>2003-03-07 15:55:36 (GMT)
commiteabafebfbcf645a48990e89d7fbe3fbdfad7c4c1 (patch)
tree6652881971530dbdb01a28bd20591dc87779416a /Lib/test
parent959c7727f4e9be7dabd2bff2a3cd1917c75f5fe1 (diff)
downloadcpython-eabafebfbcf645a48990e89d7fbe3fbdfad7c4c1.zip
cpython-eabafebfbcf645a48990e89d7fbe3fbdfad7c4c1.tar.gz
cpython-eabafebfbcf645a48990e89d7fbe3fbdfad7c4c1.tar.bz2
This test relied on significant trailing whitespace in a string literal.
Evil.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_dis.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index 78ff1c2..ab93d4a 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -10,18 +10,18 @@ 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)
- 3 PRINT_ITEM
- 4 PRINT_NEWLINE
+ 3 PRINT_ITEM
+ 4 PRINT_NEWLINE
14 5 LOAD_CONST 1 (1)
- 8 RETURN_VALUE
+ 8 RETURN_VALUE
9 LOAD_CONST 0 (None)
- 12 RETURN_VALUE
+ 12 RETURN_VALUE
"""
class DisTests(unittest.TestCase):
@@ -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)