Applied 236 return type annotations to functions with no return values across 100+ files (core modules, tests, scripts, simulations). Added Phase 4 to python_style_refactor track for remaining 597 items (untyped params, vars, and functions with return values). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26 lines
860 B
Python
26 lines
860 B
Python
import tree_sitter_python as tspython
|
|
from tree_sitter import Language, Parser
|
|
|
|
def test_tree_sitter_python_setup() -> None:
|
|
"""
|
|
Verifies that tree-sitter and tree-sitter-python are correctly installed
|
|
and can parse a simple Python function string.
|
|
"""
|
|
# Initialize the Python language and parser
|
|
PY_LANGUAGE = Language(tspython.language())
|
|
parser = Parser(PY_LANGUAGE)
|
|
# Simple Python code to parse
|
|
code = """def hello():
|
|
print('world')"""
|
|
# Parse the code
|
|
tree = parser.parse(bytes(code, "utf8"))
|
|
# Assert that the root node is a 'module'
|
|
assert tree.root_node.type == "module"
|
|
# Verify we can find a function definition
|
|
found_function = False
|
|
for child in tree.root_node.children:
|
|
if child.type == "function_definition":
|
|
found_function = True
|
|
break
|
|
assert found_function, "Should have found a function_definition node"
|