summaryrefslogtreecommitdiff
path: root/six.py
diff options
context:
space:
mode:
authorJonathan Vanasco <jonathan@2xlp.com>2020-01-08 22:42:39 -0500
committerBenjamin Peterson <benjamin@python.org>2020-01-08 19:42:39 -0800
commit10a2b75b8be7b68eacfa168834d9938b77d2d7e3 (patch)
treeb432f365a335b5d66e90e8af5b2156deb84e00b8 /six.py
parent5cd83db203a9f4bffd401e77a48543669548a94e (diff)
downloadsix-git-10a2b75b8be7b68eacfa168834d9938b77d2d7e3.tar.gz
Add assertNotRegex. (#289)
Fixes #288. Co-authored-by: Benjamin Peterson <benjamin@python.org>
Diffstat (limited to 'six.py')
-rw-r--r--six.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/six.py b/six.py
index 1296655..30de42d 100644
--- a/six.py
+++ b/six.py
@@ -644,9 +644,11 @@ if PY3:
if sys.version_info[1] <= 1:
_assertRaisesRegex = "assertRaisesRegexp"
_assertRegex = "assertRegexpMatches"
+ _assertNotRegex = "assertNotRegexpMatches"
else:
_assertRaisesRegex = "assertRaisesRegex"
_assertRegex = "assertRegex"
+ _assertNotRegex = "assertNotRegex"
else:
def b(s):
return s
@@ -668,6 +670,7 @@ else:
_assertCountEqual = "assertItemsEqual"
_assertRaisesRegex = "assertRaisesRegexp"
_assertRegex = "assertRegexpMatches"
+ _assertNotRegex = "assertNotRegexpMatches"
_add_doc(b, """Byte literal""")
_add_doc(u, """Text literal""")
@@ -684,6 +687,10 @@ def assertRegex(self, *args, **kwargs):
return getattr(self, _assertRegex)(*args, **kwargs)
+def assertNotRegex(self, *args, **kwargs):
+ return getattr(self, _assertNotRegex)(*args, **kwargs)
+
+
if PY3:
exec_ = getattr(moves.builtins, "exec")