jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/605889 )
Change subject: [tests] Rename logentry_tests.py to logentries_tests.py ......................................................................
[tests] Rename logentry_tests.py to logentries_tests.py
Rename logentry_tests.py to logentries_tests.py because the logentries are defined in logentries.py and prevent name cluttering.
Change-Id: Ie625789e7b69d92f678268629b306dc235f3794a --- M tests/__init__.py R tests/logentries_tests.py M tox.ini 3 files changed, 14 insertions(+), 17 deletions(-)
Approvals: Dvorapa: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/__init__.py b/tests/__init__.py index 6b00ec7..5bbbf8b 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -99,7 +99,7 @@ 'interwiki_graph', 'interwiki_link', 'link', - 'logentry', + 'logentries', 'login', 'mediawikiversion', 'namespace', diff --git a/tests/logentry_tests.py b/tests/logentries_tests.py similarity index 95% rename from tests/logentry_tests.py rename to tests/logentries_tests.py index d723942..37a376a 100644 --- a/tests/logentry_tests.py +++ b/tests/logentries_tests.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Test logentries module.""" # -# (C) Pywikibot team, 2015-2019 +# (C) Pywikibot team, 2015-2020 # # Distributed under the terms of the MIT license. # @@ -14,9 +14,7 @@ from pywikibot.exceptions import HiddenKeyError from pywikibot.logentries import ( LogEntryFactory, OtherLogEntry, UserTargetLogEntry) -from pywikibot.tools import ( - UnicodeType as unicode, -) +from pywikibot.tools import UnicodeType
from tests import unittest_print from tests.aspects import ( @@ -75,9 +73,9 @@ self.assertNotIn('params', logentry.data) else: self.assertNotIn(logentry.type(), logentry.data) - self.assertIsInstance(logentry.action(), unicode) + self.assertIsInstance(logentry.action(), UnicodeType) try: - self.assertIsInstance(logentry.comment(), unicode) + self.assertIsInstance(logentry.comment(), UnicodeType) except HiddenKeyError as e: self.assertRegex( str(e), @@ -103,7 +101,7 @@ else: self.assertRaises(KeyError, logentry.page) self.assertEqual(logentry.type(), logtype) - self.assertIsInstance(logentry.user(), unicode) + self.assertIsInstance(logentry.user(), UnicodeType) self.assertGreaterEqual(logentry.logid(), 0)
@@ -164,7 +162,7 @@
"""Test LogEntry properties specific to their action."""
- def test_BlockEntry(self, key): + def test_block_entry(self, key): """Test BlockEntry methods.""" # only 'block' entries can be tested for logentry in self.site.logevents(logtype='block', total=5): @@ -184,23 +182,23 @@ self.assertIsNone(logentry.duration()) break
- def test_RightsEntry(self, key): + def test_rights_entry(self, key): """Test RightsEntry methods.""" logentry = self._get_logentry('rights') self.assertIsInstance(logentry.oldgroups, list) self.assertIsInstance(logentry.newgroups, list)
- def test_MoveEntry(self, key): + def test_move_entry(self, key): """Test MoveEntry methods.""" logentry = self._get_logentry('move') self.assertIsInstance(logentry.target_ns, pywikibot.site.Namespace) self.assertEqual(logentry.target_page.namespace(), logentry.target_ns.id) - self.assertIsInstance(logentry.target_title, unicode) + self.assertIsInstance(logentry.target_title, UnicodeType) self.assertIsInstance(logentry.target_page, pywikibot.Page) self.assertIsInstance(logentry.suppressedredirect(), bool)
- def test_PatrolEntry(self, key): + def test_patrol_entry(self, key): """Test PatrolEntry methods.""" logentry = self._get_logentry('patrol') self.assertIsInstance(logentry.current_id, int) @@ -263,7 +261,7 @@
"""Test cases for deprecated logentry methods."""
- def test_MoveEntry(self, key): + def test_move_entry(self, key): """Test deprecated MoveEntry methods.""" logentry = self._get_logentry('move') self.assertIsInstance(logentry.new_ns(), int) @@ -274,7 +272,7 @@ self.assertOneDeprecationParts( 'pywikibot.logentries.MoveEntry.new_title', 'target_page')
- def test_LogEntry_title(self, key): + def test_logentry_title(self, key): """Test title and page return the same instance.""" # Request multiple log entries in the hope that one might have no # title entry @@ -287,7 +285,7 @@ self.assertRaises(KeyError, logentry.title) self.assertOneDeprecation()
- def test_getMovedTarget(self, key): + def test_get_moved_target(self, key): """Test getMovedTarget method.""" # main page was moved around if self.sites[key]['target'] is None: diff --git a/tox.ini b/tox.ini index 58bada6..7e7c361 100644 --- a/tox.ini +++ b/tox.ini @@ -219,7 +219,6 @@ tests/interwiki_link_tests.py: N802 tests/isbn_tests.py: N802 tests/link_tests.py: N802 - tests/logentry_tests.py: N802, N813 tests/login_tests.py: N802 tests/namespace_tests.py: N802, N813 tests/page_tests.py : E241, N802, N813
pywikibot-commits@lists.wikimedia.org