Commits

Robert Brewer committed 2def562

Use %r instead of %s and `obj`.

Comments (0)

Files changed (1)

cherrypy/test/webtest.py

         if isinstance(status, basestring):
             if not self.status == status:
                 if msg is None:
-                    msg = 'Status (%s) != %s' % (`self.status`, `status`)
+                    msg = 'Status (%r) != %r' % (self.status, status)
                 self._handlewebError(msg)
         elif isinstance(status, int):
             code = int(self.status[:3])
             if code != status:
                 if msg is None:
-                    msg = 'Status (%s) != %s' % (`self.status`, `status`)
+                    msg = 'Status (%r) != %r' % (self.status, status)
                 self._handlewebError(msg)
         else:
             # status is a tuple or list.
                     break
             if not match:
                 if msg is None:
-                    msg = 'Status (%s) not in %s' % (`self.status`, `status`)
+                    msg = 'Status (%r) not in %r' % (self.status, status)
                 self._handlewebError(msg)
     
     def assertHeader(self, key, value=None, msg=None):
         
         if msg is None:
             if value is None:
-                msg = '%s not in headers' % `key`
+                msg = '%r not in headers' % key
             else:
-                msg = '%s:%s not in headers' % (`key`, `value`)
+                msg = '%r:%r not in headers' % (key, value)
         self._handlewebError(msg)
     
     def assertNoHeader(self, key, msg=None):
         matches = [k for k, v in self.headers if k.lower() == lowkey]
         if matches:
             if msg is None:
-                msg = '%s in headers' % `key`
+                msg = '%r in headers' % key
             self._handlewebError(msg)
     
     def assertBody(self, value, msg=None):
         """Fail if value != self.body."""
         if value != self.body:
             if msg is None:
-                msg = 'expected body:\n%s\n\nactual body:\n%s' % (`value`, `self.body`)
+                msg = 'expected body:\n%r\n\nactual body:\n%r' % (value, self.body)
             self._handlewebError(msg)
     
     def assertInBody(self, value, msg=None):
         """Fail if value not in self.body."""
         if value not in self.body:
             if msg is None:
-                msg = '%s not in body' % `value`
+                msg = '%r not in body' % value
             self._handlewebError(msg)
     
     def assertNotInBody(self, value, msg=None):
         """Fail if value in self.body."""
         if value in self.body:
             if msg is None:
-                msg = '%s found in body' % `value`
+                msg = '%r found in body' % value
             self._handlewebError(msg)
     
     def assertMatchesBody(self, pattern, msg=None, flags=0):
         """Fail if value (a regex pattern) is not in self.body."""
         if re.search(pattern, self.body, flags) is None:
             if msg is None:
-                msg = 'No match for %s in body' % `pattern`
+                msg = 'No match for %r in body' % pattern
             self._handlewebError(msg)
 
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.