Skip to content

Commit 85c16fd

Browse files
committed
fix test_code
1 parent b748093 commit 85c16fd

File tree

1 file changed

+9
-21
lines changed
  • graalpython/com.oracle.graal.python.test/src/tests

1 file changed

+9
-21
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_code.py

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ def test_code_attributes():
9393
assert code.co_flags & (1 << 5)
9494
assert not code.co_flags & (1 << 2)
9595
assert not code.co_flags & (1 << 3)
96-
if sys.implementation.name == 'graalpython':
97-
assert code.co_code.decode().strip() == wrapper().__truffle_source__.strip()
98-
# assert code.co_consts
96+
assert {'set()', 'expected TypeError'}.issubset(code.co_consts)
9997
# assert set(code.co_names) == {'set', 'TypeError', 'print'}
10098
assert set(code.co_varnames) == {'arg_l', 'kwarg_case', 'kwarg_other', 'loc_1', 'loc_3', 'inner_func'}
10199
assert code.co_filename.endswith("test_code.py")
@@ -155,9 +153,7 @@ def test_module_code():
155153
assert code.co_nlocals == 0
156154
# assert code.co_stacksize == 0
157155
# assert code.co_flags == 0
158-
if sys.implementation.name == 'graalpython':
159-
assert code.co_code.decode().strip() == source.strip()
160-
# assert code.co_consts == tuple()
156+
assert {'PACKAGE DOC', 'after importing moduleY'}.issubset(set(code.co_consts))
161157
# assert set(code.co_names) == set()
162158
assert set(code.co_varnames) == set()
163159
assert code.co_filename.endswith("__init__.py")
@@ -169,18 +165,10 @@ def test_module_code():
169165
assert code.co_cellvars == tuple()
170166

171167

172-
def test_get_globals():
173-
import sys
174-
code = wrapper.__code__
175-
if sys.implementation.name == 'graalpython':
176-
from __graalpython__ import current_global_code_variables
177-
assert set(current_global_code_variables(code)) == {'a_global'}
178-
179-
180-
def test_codestring():
181-
def foo():
182-
pass
183-
184-
ct = type(foo.__code__)
185-
del foo
186-
ct(2, 0, 0, 128, 0, b"lambda a,b: a+b", tuple(), ("a", "b"), tuple(), "hello.py", "<lambda>", 0, b"", tuple(), tuple())
168+
# def test_codestring():
169+
# def foo():
170+
# pass
171+
#
172+
# ct = type(foo.__code__)
173+
# del foo
174+
# ct(2, 0, 0, 128, 0, b"lambda a,b: a+b", tuple(), ("a", "b"), tuple(), "hello.py", "<lambda>", 0, b"", tuple(), tuple())

0 commit comments

Comments
 (0)