完成初版
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import pytest
|
||||
from pathlib import Path
|
||||
from openpyxl import Workbook
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_excel_path() -> Path:
|
||||
"""返回根目录下的 sample.xlsx 路径"""
|
||||
path = Path(__file__).parent.parent / "sample.xlsx"
|
||||
if not path.exists():
|
||||
pytest.skip(f"测试文件 {path} 不存在")
|
||||
return path
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def invalid_excel_path(tmp_path: Path) -> Path:
|
||||
"""创建缺少 Scenario1 表的无效 Excel 文件"""
|
||||
wb = Workbook()
|
||||
wb.save(tmp_path / "invalid.xlsx")
|
||||
return tmp_path / "invalid.xlsx"
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_data_dict() -> dict:
|
||||
"""返回示例数据字典"""
|
||||
return {
|
||||
"Scenario1": {
|
||||
"headers": ["Column1", "Column2", "Column3"],
|
||||
"rows": [
|
||||
["Value1", "Value2", "Value3"],
|
||||
["Value4", "Value5", "Value6"]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def sample_sheets_dict() -> dict:
|
||||
"""返回示例工作表字典"""
|
||||
return {
|
||||
"Scenario1": {
|
||||
"A1": "Header1",
|
||||
"B1": "Header2",
|
||||
"A2": "Data1",
|
||||
"B2": "Data2"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user