Xqt has uploaded a new change for review. https://gerrit.wikimedia.org/r/94703
Change subject: [PEP8] Pep8ify test_pagegenerators.py ...................................................................... [PEP8] Pep8ify test_pagegenerators.py Change-Id: Id9e525e5129e62ecb519cfafc43294a2a79f6f90 --- M tests/test_pagegenerators.py 1 file changed, 23 insertions(+), 21 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat refs/changes/03/94703/1 diff --git a/tests/test_pagegenerators.py b/tests/test_pagegenerators.py index 12ce0d3..15f9e99 100644 --- a/tests/test_pagegenerators.py +++ b/tests/test_pagegenerators.py @@ -13,10 +13,11 @@ __version__ = '$Id$' import unittest -import test_pywiki, test_wikipedia +import sys +import time -import sys, time - +import test_pywiki +import test_wikipedia import wikipedia as pywikibot import pagegenerators @@ -29,22 +30,21 @@ def setUp(self): pywikibot.setLogfileStatus(False) - result = test_pywiki.PyWikiTestCase.setUp(self) + result = test_pywiki.PyWikiTestCase.setUp(self) self.site = pywikibot.getSite('de', 'wikipedia') - self.ignore_list = { self.site.family.name: - { self.site.lang: [u'Benutzer Diskussion'] } } - + self.ignore_list = {self.site.family.name: + {self.site.lang: [u'Benutzer Diskussion']}} return result def test_module_import(self): - self.assertTrue( "pagegenerators" in sys.modules ) + self.assertTrue("pagegenerators" in sys.modules) def test_PagesFromTitlesGenerator(self): self._check_member(pagegenerators, "PagesFromTitlesGenerator", call=True) gen0 = pagegenerators.PagesFromTitlesGenerator(PAGE_SET_GENERIC) - self.assertTrue( len(PAGE_SET_GENERIC) == len(list(gen0)) ) + self.assertTrue(len(PAGE_SET_GENERIC) == len(list(gen0))) # more tests ... ?! def test_PageTitleFilterPageGenerator(self): @@ -53,7 +53,7 @@ gen0 = pagegenerators.PagesFromTitlesGenerator(PAGE_SET_GENERIC) gen1 = pagegenerators.PageTitleFilterPageGenerator(gen0, self.ignore_list) - self.assertTrue( len(PAGE_SET_GENERIC) > len(list(gen1)) ) + self.assertTrue(len(PAGE_SET_GENERIC) > len(list(gen1))) # more tests ... ?! def test_PreloadingGenerator(self): @@ -75,14 +75,14 @@ """ gen0 = pagegenerators.PagesFromTitlesGenerator(PAGE_SET_GENERIC) - gen1 = pagegenerators.PageTitleFilterPageGenerator(gen0, + gen1 = pagegenerators.PageTitleFilterPageGenerator(gen0, self.ignore_list) - num = len(list(gen1)) + num = len(list(gen1)) gen0 = pagegenerators.PagesFromTitlesGenerator(PAGE_SET_GENERIC) - gen1 = pagegenerators.PageTitleFilterPageGenerator(gen0, + gen1 = pagegenerators.PageTitleFilterPageGenerator(gen0, self.ignore_list) - gen2 = pagegenerators.PreloadingGenerator(gen1) # ThreadedGenerator would be nice! + gen2 = pagegenerators.PreloadingGenerator(gen1) # ThreadedGenerator would be nice! # TODO: solve this API buffering (speed) issue ! # # to enable the use of the API here (seams to be slower... ?!?) @@ -95,13 +95,13 @@ u = page.get() buffd['get'] = time.time()-start - self.assertAlmostEqual( buffd['get'], 0., places=3 ) + self.assertAlmostEqual(buffd['get'], 0., places=3) start = time.time() u = page.getVersionHistory(revCount=1) buffd['getVersionHistory'] = time.time()-start - self.assertAlmostEqual( buffd['getVersionHistory'], 0., places=4 ) + self.assertAlmostEqual(buffd['getVersionHistory'], 0., places=4) start = time.time() u = page.getSections(minLevel=1) @@ -111,7 +111,7 @@ u = page.getSections(minLevel=1) buffd['getSections'] = time.time()-start - self.assertAlmostEqual( buffd['getSections'], 0., places=4 ) + self.assertAlmostEqual(buffd['getSections'], 0., places=4) start = time.time() u = page.get(force=True) # triggers reload of 'getSections' also @@ -119,13 +119,15 @@ start = time.time() u = page.getVersionHistory(revCount=1, forceReload=True) - unbuffd['getVersionHistory'] = time.time()-start + unbuffd['getVersionHistory'] = time.time() - start - self.assertGreaterEqual(unbuffd['get']/buffd['get'], + self.assertGreaterEqual(unbuffd['get'] / buffd['get'], 1E3) - self.assertGreaterEqual(unbuffd['getVersionHistory']/buffd['getVersionHistory'], + self.assertGreaterEqual(unbuffd['getVersionHistory'] / + buffd['getVersionHistory'], 1E4) - self.assertGreaterEqual(unbuffd['getSections']/buffd['getSections'], + self.assertGreaterEqual(unbuffd['getSections'] / + buffd['getSections'], 1E5) num -= 1 -- To view, visit https://gerrit.wikimedia.org/r/94703 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Id9e525e5129e62ecb519cfafc43294a2a79f6f90 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/compat Gerrit-Branch: master Gerrit-Owner: Xqt <i...@gno.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits