Skip to content

Commit

Permalink
Merge pull request #156 from SublimeText/regex-assertion-output
Browse files Browse the repository at this point in the history
Improved error text of regexp assertions.
  • Loading branch information
randy3k authored Jan 19, 2019
2 parents 7b80603 + 769c205 commit d94dcb0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_3141596.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ def real_wrapper(self):
class UnitTestingTestCase(DeferrableTestCase):

def assertRegexContains(self, txt, expr, msg=None):
m = re.search(expr, txt, re.MULTILINE)
self.assertIsNotNone(m, msg)
if re.search(expr, txt, re.MULTILINE) is None:
self.fail("String {!r} does not contain regexp {!r}.".format(
txt, expr
))

def assertOk(self, txt, msg=None):
self.assertRegexContains(txt, r'^OK', msg)
Expand Down

0 comments on commit d94dcb0

Please sign in to comment.