summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2010-08-17 09:25:57 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2010-08-17 09:25:57 (GMT)
commit77203adb7e3c50775b768a846ebc03514e69be77 (patch)
treeb8dfdaf27afd5657999e2564628f207be3e0557b /Lib
parentfc8b205da23ca8df81fafc1035119d4bdde826e0 (diff)
downloadcpython-77203adb7e3c50775b768a846ebc03514e69be77.zip
cpython-77203adb7e3c50775b768a846ebc03514e69be77.tar.gz
cpython-77203adb7e3c50775b768a846ebc03514e69be77.tar.bz2
Ignore the exact ID value for the nested function in the dis.code_info tests
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_dis.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/Lib/test/test_dis.py b/Lib/test/test_dis.py
index 8f1783d..19493f8 100644
--- a/Lib/test/test_dis.py
+++ b/Lib/test/test_dis.py
@@ -259,7 +259,7 @@ Stack size: 7
Flags: OPTIMIZED, NEWLOCALS, VARARGS, VARKEYWORDS, GENERATOR
Constants:
0: None
- 1: <code object f at {1}, file "{0}", line {2}>
+ 1: <code object f at (.*), file "{0}", line {1}>
Variable names:
0: x
1: y
@@ -276,7 +276,6 @@ Cell variables:
3: y
4: x
5: z""".format(__file__,
- hex(id(co_tricky_nested_f)),
co_tricky_nested_f.co_firstlineno)
code_info_tricky_nested_f = """\
@@ -356,14 +355,14 @@ class CodeInfoTests(unittest.TestCase):
def test_code_info(self):
self.maxDiff = 1000
for x, expected in self.test_pairs:
- self.assertEqual(dis.code_info(x), expected)
+ self.assertRegexpMatches(dis.code_info(x), expected)
def test_show_code(self):
self.maxDiff = 1000
for x, expected in self.test_pairs:
with captured_stdout() as output:
dis.show_code(x)
- self.assertEqual(output.getvalue(), expected+"\n")
+ self.assertRegexpMatches(output.getvalue(), expected+"\n")
def test_main():
run_unittest(DisTests, CodeInfoTests)