From 10a2b75b8be7b68eacfa168834d9938b77d2d7e3 Mon Sep 17 00:00:00 2001 From: Jonathan Vanasco Date: Wed, 8 Jan 2020 22:42:39 -0500 Subject: Add assertNotRegex. (#289) Fixes #288. Co-authored-by: Benjamin Peterson --- test_six.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test_six.py') diff --git a/test_six.py b/test_six.py index 2cd2112..7b8b03b 100644 --- a/test_six.py +++ b/test_six.py @@ -938,6 +938,17 @@ def test_assertRegex(): TestAssertRegex('test').test() +def test_assertNotRegex(): + class TestAssertNotRegex(unittest.TestCase): + def test(self): + with self.assertRaises(AssertionError): + six.assertNotRegex(self, 'test', r'^t') + + six.assertNotRegex(self, 'test', r'^a') + + TestAssertNotRegex('test').test() + + def test_assertRaisesRegex(): class TestAssertRaisesRegex(unittest.TestCase): def test(self): -- cgit v1.2.1