File tree Expand file tree Collapse file tree
tests/functional/e2e/testcases Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import json
22from pathlib import Path
3- from typing import cast
3+ from typing import TypedDict , cast
44
55# Path to the shared testcases directory in athena-protobufs
66_REPO_ROOT = Path (__file__ ).parent .parent .parent .parent .parent
77TESTCASES_DIR = _REPO_ROOT / "athena-protobufs" / "testcases"
88
99
10+ class TestCases (TypedDict ):
11+ classification_labels : list [str ]
12+ images : list [list [str | list [float ]]]
13+
14+
1015class AthenaTestCase :
1116 def __init__ (
1217 self ,
@@ -28,13 +33,9 @@ def load_test_cases(dirname: str = "benign_model") -> list[AthenaTestCase]:
2833 with Path .open (
2934 Path (TESTCASES_DIR / dirname / "expected_outputs.json" ),
3035 ) as f :
31- test_cases = cast (
32- "dict[str, list[str] | list[list[str | list[float]]]]" , json .load (f )
33- )
34- classification_labels = cast (
35- "list[str]" , test_cases ["classification_labels" ]
36- )
37- images = cast ("list[list[str | list[float]]]" , test_cases ["images" ])
36+ test_cases : TestCases = cast ("TestCases" , json .load (f ))
37+ classification_labels = test_cases ["classification_labels" ]
38+ images = test_cases ["images" ]
3839 return [
3940 AthenaTestCase (
4041 str (
You can’t perform that action at this time.
0 commit comments