19 lines
599 B
Python
19 lines
599 B
Python
from pathlib import Path
|
|
from pyucc.core import countings
|
|
|
|
|
|
def test_countings_analyze_file_and_paths(tmp_path):
|
|
f = tmp_path / 'a.txt'
|
|
f.write_text('1\n\n3\n')
|
|
res = countings.analyze_file_counts(f)
|
|
assert res['physical_lines'] == 3
|
|
assert res['blank_lines'] == 1
|
|
# pygount may classify .txt as 'Text only' with 0 code lines
|
|
# Just verify the structure is correct
|
|
assert 'code_lines' in res
|
|
assert 'file' in res
|
|
|
|
out = countings.analyze_paths([f, tmp_path / 'missing.txt'])
|
|
assert isinstance(out, list)
|
|
assert 'error' in out[1] or out[1].get('file')
|