This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: test_format:test_locale fails when locale does not set grouping in thousands
Type: behavior Stage: resolved
Components: Tests Versions: Python 3.10
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lys.nikolaou, miss-islington
Priority: normal Keywords: patch

Created on 2020-10-31 22:39 by lys.nikolaou, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 23067 merged lys.nikolaou, 2020-10-31 22:43
PR 23110 merged miss-islington, 2020-11-02 15:27
PR 23111 merged lys.nikolaou, 2020-11-02 15:29
Messages (4)
msg380104 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-10-31 22:39
test_format:test_locale tests for the existence of the thousands separator in a formatted number.

However, my locale does not expect/enforce (not sure what the correct term is) grouping the number in thousands, which leads to the test (and consequently the whole test suite) failing:

➜  cpython git:(test-format-locale-fix) ./python                  
Python 3.10.0a1+ (heads/master:3bf0d02f28, Oct 31 2020, 22:42:09) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'LC_CTYPE=en_US.UTF-8;LC_NUMERIC=el_GR.UTF-8;LC_TIME=el_GR.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=el_GR.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=el_GR.UTF-8;LC_NAME=el_GR.UTF-8;LC_ADDRESS=el_GR.UTF-8;LC_TELEPHONE=el_GR.UTF-8;LC_MEASUREMENT=el_GR.UTF-8;LC_IDENTIFICATION=el_GR.UTF-8'
>>> format(123456789, 'n')
'123456789'
>>> locale.localeconv()['grouping']
[]

I guess the fix here is to check whether grouping is empty or not in test_locale.
msg380230 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-11-02 15:27
New changeset 301822859b3fc34801a06f1090d62f9f2ee5b092 by Lysandros Nikolaou in branch 'master':
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
https://github.com/python/cpython/commit/301822859b3fc34801a06f1090d62f9f2ee5b092
msg380232 - (view) Author: miss-islington (miss-islington) Date: 2020-11-02 15:46
New changeset 1e96de9ed4b1ca96d345b7e309a8fe3802638f4a by Miss Skeleton (bot) in branch '3.8':
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
https://github.com/python/cpython/commit/1e96de9ed4b1ca96d345b7e309a8fe3802638f4a
msg380235 - (view) Author: Lysandros Nikolaou (lys.nikolaou) * (Python committer) Date: 2020-11-02 15:52
New changeset 723e21a8e79815ae77474d1f21b9847b9c9bdbeb by Lysandros Nikolaou in branch '3.9':
bpo-42224: Fix test_format when locale does not expect number grouping (GH-23067)
https://github.com/python/cpython/commit/723e21a8e79815ae77474d1f21b9847b9c9bdbeb
History
Date User Action Args
2022-04-11 14:59:37adminsetgithub: 86390
2020-11-02 21:39:30lys.nikolaousetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2020-11-02 15:52:04lys.nikolaousetmessages: + msg380235
2020-11-02 15:46:09miss-islingtonsetmessages: + msg380232
2020-11-02 15:29:12lys.nikolaousetpull_requests: + pull_request22028
2020-11-02 15:27:46miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request22027
2020-11-02 15:27:40lys.nikolaousetmessages: + msg380230
2020-10-31 22:43:53lys.nikolaousetkeywords: + patch
stage: patch review
pull_requests: + pull_request21986
2020-10-31 22:39:36lys.nikolaoucreate