Ignore:
Timestamp:
Apr 20, 2011 8:20:36 AM (13 years ago)
Author:
zidane
Message:

fixes pep8

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/tests/testGoogleSitemaps.py

    r2538 r3152  
    1616    fp = NamedTemporaryFile(mode='w+', prefix=prefix) 
    1717    fp.write("google-site-verification: " + fp.name) 
    18     fp.seek(0,2) 
     18    fp.seek(0, 2) 
    1919    fsize = fp.tell() 
    2020    fp.seek(0) 
    2121 
    22     env = {'REQUEST_METHOD':'PUT'} 
    23     headers = {'content-type':'text/plain', 
     22    env = {'REQUEST_METHOD': 'PUT'} 
     23    headers = {'content-type': 'text/plain', 
    2424               'content-length': fsize, 
    25                'content-disposition':'attachment; filename=%s' % fp.name} 
     25               'content-disposition': 'attachment; filename=%s' % fp.name} 
    2626    fs = FieldStorage(fp=fp, environ=env, headers=headers) 
    2727    return FileUpload(fs), fp 
     
    3434 
    3535        _createObjectByType('Sitemap', self.portal, id='google-sitemaps') 
    36         self.sitemapUrl = '/'+self.portal.absolute_url(1) + '/google-sitemaps' 
    37         self.gsm_props = self.portal.portal_properties['googlesitemap_properties'] 
     36        self.sitemapUrl = '/' + self.portal.absolute_url(1) + \ 
     37                          '/google-sitemaps' 
     38        gsm_properties = 'googlesitemap_properties' 
     39        self.gsm_props = self.portal.portal_properties[gsm_properties] 
    3840 
    3941        # Add testing document to portal 
     
    7274            self.portal.gsm_create_verify_file() 
    7375        finally: 
    74             if fp: fp.close() 
     76            if fp: 
     77                fp.close() 
    7578        vf_created = hasattr(self.portal, fname) 
    7679        self.assert_(vf_created, 'Verification file not created') 
    7780 
    7881    def testVerificationForm(self): 
    79         verifyConfigUrl = '/'+self.portal.absolute_url(1) + '/prefs_gsm_verification' 
     82        verifyConfigUrl = '/' + self.portal.absolute_url(1) + \ 
     83                          '/prefs_gsm_verification' 
    8084        verif_config = self.publish(verifyConfigUrl, self.auth).getBody() 
    81         rexp_input_acitve = re.compile('<input\s+name="verification_file"\s+([^>]*)>', re.I|re.S) 
    82         rexp_button_acitve = re.compile('<input\s+name="form.button.CreateFile"\s+([^>]*)>', re.I|re.S) 
    83         rexp_delete_button = re.compile('<input\s+name="form.button.DeleteFile"\s+[^>]*>', re.I|re.S) 
     85        rexp_input_acitve = re.compile('<input\s+name="verification_file"' \ 
     86                                       '\s+([^>]*)>', re.I | re.S) 
     87        rexp_button_acitve = re.compile( 
     88            '<input\s+name="form.button.CreateFile"\s+([^>]*)>', re.I | re.S) 
     89        rexp_delete_button = re.compile( 
     90            '<input\s+name="form.button.DeleteFile"\s+[^>]*>', re.I | re.S) 
    8491 
    8592        input_acitve = rexp_input_acitve.search(verif_config) 
     
    8895 
    8996        self.assert_(input_acitve and not 'disabled' in input_acitve.groups(1)) 
    90         self.assert_(button_acitve and not 'disabled' in button_acitve.groups(1)) 
     97        self.assert_(button_acitve and not 'disabled' in \ 
     98                     button_acitve.groups(1)) 
    9199        self.assert_(not delete_button) 
    92100 
     
    98106            self.portal.gsm_create_verify_file() 
    99107        finally: 
    100             if fp: fp.close() 
     108            if fp: 
     109                fp.close() 
    101110 
    102111        input_acitve = rexp_input_acitve.search(verif_config) 
     
    109118 
    110119    def testMultiplyVerificationFiles(self): 
    111         verifyConfigUrl = '/'+self.portal.absolute_url(1) + '/prefs_gsm_verification' 
     120        verifyConfigUrl = '/' + self.portal.absolute_url(1) + \ 
     121                          '/prefs_gsm_verification' 
    112122        fnames = [] 
    113         for i in [1,2]: 
     123        for i in [1, 2]: 
    114124            fp, fname, response = None, None, None 
    115125            try: 
     
    123133                                        basic=self.auth, extra=extra_update) 
    124134            finally: 
    125                 if fp: fp.close() 
    126              
     135                if fp: 
     136                    fp.close() 
     137 
    127138            self.assertEqual(response.getStatus(), 200) 
    128             self.assert_(fname in self.gsm_props.getProperty('verification_filenames',[]), 
    129                              self.gsm_props.getProperty('verification_filenames',[])) 
     139            self.assert_(fname in \ 
     140                 self.gsm_props.getProperty('verification_filenames', []), 
     141                 self.gsm_props.getProperty('verification_filenames', [])) 
    130142            fnames.append(fname) 
    131143 
    132144        self.assertEqual(len([1 for vf in fnames \ 
    133             if vf in self.gsm_props.getProperty('verification_filenames',[])]), 2, 
    134             self.gsm_props.getProperty('verification_filenames',[])) 
     145            if vf in \ 
     146                self.gsm_props.getProperty('verification_filenames', [])]), 2, 
     147                self.gsm_props.getProperty('verification_filenames', [])) 
    135148 
    136149 
Note: See TracChangeset for help on using the changeset viewer.