summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/test_assertions.py
diff options
context:
space:
mode:
authorLarry Hastings <larry@hastings.org>2015-09-07 12:16:38 (GMT)
committerLarry Hastings <larry@hastings.org>2015-09-07 12:16:38 (GMT)
commitc8c47f55e636ed86791160944ccbb1ea651476bd (patch)
treedb97b6edb082a98c6ad2abcbacb6151ee2df2049 /Lib/unittest/test/test_assertions.py
parent71f9633818b3a0cbd36b0f6ed164d436b1997fe9 (diff)
parent8c85a2083fdc6188d32f1eb287151cdb7e79a54a (diff)
downloadcpython-c8c47f55e636ed86791160944ccbb1ea651476bd.zip
cpython-c8c47f55e636ed86791160944ccbb1ea651476bd.tar.gz
cpython-c8c47f55e636ed86791160944ccbb1ea651476bd.tar.bz2
Merge heads.
Diffstat (limited to 'Lib/unittest/test/test_assertions.py')
-rw-r--r--Lib/unittest/test/test_assertions.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/unittest/test/test_assertions.py b/Lib/unittest/test/test_assertions.py
index c349a95..e6e2bc2 100644
--- a/Lib/unittest/test/test_assertions.py
+++ b/Lib/unittest/test/test_assertions.py
@@ -133,7 +133,6 @@ class Test_Assertions(unittest.TestCase):
try:
self.assertNotRegex('Ala ma kota', r'k.t', 'Message')
except self.failureException as e:
- self.assertIn("'kot'", e.args[0])
self.assertIn('Message', e.args[0])
else:
self.fail('assertNotRegex should have failed.')
@@ -329,6 +328,20 @@ class TestLongMessage(unittest.TestCase):
"^unexpectedly identical: None$",
"^unexpectedly identical: None : oops$"])
+ def testAssertRegex(self):
+ self.assertMessages('assertRegex', ('foo', 'bar'),
+ ["^Regex didn't match:",
+ "^oops$",
+ "^Regex didn't match:",
+ "^Regex didn't match: (.*) : oops$"])
+
+ def testAssertNotRegex(self):
+ self.assertMessages('assertNotRegex', ('foo', 'foo'),
+ ["^Regex matched:",
+ "^oops$",
+ "^Regex matched:",
+ "^Regex matched: (.*) : oops$"])
+
def assertMessagesCM(self, methodName, args, func, errors):
"""