[Checkins] SVN: zope.testbrowser/trunk/src/zope/testbrowser/tests.py Code cleanup in anticipation of changes.

Christian Theune ct at gocept.com
Sat Apr 24 07:35:41 EDT 2010


Log message for revision 111340:
  Code cleanup in anticipation of changes.
  

Changed:
  U   zope.testbrowser/trunk/src/zope/testbrowser/tests.py

-=-
Modified: zope.testbrowser/trunk/src/zope/testbrowser/tests.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/tests.py	2010-04-24 10:57:26 UTC (rev 111339)
+++ zope.testbrowser/trunk/src/zope/testbrowser/tests.py	2010-04-24 11:35:41 UTC (rev 111340)
@@ -42,8 +42,7 @@
         headers = (
             'Content-Type: text/html\r\n'
             'Content-Length: %s\r\n'
-            % len(body)
-            )
+            % len(body))
     next_response_body = body
     next_response_headers = headers
     next_response_status = status
@@ -64,7 +63,6 @@
         # to make sure there is none in the URL
         return url.replace(' ', '%20')
 
-
     def request(self, method, url, body=None, headers=None):
         if body is None:
             body = ''
@@ -103,6 +101,7 @@
                             next_response_reason,
                             )
 
+
 class FauxResponse(object):
 
     def __init__(self, content, headers, status, reason):
@@ -171,6 +170,7 @@
         set_next_response(body, headers, status, reason)
         zope.testbrowser.browser.Browser.open(self, url)
 
+
 def test_submit_duplicate_name():
     """
 
@@ -245,6 +245,7 @@
 
 """
 
+
 def test_file_upload():
     """
 
@@ -306,6 +307,7 @@
 
     """
 
+
 def test_new_instance_no_contents_should_not_fail(self):
     """
 
@@ -319,7 +321,6 @@
     """
 
 
-
 def test_strip_linebreaks_from_textarea(self):
     """
 
@@ -364,7 +365,8 @@
     >>> browser.getControl(name='textarea').value
     '\\nFoo\\n'
 
-Also, if there is some other whitespace after the start tag, it will be preserved.
+Also, if there is some other whitespace after the start tag, it will be
+preserved.
 
     >>> browser.open('''
     ... <html><body>
@@ -379,6 +381,7 @@
     '  Foo  '
     """
 
+
 def test_relative_link():
     """
     RFC 1808 specifies how relative URLs should be resolved, let's see
@@ -430,23 +433,25 @@
     """
 
 
-
 class win32CRLFtransformer(object):
     def sub(self, replacement, text):
-        return text.replace(r'\r','')
+        return text.replace(r'\r', '')
 
 checker = zope.testing.renormalizing.RENormalizing([
-    (re.compile(r'^--\S+\.\S+\.\S+', re.M), '-'*30),
-    (re.compile(r'boundary=\S+\.\S+\.\S+'), 'boundary='+'-'*30),
-    (re.compile(r'^---{10}.*', re.M), '-'*30),
-    (re.compile(r'boundary=-{10}.*'), 'boundary='+'-'*30),
+    (re.compile(r'^--\S+\.\S+\.\S+', re.M), '-' * 30),
+    (re.compile(r'boundary=\S+\.\S+\.\S+'), 'boundary=' + '-' * 30),
+    (re.compile(r'^---{10}.*', re.M), '-' * 30),
+    (re.compile(r'boundary=-{10}.*'), 'boundary=' + '-' * 30),
     (re.compile(r'User-agent:\s+\S+'), 'User-agent: Python-urllib/2.4'),
-    (re.compile(r'HTTP_USER_AGENT:\s+\S+'), 'HTTP_USER_AGENT: Python-urllib/2.4'),
+    (re.compile(r'HTTP_USER_AGENT:\s+\S+'),
+     'HTTP_USER_AGENT: Python-urllib/2.4'),
     (re.compile(r'Content-[Ll]ength:.*'), 'Content-Length: 123'),
     (re.compile(r'Status: 200.*'), 'Status: 200 OK'),
     (win32CRLFtransformer(), None),
-    (re.compile(r'User-Agent: Python-urllib/2.5'), 'User-agent: Python-urllib/2.4'),
-    (re.compile(r'User-Agent: Python-urllib/2.6'), 'User-agent: Python-urllib/2.4'),
+    (re.compile(r'User-Agent: Python-urllib/2.5'),
+     'User-agent: Python-urllib/2.4'),
+    (re.compile(r'User-Agent: Python-urllib/2.6'),
+     'User-agent: Python-urllib/2.4'),
     (re.compile(r'Host: localhost'), 'Connection: close'),
     (re.compile(r'Content-Type: '), 'Content-type: '),
     (re.compile(r'Content-Disposition: '), 'Content-disposition: '),
@@ -456,6 +461,7 @@
     os.path.join(os.path.split(__file__)[0], 'ftests/ftesting.zcml'),
     __name__, 'TestBrowserLayer', allow_teardown=True)
 
+
 def test_suite():
     flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
 
@@ -477,6 +483,3 @@
     this_file = doctest.DocTestSuite(checker=checker)
 
     return unittest.TestSuite((this_file, readme, fixed_bugs, wire, cookies))
-
-if __name__ == '__main__':
-    unittest.main(defaultTest='test_suite')



More information about the checkins mailing list