Human-AII / tests /test_code_analyzer.py
swayamshetkar
Backend with Llama auto-download, Dockerfile, deployment setup
5cb6ded
from ai.code_analyzer import analyze_code
def test_basic_analyze():
code = """
def foo_bar(x):
# simple comment
if x > 0:
return x
else:
return -x
"""
res = analyze_code(code)
assert 'indentation' in res
assert res['counts']['functions'] == 1
assert res['comments']['count'] >= 1
assert res['naming'] in ('snake_case', 'camelCase', 'unknown')