Skip to content

Commit f722d6c

Browse files
committed
Add match= to pytest.raises()
It's not very accurate since there are about 3 message templates. But it's better than nothing.
1 parent 235a768 commit f722d6c

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/test_incorrect_args.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def test_getall_args(
5353
multidict_object: MultiDict[int],
5454
tested_method_args: InvalidTestedMethodArgs,
5555
) -> None:
56-
with pytest.raises(TypeError):
56+
with pytest.raises(TypeError, match=r".*argument.*"):
5757
multidict_object.getall(
5858
*tested_method_args.positional,
5959
**tested_method_args.keyword,
@@ -64,7 +64,7 @@ def test_getone_args(
6464
multidict_object: MultiDict[int],
6565
tested_method_args: InvalidTestedMethodArgs,
6666
) -> None:
67-
with pytest.raises(TypeError):
67+
with pytest.raises(TypeError, match=r".*argument.*"):
6868
multidict_object.getone(
6969
*tested_method_args.positional,
7070
**tested_method_args.keyword,
@@ -75,7 +75,7 @@ def test_get_args(
7575
multidict_object: MultiDict[int],
7676
tested_method_args: InvalidTestedMethodArgs,
7777
) -> None:
78-
with pytest.raises(TypeError):
78+
with pytest.raises(TypeError, match=r".*argument.*"):
7979
multidict_object.get(
8080
*tested_method_args.positional,
8181
**tested_method_args.keyword,
@@ -86,7 +86,7 @@ def test_setdefault_args(
8686
multidict_object: MultiDict[int],
8787
tested_method_args: InvalidTestedMethodArgs,
8888
) -> None:
89-
with pytest.raises(TypeError):
89+
with pytest.raises(TypeError, match=r".*argument.*"):
9090
multidict_object.setdefault(
9191
*tested_method_args.positional,
9292
**tested_method_args.keyword,
@@ -97,7 +97,7 @@ def test_popone_args(
9797
multidict_object: MultiDict[int],
9898
tested_method_args: InvalidTestedMethodArgs,
9999
) -> None:
100-
with pytest.raises(TypeError):
100+
with pytest.raises(TypeError, match=r".*argument.*"):
101101
multidict_object.popone(
102102
*tested_method_args.positional,
103103
**tested_method_args.keyword,
@@ -108,7 +108,7 @@ def test_pop_args(
108108
multidict_object: MultiDict[int],
109109
tested_method_args: InvalidTestedMethodArgs,
110110
) -> None:
111-
with pytest.raises(TypeError):
111+
with pytest.raises(TypeError, match=r".*argument.*"):
112112
multidict_object.pop(
113113
*tested_method_args.positional,
114114
**tested_method_args.keyword,
@@ -119,7 +119,7 @@ def test_popall_args(
119119
multidict_object: MultiDict[int],
120120
tested_method_args: InvalidTestedMethodArgs,
121121
) -> None:
122-
with pytest.raises(TypeError):
122+
with pytest.raises(TypeError, match=r".*argument.*"):
123123
multidict_object.popall(
124124
*tested_method_args.positional,
125125
**tested_method_args.keyword,

0 commit comments

Comments
 (0)