Skip to content

Commit 3b04e71

Browse files
committed
fix tests
1 parent 3fa963b commit 3b04e71

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Lib/test/test_code.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
freevars: ()
1818
nlocals: 2
1919
flags: 3
20-
consts: ('None', '<code object g>')
20+
consts: ('<code object g>',)
2121
2222
>>> dump(f(4).__code__)
2323
name: g
@@ -86,7 +86,7 @@
8686
cellvars: ()
8787
freevars: ()
8888
nlocals: 0
89-
flags: 3
89+
flags: 67108867
9090
consts: ("'doc string'", 'None')
9191
9292
>>> def keywordonly_args(a,b,*,k1):

Lib/test/test_compile.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ def f():
834834
return "unused"
835835

836836
self.assertEqual(f.__code__.co_consts,
837-
(None, "used"))
837+
(True, "used"))
838838

839839
@support.cpython_only
840840
def test_remove_unused_consts_extended_args(self):
@@ -852,7 +852,7 @@ def test_remove_unused_consts_extended_args(self):
852852
eval(compile(code, "file.py", "exec"), g)
853853
exec(code, g)
854854
f = g['f']
855-
expected = tuple([None, ''] + [f't{i}' for i in range(N)])
855+
expected = tuple(['', 1] + [f't{i}' for i in range(N)])
856856
self.assertEqual(f.__code__.co_consts, expected)
857857
expected = "".join(expected[2:])
858858
self.assertEqual(expected, f())
@@ -1244,7 +1244,7 @@ def return_genexp():
12441244
y)
12451245
genexp_lines = [0, 4, 2, 0, 4]
12461246

1247-
genexp_code = return_genexp.__code__.co_consts[1]
1247+
genexp_code = return_genexp.__code__.co_consts[0]
12481248
code_lines = self.get_code_lines(genexp_code)
12491249
self.assertEqual(genexp_lines, code_lines)
12501250

Lib/test/test_compiler_assemble.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def inner():
8484
return x
8585
return inner() % 2
8686

87-
inner_code = mod_two.__code__.co_consts[1]
87+
inner_code = mod_two.__code__.co_consts[0]
8888
assert isinstance(inner_code, types.CodeType)
8989

9090
metadata = {

0 commit comments

Comments
 (0)