From df1d08312fb45f885b3cd0f7ea438570322f4acd Mon Sep 17 00:00:00 2001 From: Daniel Carrillo Date: Sat, 8 Jun 2024 15:53:50 +0200 Subject: [PATCH] Fix exception tests --- tests/test_dig_aws.py | 2 +- tests/test_get_aws_ip_ranges_json.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_dig_aws.py b/tests/test_dig_aws.py index 87d0563..f0104e1 100644 --- a/tests/test_dig_aws.py +++ b/tests/test_dig_aws.py @@ -97,7 +97,7 @@ def test_lookup(test_dig): with pytest.raises(ValueError) as e: test_dig.lookup("what are you talking about") - assert e.startswith("Wrong IP or CIDR format") + assert str(e.value).startswith("Wrong IP or CIDR format") def test_response_plain_print(test_dig, capsys): diff --git a/tests/test_get_aws_ip_ranges_json.py b/tests/test_get_aws_ip_ranges_json.py index 76ccefa..db6a02c 100644 --- a/tests/test_get_aws_ip_ranges_json.py +++ b/tests/test_get_aws_ip_ranges_json.py @@ -83,4 +83,4 @@ def test_get_aws_ip_ranges_invalid_status(mocker, fs, create_cache_dir) -> None: with pytest.raises(digaws.UnexpectedRequestException) as e: digaws.get_aws_ip_ranges() - assert e.match("^Unexpected response from") + assert str(e.value).startswith("Unexpected response from")