Skip to content

Commit 1d9e995

Browse files
committed
Релиз
1 parent 8708b83 commit 1d9e995

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

tests/test_inventory.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ def _normalize(value: str) -> str:
5656
)
5757

5858

59+
def _resolve_doc_path(document: str) -> Path:
60+
direct_path = DOCS_DIR / document
61+
if direct_path.exists():
62+
return direct_path
63+
64+
normalized_target = _normalize(document)
65+
for candidate in DOCS_DIR.iterdir():
66+
if _normalize(candidate.name) == normalized_target:
67+
return candidate
68+
69+
raise FileNotFoundError(f"Swagger document not found: {document}")
70+
71+
5972
def _read_inventory_rows() -> list[dict[str, str]]:
6073
in_table = False
6174
rows: list[dict[str, str]] = []
@@ -81,7 +94,7 @@ def _read_inventory_rows() -> list[dict[str, str]]:
8194
def _swagger_rows() -> list[dict[str, str]]:
8295
rows: list[dict[str, str]] = []
8396
for document in sorted(DOC_TO_PACKAGE):
84-
data = json.loads((DOCS_DIR / document).read_text(encoding="utf-8"))
97+
data = json.loads(_resolve_doc_path(document).read_text(encoding="utf-8"))
8598
for path, path_item in data.get("paths", {}).items():
8699
for method, operation in path_item.items():
87100
if method.lower() not in HTTP_METHODS:

0 commit comments

Comments
 (0)