Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase test coverage #2818

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix merge issue
  • Loading branch information
ericvergnaud committed Oct 3, 2024
commit 9ddfcf66fee1e76da82d86a189f3967247adb47b
29 changes: 0 additions & 29 deletions tests/unit/source_code/python/test_python_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,35 +235,6 @@ def test_counts_lines(source: str, line_count: int):
assert tree.line_count() == line_count


@pytest.mark.parametrize(
"source, name, is_builtin",
[
("x = open()", "open", True),
("import datetime; x = datetime.datetime.now()", "now", True),
("import stuff; x = stuff()", "stuff", False),
(
"""def stuff():
pass
x = stuff()""",
"stuff",
False,
),
],
)
def test_is_builtin(source, name, is_builtin):
tree = Tree.normalize_and_parse(source)
nodes = list(tree.node.get_children())
for node in nodes:
if isinstance(node, Assign):
call = node.value
assert isinstance(call, Call)
func_name = TreeHelper.get_call_name(call)
assert func_name == name
assert Tree(call).is_builtin() == is_builtin
return
assert False # could not locate call


def test_first_statement_is_none():
node = Const("xyz")
assert not Tree(node).first_statement()
Expand Down