test: 覆盖率提升至 100%(fail_under 90→99,13 个防御/边界用例)
This commit is contained in:
@@ -49,4 +49,20 @@ def test_extract_table_uses_enum_value():
|
||||
def test_forward_fill_ignores_invalid_range():
|
||||
matrix = [["A"], ["B"]]
|
||||
assert forward_fill(matrix, [(0, 1, 2, 1)]) == matrix # min_row=0 非法 → 不崩溃不改数据
|
||||
assert forward_fill(matrix, [(9, 9, 9, 9)]) == matrix # 越界 → 不崩溃
|
||||
assert forward_fill(matrix, [(9, 9, 9, 9)]) == matrix # 越界 → 不崩溃
|
||||
|
||||
|
||||
def test_extract_table_empty_matrix():
|
||||
# 空矩阵 → 返回空表(headers/rows 均为空),不崩溃(L 空矩阵分支)
|
||||
table = extract_table("空シート", [], "f.xlsx", SheetType.FUNCTION)
|
||||
assert table.headers == []
|
||||
assert table.rows == []
|
||||
|
||||
|
||||
def test_extract_table_header_row_out_of_range():
|
||||
# header_row 越界/负值 → 回落 0(防御分支)
|
||||
mat = [["ID", "名前"], ["1", "田中"]]
|
||||
t_high = extract_table("社員", mat, "f.xlsx", SheetType.FUNCTION, header_row=9)
|
||||
t_neg = extract_table("社員", mat, "f.xlsx", SheetType.FUNCTION, header_row=-1)
|
||||
assert t_high.headers == ["ID", "名前"]
|
||||
assert t_neg.headers == ["ID", "名前"]
|
||||
Reference in New Issue
Block a user