Skip to content

Commit

Permalink
Type the parse_probe_asn function in utils correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
hynnot committed Jan 22, 2025
1 parent 9d0c56f commit 7167486
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def test_name_to_group(tn):
return ""


def parse_probe_asn(probe_asn):
def parse_probe_asn(probe_asn: Union[str, int]) -> int:
if probe_asn.startswith("AS"):
probe_asn = probe_asn[2:]
if isinstance(probe_asn, str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def test_oonidata_aggregation_observations_with_since_and_until(client, params_s
[
("probe_cc", "IT"),
("probe_asn", 45758),
("probe_asn", [45758, 5650]),
("test_name", "whatsapp"),
("hostname", "www.on-instant.com"),
("ip", "64.233.190.139"),
Expand All @@ -43,7 +44,10 @@ def test_oonidata_aggregation_observations_with_filters(client, filter_name, fil
assert isinstance(json["results"], list), json
assert len(json["results"]) > 0
for result in json["results"]:
assert result[filter_name] == filter_value, result
if isinstance(filter_value, list):
assert result[filter_name] in filter_value, result
else:
assert result[filter_name] == filter_value, result


@pytest.mark.parametrize(
Expand Down

0 comments on commit 7167486

Please sign in to comment.