Author xdegaye
Recipients belopolsky, eric.smith, matrixise, miss-islington, mjsaah, p-ganssle, pablogsal, terry.reedy, thatiparthy, vstinner, xdegaye, xtreak
Date 2019-03-18.11:39:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552909191.02.0.153707287371.issue35066@roundup.psfhosted.org>
In-reply-to
Content
The new test added by changeset 454b3d4ea246e8751534e105548d141ed7b0b032 fails on Android:

======================================================================
FAIL: test_strftime_trailing_percent (test.datetimetester.TestDate_Pure)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/data/local/tmp/python/lib/python3.8/test/datetimetester.py", line 1400, in test_strftime_trailing_percent
    self.assertEqual(t.strftime('%'), '%')
AssertionError: '' != '%'
+ %

The implementation of strftime() on Android does not seem to be posix compliant:
>>> import time
>>> time.strftime('A%Q')
'AQ'
>>> time.strftime('%')
''

However the new test is not about testing posix compliance and the following patch fixes this test failure on Android while still testing that the changes made by this changeset cause a trailing '%' to not raise the exception anymore:

diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py
index 715f0ea6b4..ae1a97f0b4 100644
--- a/Lib/test/datetimetester.py
+++ b/Lib/test/datetimetester.py
@@ -1397,8 +1397,10 @@ class TestDate(HarmlessMixedComparison, unittest.TestCase):
             _time.strftime('%')
         except ValueError:
             self.skipTest('time module does not support trailing %')
-        self.assertEqual(t.strftime('%'), '%')
-        self.assertEqual(t.strftime("m:%m d:%d y:%y %"), "m:03 d:02 y:05 %")
+        trailing_percent = _time.strftime('%')
+        self.assertEqual(t.strftime('%'), trailing_percent)
+        self.assertEqual(t.strftime("m:%m d:%d y:%y %"),
+                         "m:03 d:02 y:05 %s" % trailing_percent)
 
     def test_format(self):
         dt = self.theclass(2007, 9, 10)
History
Date User Action Args
2019-03-18 11:39:51xdegayesetrecipients: + xdegaye, terry.reedy, belopolsky, vstinner, eric.smith, matrixise, thatiparthy, p-ganssle, pablogsal, miss-islington, xtreak, mjsaah
2019-03-18 11:39:51xdegayesetmessageid: <1552909191.02.0.153707287371.issue35066@roundup.psfhosted.org>
2019-03-18 11:39:51xdegayelinkissue35066 messages
2019-03-18 11:39:50xdegayecreate