Ignore:
Timestamp:
Apr 19, 2011 9:06:50 AM (13 years ago)
Author:
vmaksymiv
Message:

pep8 fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.catalogupdater/trunk/quintagroup/catalogupdater/tests.py

    r1866 r3142  
    55from zope.component import queryUtility 
    66from zope.component import provideAdapter 
    7  
    8 from Testing import ZopeTestCase as ztc 
    97 
    108from Products.Five import zcml 
     
    3735ptc.setupPloneSite() 
    3836 
     37 
    3938class TestUtility(TestCase): 
    4039 
    4140    def afterSetUp(self): 
    4241        self.loginAsPortalOwner() 
    43         self.my_doc = makeContent(self.portal, portal_type='Document', id='my_doc') 
     42        self.my_doc = makeContent(self.portal, portal_type='Document', 
     43                                  id='my_doc') 
    4444        self.catalog = getToolByName(self.portal, 'portal_catalog') 
    4545        self.logout() 
     
    5151        self.catalog.addColumn('test_column') 
    5252 
    53  
    5453    def addIndexerNew(self): 
    5554        @indexer(Interface) 
     
    5857        provideAdapter(test_column, name='test_column') 
    5958 
    60  
    6159    def addIndexerOld(self): 
    6260        def test_column(obj, portal, **kwargs): 
    6361            return obj.id 
    6462        registerIndexableAttribute("test_column", test_column) 
    65  
    6663 
    6764    def testSingleColumnUpdate(self): 
     
    9390        self.assertTrue(mydoc.Title == "My document", mydoc.Title) 
    9491 
    95         self.my_doc.setTitle('New my document') # catalog not updated 
     92        self.my_doc.setTitle('New my document')  # catalog not updated 
    9693        cu = queryUtility(ICatalogUpdater, name="catalog_updater") 
    9794        cu.updateMetadata4All(self.catalog, 'test_column') 
     
    10097        self.assertTrue(mydoc.Title == 'My document', 
    10198            "Other metadata updated: Title='%s'" % mydoc.Title) 
    102  
    10399 
    104100    def testAllRecordsUpdate(self): 
     
    110106        num_recs = len(self.catalog._catalog.data) 
    111107        allcat = self.catalog.unrestrictedSearchResults(path='/') 
    112         num_updated = sum([1 for b in allcat if b.test_column==b.id]) 
     108        num_updated = sum([1 for b in allcat if b.test_column == b.id]) 
    113109 
    114110        self.assertTrue(num_updated == num_recs, "Only %d records updated, " \ 
    115111            "must be - %d" % (num_updated, num_recs)) 
    116  
    117112 
    118113    def testTransaction(self): 
     
    121116        # savepoint patch 
    122117        global sp_commits 
    123         sp_commits = 1 # Starts from 1 to count last commit 
     118        sp_commits = 1  # Starts from 1 to count last commit 
    124119        orig_trsp = transaction.savepoint 
     120 
    125121        def dummy_savepoint(*args, **kwargs): 
    126122            global sp_commits 
     
    132128        num_recs = len(self.catalog.unrestrictedSearchResults(path='/')) 
    133129        num_subcommits = 3 
    134         self.catalog.threshold = num_recs/num_subcommits 
     130        self.catalog.threshold = num_recs / num_subcommits 
    135131 
    136132        cu = queryUtility(ICatalogUpdater, name="catalog_updater") 
    137133        cu.updateMetadata4All(self.catalog, 'test_column') 
    138134 
    139         self.assertTrue(sp_commits == num_subcommits, 
    140             "Wrong number of transaction subcommits: actual:%d, must be: %d" % ( 
    141             sp_commits, num_subcommits)) 
     135        self.assertTrue(sp_commits == num_subcommits, "Wrong number of " \ 
     136            "transaction subcommits: actual:%d, must be: %d" % (sp_commits, 
     137            num_subcommits)) 
    142138 
    143139        transaction.savepoint = orig_trsp 
    144          
    145140 
    146141 
Note: See TracChangeset for help on using the changeset viewer.