feat(deps): Update requirements.txt with tree-sitter dependencies

This commit is contained in:
2026-02-26 19:29:22 -05:00
parent 659f0c91f3
commit 8fb75cc7e2
2 changed files with 222 additions and 1 deletions

View File

@@ -0,0 +1,30 @@
import tree_sitter_python as tspython
from tree_sitter import Language, Parser
def test_tree_sitter_python_setup():
"""
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"