STINNER Victor <vstin...@python.org> added the comment:

Oh wait, I'm now confused by the method names. In Python 3.10, the correct 
names at:

* float.__getformat__() <= 4 underscores
* float.__set_format__() <= 5 underscores

It's even more confusing because the "set format" is only used in one place: 
test_float, and test_float uses... __setformat__() (4 underscores).

A typo a was introduced in Python 3.7 by:

commit b5c51d3dd95bbfde533655fb86ac0f96f771ba7b
Author: Serhiy Storchaka <storch...@gmail.com>
Date:   Sat Mar 11 09:21:05 2017 +0200

    bpo-20185: Convert float object implementation to Argument Clinic. (#543)
    
    Based on patch by Vajrasky Kok.

Since Python 3.7, the 4 "set format" tests are simply skipped!

$ ./python -m test -v test_float
(...)
test_getformat (test.test_float.FormatFunctionsTestCase) ... skipped 'requires 
__setformat__'
test_setformat (test.test_float.FormatFunctionsTestCase) ... skipped 'requires 
__setformat__'
(...)
test_double_specials_dont_unpack (test.test_float.UnknownFormatTestCase) ... 
skipped 'requires __setformat__'
test_float_specials_dont_unpack (test.test_float.UnknownFormatTestCase) ... 
skipped 'requires __setformat__'
(...)


Moreover, unittest.mock supports mocking __setformat__() (4 underscores).

----------

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

Reply via email to