Xavier de Gaye <xdeg...@gmail.com> added the comment:

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)

----------
nosy: +xdegaye

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35066>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to