← Back to team overview

testtools-dev team mailing list archive

[Bug 818080] [NEW] Way too many slashes in MatchesRegex mismatch

 

Public bug reported:

e.g.

AssertionError: '' does not match '\\d\\d\\d\\d-\\d\\d-\\d\\d
\\d\\d:\\d\\d:\\d\\d,\\d\\d\\d - INFO -
first\\n\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d - INFO
- second\\n'


=== modified file 'testtools/matchers.py'
--- testtools/matchers.py	2011-07-27 19:47:22 +0000
+++ testtools/matchers.py	2011-07-29 14:26:48 +0000
@@ -730,7 +730,7 @@ class MatchesRegex(object):
 
     def match(self, value):
         if not re.match(self.pattern, value, self.flags):
-            return Mismatch("%r does not match %r" % (value, self.pattern))
+            return Mismatch("%r does not match %s" % (value, self.pattern))
 
 
 class MatchesSetwise(object):

probably fixes it.

** Affects: testtools
     Importance: Wishlist
         Status: Triaged

-- 
You received this bug notification because you are a member of testtools
developers, which is subscribed to testtools.
https://bugs.launchpad.net/bugs/818080

Title:
  Way too many slashes in MatchesRegex mismatch

Status in testtools:
  Triaged

Bug description:
  e.g.

  AssertionError: '' does not match '\\d\\d\\d\\d-\\d\\d-\\d\\d
  \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d - INFO -
  first\\n\\d\\d\\d\\d-\\d\\d-\\d\\d \\d\\d:\\d\\d:\\d\\d,\\d\\d\\d -
  INFO - second\\n'

  
  === modified file 'testtools/matchers.py'
  --- testtools/matchers.py	2011-07-27 19:47:22 +0000
  +++ testtools/matchers.py	2011-07-29 14:26:48 +0000
  @@ -730,7 +730,7 @@ class MatchesRegex(object):
   
       def match(self, value):
           if not re.match(self.pattern, value, self.flags):
  -            return Mismatch("%r does not match %r" % (value, self.pattern))
  +            return Mismatch("%r does not match %s" % (value, self.pattern))
   
   
   class MatchesSetwise(object):

  probably fixes it.

To manage notifications about this bug go to:
https://bugs.launchpad.net/testtools/+bug/818080/+subscriptions


Follow ups

References