[issue34404] test_time incorrectly defined

2018-08-21 Thread Michael Osipov


Change by Michael Osipov <1983-01...@gmx.net>:


--
versions: +Python 3.6, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34404] test_time incorrectly defined

2018-08-20 Thread Paul Ganssle


Change by Paul Ganssle :


--
nosy: +p-ganssle

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34404] test_time incorrectly defined

2018-08-14 Thread Michael Osipov


Michael Osipov <1983-01...@gmx.net> added the comment:

The proper format for int < 0 must be "%05d".

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34404] test_time incorrectly defined

2018-08-14 Thread Michael Osipov


New submission from Michael Osipov <1983-01...@gmx.net>:

I see a test failure on HP-UX:
> test_negative (test.test_time.TestStrftime4dyear) ... FAIL
> ==
> FAIL: test_negative (test.test_time.TestStrftime4dyear)
> --
> Traceback (most recent call last):
>   File "/var/osipovmi/cpython/Lib/test/test_time.py", line 687, in 
> test_negative
> return super().test_negative()
>   File "/var/osipovmi/cpython/Lib/test/test_time.py", line 713, in 
> test_negative
> self.assertEqual(self.yearstr(-1), self._format % -1)
> AssertionError: '-0001' != '-001'
> - -0001
> ?  -
> + -001

The bug is in the test class, not cause by HP-UX.
Lib/test/test_time.py:713 says "self.assertEqual(self.yearstr(-1), self._format 
% -1)" where self._format is set in line 654 to "_format = '%04d'" because
> Python 3.7.0+ (heads/3.7-dirty:ea8835fb30, Aug 14 2018, 14:44:19) [C] on 
> hp-ux11
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import time
> >>> time.strftime('%Y', (1,) + (0,) * 8)
> '0001'

Unfortunately, the zero padding in printf() applies to the entire string 
length. So
> >>> "%+04d" % -1
> '-001'

on HP-UX, Linux and FreeBSD.

The format string must add an additional zero for negative numbers.

--
components: Tests
messages: 323519
nosy: michael-o
priority: normal
severity: normal
status: open
title: test_time incorrectly defined
type: behavior
versions: Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com