@@ -533,7 +533,7 @@ def assert_regex(text, regex, msg_fmt="{msg}"):
533533 expression object.
534534
535535 >>> assert_regex("Hello World!", r"llo.*rld!$")
536- >>> assert_regex("Hello World!", r"\d")
536+ >>> assert_regex("Hello World!", r"\\ d")
537537 Traceback (most recent call last):
538538 ...
539539 AssertionError: 'Hello World!' does not match '\\ \\ d'
@@ -986,10 +986,10 @@ def assert_raises_regex(exception, regex, msg_fmt="{msg}"):
986986
987987 The regular expression can be a regular expression string or object.
988988
989- >>> with assert_raises_regex(ValueError, r"\d+"):
989+ >>> with assert_raises_regex(ValueError, r"\\ d+"):
990990 ... raise ValueError("Error #42")
991991 ...
992- >>> with assert_raises_regex(ValueError, r"\d+"):
992+ >>> with assert_raises_regex(ValueError, r"\\ d+"):
993993 ... raise ValueError("Generic Error")
994994 ...
995995 Traceback (most recent call last):
@@ -1252,7 +1252,7 @@ def assert_warns_regex(warning_type, regex, msg_fmt="{msg}"):
12521252 The message can be a regular expression string or object.
12531253
12541254 >>> from warnings import warn
1255- >>> with assert_warns_regex(UserWarning, r"#\d+"):
1255+ >>> with assert_warns_regex(UserWarning, r"#\\ d+"):
12561256 ... warn("Error #42", UserWarning)
12571257 ...
12581258 >>> with assert_warns_regex(UserWarning, r"Expected Error"):
@@ -1280,7 +1280,7 @@ def test(warning):
12801280if sys .version_info >= (3 ,):
12811281 _Str = str
12821282else :
1283- _Str = unicode
1283+ _Str = unicode # noqa: F821
12841284
12851285
12861286def assert_json_subset (first , second ):
0 commit comments