recwarn: fix was -> were in DID NOT WARN message
This commit is contained in:
parent
60ca83746b
commit
99363ad7ff
|
@ -268,7 +268,7 @@ argument ``match`` to assert that the exception matches a text or regex::
|
||||||
... warnings.warn("this is not here", UserWarning)
|
... warnings.warn("this is not here", UserWarning)
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted...
|
Failed: DID NOT WARN. No warnings of type ...UserWarning... were emitted...
|
||||||
|
|
||||||
You can also call :func:`pytest.warns` on a function or code string:
|
You can also call :func:`pytest.warns` on a function or code string:
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ def warns(
|
||||||
... warnings.warn("this is not here", UserWarning)
|
... warnings.warn("this is not here", UserWarning)
|
||||||
Traceback (most recent call last):
|
Traceback (most recent call last):
|
||||||
...
|
...
|
||||||
Failed: DID NOT WARN. No warnings of type ...UserWarning... was emitted...
|
Failed: DID NOT WARN. No warnings of type ...UserWarning... were emitted...
|
||||||
|
|
||||||
"""
|
"""
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
|
@ -274,7 +274,7 @@ class WarningsChecker(WarningsRecorder):
|
||||||
if not any(issubclass(r.category, self.expected_warning) for r in self):
|
if not any(issubclass(r.category, self.expected_warning) for r in self):
|
||||||
__tracebackhide__ = True
|
__tracebackhide__ = True
|
||||||
fail(
|
fail(
|
||||||
"DID NOT WARN. No warnings of type {} was emitted. "
|
"DID NOT WARN. No warnings of type {} were emitted. "
|
||||||
"The list of emitted warnings is: {}.".format(
|
"The list of emitted warnings is: {}.".format(
|
||||||
self.expected_warning, [each.message for each in self]
|
self.expected_warning, [each.message for each in self]
|
||||||
)
|
)
|
||||||
|
@ -287,7 +287,7 @@ class WarningsChecker(WarningsRecorder):
|
||||||
else:
|
else:
|
||||||
fail(
|
fail(
|
||||||
"DID NOT WARN. No warnings of type {} matching"
|
"DID NOT WARN. No warnings of type {} matching"
|
||||||
" ('{}') was emitted. The list of emitted warnings"
|
" ('{}') were emitted. The list of emitted warnings"
|
||||||
" is: {}.".format(
|
" is: {}.".format(
|
||||||
self.expected_warning,
|
self.expected_warning,
|
||||||
self.match_expr,
|
self.match_expr,
|
||||||
|
|
|
@ -263,7 +263,7 @@ class TestWarns:
|
||||||
with pytest.warns(RuntimeWarning):
|
with pytest.warns(RuntimeWarning):
|
||||||
warnings.warn("user", UserWarning)
|
warnings.warn("user", UserWarning)
|
||||||
excinfo.match(
|
excinfo.match(
|
||||||
r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) was emitted. "
|
r"DID NOT WARN. No warnings of type \(.+RuntimeWarning.+,\) were emitted. "
|
||||||
r"The list of emitted warnings is: \[UserWarning\('user',?\)\]."
|
r"The list of emitted warnings is: \[UserWarning\('user',?\)\]."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ class TestWarns:
|
||||||
with pytest.warns(UserWarning):
|
with pytest.warns(UserWarning):
|
||||||
warnings.warn("runtime", RuntimeWarning)
|
warnings.warn("runtime", RuntimeWarning)
|
||||||
excinfo.match(
|
excinfo.match(
|
||||||
r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. "
|
r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) were emitted. "
|
||||||
r"The list of emitted warnings is: \[RuntimeWarning\('runtime',?\)\]."
|
r"The list of emitted warnings is: \[RuntimeWarning\('runtime',?\)\]."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ class TestWarns:
|
||||||
with pytest.warns(UserWarning):
|
with pytest.warns(UserWarning):
|
||||||
pass
|
pass
|
||||||
excinfo.match(
|
excinfo.match(
|
||||||
r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) was emitted. "
|
r"DID NOT WARN. No warnings of type \(.+UserWarning.+,\) were emitted. "
|
||||||
r"The list of emitted warnings is: \[\]."
|
r"The list of emitted warnings is: \[\]."
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ class TestWarns:
|
||||||
warnings.warn("import", ImportWarning)
|
warnings.warn("import", ImportWarning)
|
||||||
|
|
||||||
message_template = (
|
message_template = (
|
||||||
"DID NOT WARN. No warnings of type {0} was emitted. "
|
"DID NOT WARN. No warnings of type {0} were emitted. "
|
||||||
"The list of emitted warnings is: {1}."
|
"The list of emitted warnings is: {1}."
|
||||||
)
|
)
|
||||||
excinfo.match(
|
excinfo.match(
|
||||||
|
|
Loading…
Reference in New Issue