Spaces:
Sleeping
Sleeping
| 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') | |