Spaces:
Sleeping
Sleeping
File size: 414 Bytes
5cb6ded |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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')
|