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.

Author serhiy.storchaka
Recipients mark.dickinson, serhiy.storchaka
Date 2020-03-31.20:37:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585687064.58.0.0478382370232.issue40129@roundup.psfhosted.org>
In-reply-to
Content
There are many tests for int-like objects (which implement custom __index__ or __int__ methods) in different files. There are less tests for float-like objects (with the __float__ method). There are even tests for complex-like (with the __complex__ method) in different files. To simplify maintaining old tests and adding new tests I propose to add general test classes with custom methods __index__, __int__, __float__ or __complex__ which return the specified value or raise an exception. There is already one similar general class: FakePath.

It could be done using unittest.mock, but Mock objects are much more complex and has too much magic, so they can have different behavior than simpler classes with a single special method.
History
Date User Action Args
2020-03-31 20:37:44serhiy.storchakasetrecipients: + serhiy.storchaka, mark.dickinson
2020-03-31 20:37:44serhiy.storchakasetmessageid: <1585687064.58.0.0478382370232.issue40129@roundup.psfhosted.org>
2020-03-31 20:37:44serhiy.storchakalinkissue40129 messages
2020-03-31 20:37:44serhiy.storchakacreate