Skip to content

Commit 7ef11b0

Browse files
committed
add assertions about v4 test vectors
1 parent b6cf6d8 commit 7ef11b0

2 files changed

Lines changed: 20 additions & 3 deletions

File tree

tests/conftest.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
import pytest
77

88

9+
@pytest.fixture
10+
def get_all_test_vectors() -> dict:
11+
"""Return all used test vectors."""
12+
return {
13+
"v2": get_test_vector("v2"),
14+
"v4": get_test_vector("v4"),
15+
}
16+
17+
918
@pytest.fixture
1019
def get_test_vectors_v2() -> dict:
1120
"""Return spec for v2 test vectors."""

tests/protocol/test_test_vectors.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,25 @@
44

55

66
@pytest.mark.parametrize(
7-
"test_name_startswith,expected_count", [("", 12), ("2-E-", 9), ("2-S-", 3)]
7+
"version,test_name_startswith,expected_count",
8+
[
9+
("v2", "", 12),
10+
("v2", "2-E-", 9),
11+
("v2", "2-S-", 3),
12+
("v4", "", 12),
13+
("v4", "4-E-", 9),
14+
("v4", "4-S-", 3),
15+
],
816
)
917
def test_expected_number_of_test_vectors(
10-
get_test_vectors_v2, test_name_startswith: str, expected_count: int
18+
get_all_test_vectors, version: str, test_name_startswith: str, expected_count: int
1119
):
1220
"""Test that official test vector specification matches expectations."""
1321

1422
assert (
1523
sum(
1624
1
17-
for test_case in get_test_vectors_v2["tests"]
25+
for test_case in get_all_test_vectors[version]["tests"]
1826
if test_case["name"].startswith(test_name_startswith)
1927
)
2028
== expected_count

0 commit comments

Comments
 (0)