jenkins-bot has submitted this change and it was merged.
Change subject: [FEAT] page_tests: Page repr encoding test ......................................................................
[FEAT] page_tests: Page repr encoding test
The repr should be decodable using the ASCII codec but the Page instance isn't actually.
Bug: T66958 Change-Id: Ic2a7db2dac6793faf2521d2717662f3ee1b14eca --- M tests/page_tests.py 1 file changed, 10 insertions(+), 0 deletions(-)
Approvals: John Vandenberg: Looks good to me, approved jenkins-bot: Verified
diff --git a/tests/page_tests.py b/tests/page_tests.py index 7460b2c..6504b45 100644 --- a/tests/page_tests.py +++ b/tests/page_tests.py @@ -15,6 +15,8 @@ from pywikibot import InvalidTitle import pywikibot.page
+from pywikibot.tools import PY2 + from tests.aspects import ( unittest, TestCase, DefaultSiteTestCase, SiteAttributeTestCase, DeprecationTestCase, @@ -563,6 +565,14 @@ self.assertEqual(u'%r' % page, "Page(b'\xc5\x8c')") self.assertEqual(u'{0!r}'.format(page), "Page(b'\xc5\x8c')")
+ @unittest.skipIf(not PY2, 'Python 2 specific test') + @unittest.expectedFailure + def test_ASCII_comatible(self): + """Test that repr returns ASCII compatible bytes in Python 2.""" + page = pywikibot.Page(self.site, 'รค') + # Bug T95809, the repr in Python 2 should be decodable as ASCII + repr(page).decode('ascii') +
class TestPageBotMayEdit(TestCase):