jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
[cleanup] cleanup some tests/ files

- remove bad quotes

Bug: T89589
Change-Id: I2103f6b21bca8710c1b0447033741ae5c0129704
---
M tests/__init__.py
M tests/dry_api_tests.py
M tests/pagegenerators_tests.py
M tests/site_tests.py
M tests/textlib_tests.py
M tests/wikibase_tests.py
M tests/xmlreader_tests.py
M tox.ini
8 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/tests/__init__.py b/tests/__init__.py
index caacc39..d120baf 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -275,7 +275,7 @@
cache_misses = 0
cache_hits = 0

-warnings.filterwarnings("always")
+warnings.filterwarnings('always')


class TestRequest(CachedRequest):
diff --git a/tests/dry_api_tests.py b/tests/dry_api_tests.py
index a377d53..01e5dcb 100644
--- a/tests/dry_api_tests.py
+++ b/tests/dry_api_tests.py
@@ -372,7 +372,7 @@
'type': 'string'
}
],
- "querytype": "prop"
+ 'querytype': 'prop'
}

edit_action_param_data = {
diff --git a/tests/pagegenerators_tests.py b/tests/pagegenerators_tests.py
index f66629e..03875f5 100755
--- a/tests/pagegenerators_tests.py
+++ b/tests/pagegenerators_tests.py
@@ -90,7 +90,7 @@

def test_NamespaceFilterPageGenerator(self):
"""Test NamespaceFilterPageGenerator."""
- self.assertFunction("NamespaceFilterPageGenerator")
+ self.assertFunction('NamespaceFilterPageGenerator')
site = self.site
gen = pagegenerators.PagesFromTitlesGenerator(self.titles, site)
gen = pagegenerators.NamespaceFilterPageGenerator(gen, 0, site)
diff --git a/tests/site_tests.py b/tests/site_tests.py
index dc62322..9437312 100644
--- a/tests/site_tests.py
+++ b/tests/site_tests.py
@@ -555,7 +555,7 @@
"""Test Site.categorymembers."""
cats = list(self.site.pagecategories(self.mainpage))
if len(cats) == 0:
- self.skipTest("Main page is not in any categories.")
+ self.skipTest('Main page is not in any categories.')
else:
for cm in self.site.categorymembers(cats[0]):
self.assertIsInstance(cm, pywikibot.Page)
@@ -1440,7 +1440,7 @@
self.assertIn(':', title)
prefix = title[:title.index(':')]
self.assertIn(self.site.namespaces.lookup_name(prefix).id, [6, 7])
- self.assertIn(change["ns"], [6, 7])
+ self.assertIn(change['ns'], [6, 7])

def test_pagelist(self):
"""Test the site.recentchanges() with pagelist deprecated MW 1.14."""
diff --git a/tests/textlib_tests.py b/tests/textlib_tests.py
index 4deba27..ad659df 100644
--- a/tests/textlib_tests.py
+++ b/tests/textlib_tests.py
@@ -63,7 +63,7 @@

def testCurrentBehaviour(self):
"""Test that 'Editing' is found."""
- self.assertContains("enwiki_help_editing", u"Editing")
+ self.assertContains('enwiki_help_editing', 'Editing')

def testSpacesInSection(self):
"""Test with spaces in section."""
diff --git a/tests/wikibase_tests.py b/tests/wikibase_tests.py
index 5a4759a..6ec66a4 100644
--- a/tests/wikibase_tests.py
+++ b/tests/wikibase_tests.py
@@ -142,9 +142,10 @@
claim = pywikibot.Claim(repo, 'p21')
regex = r' is not type .+\.$'
with self.assertRaisesRegex(ValueError, regex):
- claim.setTarget(value="test")
+ claim.setTarget(value='test')
claim.setTarget(ItemPage(repo, 'q1'))
- self.assertEqual(claim._formatValue(), {'entity-type': 'item', 'numeric-id': 1})
+ self.assertEqual(claim._formatValue(), {'entity-type': 'item',
+ 'numeric-id': 1})

def test_cmp(self):
"""Test WikibasePage.__cmp__."""
@@ -438,17 +439,17 @@
"""Test WbQuantity formatting with bounds."""
repo = self.get_repo()
q = pywikibot.WbQuantity(amount='0.044405586', error='0', site=repo)
- self.assertEqual("%s" % q,
+ self.assertEqual('%s' % q,
'{\n'
' "amount": "+%(val)s",\n'
' "lowerBound": "+%(val)s",\n'
' "unit": "1",\n'
' "upperBound": "+%(val)s"\n'
'}' % {'val': '0.044405586'})
- self.assertEqual("%r" % q,
- "WbQuantity(amount=%(val)s, "
- "upperBound=%(val)s, lowerBound=%(val)s, "
- "unit=1)" % {'val': '0.044405586'})
+ self.assertEqual('%r' % q,
+ 'WbQuantity(amount=%(val)s, '
+ 'upperBound=%(val)s, lowerBound=%(val)s, '
+ 'unit=1)' % {'val': '0.044405586'})

def test_WbQuantity_self_equality(self):
"""Test WbQuantity equality."""
@@ -529,17 +530,17 @@
raise unittest.SkipTest('Wiki version must be 1.29.0-wmf.2 or '
'newer to support unbound uncertainties.')
q = pywikibot.WbQuantity(amount='0.044405586', site=self.repo)
- self.assertEqual("%s" % q,
+ self.assertEqual('%s' % q,
'{\n'
' "amount": "+%(val)s",\n'
' "lowerBound": null,\n'
' "unit": "1",\n'
' "upperBound": null\n'
'}' % {'val': '0.044405586'})
- self.assertEqual("%r" % q,
- "WbQuantity(amount=%(val)s, "
- "upperBound=None, lowerBound=None, "
- "unit=1)" % {'val': '0.044405586'})
+ self.assertEqual('%r' % q,
+ 'WbQuantity(amount=%(val)s, '
+ 'upperBound=None, lowerBound=None, '
+ 'unit=1)' % {'val': '0.044405586'})

def test_WbQuantity_fromWikibase_unbound(self):
"""Test WbQuantity.fromWikibase() instantiating without bounds."""
@@ -629,7 +630,8 @@

def test_WbMonolingualText_string(self):
"""Test WbMonolingualText string."""
- q = pywikibot.WbMonolingualText(text='Test that basics work', language='en')
+ q = pywikibot.WbMonolingualText(text='Test that basics work',
+ language='en')
q_dict = {'text': 'Test that basics work', 'language': 'en'}
self.assertEqual(q.toWikibase(), q_dict)

@@ -641,7 +643,8 @@

def test_WbMonolingualText_equality(self):
"""Test WbMonolingualText equality."""
- q = pywikibot.WbMonolingualText(text='Thou shall test this!', language='en-gb')
+ q = pywikibot.WbMonolingualText(text='Thou shall test this!',
+ language='en-gb')
self.assertEqual(q, q)

def test_WbMonolingualText_fromWikibase(self):
@@ -731,7 +734,7 @@
non_data_page = Page(self.commons, 'File:Foo.jpg')
non_map_page = Page(self.commons, 'Data:TemplateData/TemplateData.tab')
regex = r"^Page must be in 'Data:' namespace and end in '\.map' " + \
- r"for geo-shape\.$"
+ r'for geo-shape\.$'
with self.assertRaisesRegex(ValueError, regex):
pywikibot.WbGeoShape(non_data_page, self.get_repo())
with self.assertRaisesRegex(ValueError, regex):
diff --git a/tests/xmlreader_tests.py b/tests/xmlreader_tests.py
index c2e5403..75bc121 100644
--- a/tests/xmlreader_tests.py
+++ b/tests/xmlreader_tests.py
@@ -101,16 +101,16 @@
talks = entries[2:4]

self.assertEqual(2, len(articles))
- self.assertTrue(all(entry.id == "19252820" for entry in articles))
- self.assertTrue(all(entry.title == u"Çullu, Agdam"
+ self.assertTrue(all(entry.id == '19252820' for entry in articles))
+ self.assertTrue(all(entry.title == 'Çullu, Agdam'
for entry in articles))
- self.assertTrue(all(u'Çullu, Quzanlı' in entry.text
+ self.assertTrue(all('Çullu, Quzanlı' in entry.text
for entry in articles))
- self.assertEqual(articles[0].text, u'#REDIRECT [[Çullu, Quzanlı]]')
+ self.assertEqual(articles[0].text, '#REDIRECT [[Çullu, Quzanlı]]')

self.assertEqual(2, len(talks))
- self.assertTrue(all(entry.id == "19252824" for entry in talks))
- self.assertTrue(all(entry.title == u"Talk:Çullu, Agdam"
+ self.assertTrue(all(entry.id == '19252824' for entry in talks))
+ self.assertTrue(all(entry.title == 'Talk:Çullu, Agdam'
for entry in talks))
self.assertEqual(talks[1].text, '{{DisambigProject}}')
self.assertEqual(talks[1].comment, 'proj')
@@ -118,11 +118,12 @@
def test_edit_summary_decoding(self):
"""Test edit summaries are decoded."""
entries = self._get_entries('pair-0.10.xml', allrevisions=True)
- articles = [entry for entry in entries if entry.ns == "0"]
+ articles = [entry for entry in entries if entry.ns == '0']

# It does not decode the edit summary
- self.assertEqual(articles[0].comment,
- u'moved [[Çullu, Agdam]] to [[Çullu, Quzanlı]]: dab')
+ self.assertEqual(
+ articles[0].comment,
+ 'moved [[Çullu, Agdam]] to [[Çullu, Quzanlı]]: dab')


if __name__ == '__main__': # pragma: no cover
diff --git a/tox.ini b/tox.ini
index 6375f51..eef3f32 100644
--- a/tox.ini
+++ b/tox.ini
@@ -231,7 +231,6 @@
scripts/welcome.py: N802
setup.py : T001
tests/* : N813
- tests/** : Q000
tests/api_tests.py: N802
tests/archivebot_tests.py: N802
tests/aspects.py: N802

To view, visit change 463939. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2103f6b21bca8710c1b0447033741ae5c0129704
Gerrit-Change-Number: 463939
Gerrit-PatchSet: 2
Gerrit-Owner: D3r1ck01 <alangiderick@gmail.com>
Gerrit-Reviewer: D3r1ck01 <alangiderick@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: jenkins-bot (75)