Message365422
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. |
|
Date |
User |
Action |
Args |
2020-03-31 20:37:44 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, mark.dickinson |
2020-03-31 20:37:44 | serhiy.storchaka | set | messageid: <1585687064.58.0.0478382370232.issue40129@roundup.psfhosted.org> |
2020-03-31 20:37:44 | serhiy.storchaka | link | issue40129 messages |
2020-03-31 20:37:44 | serhiy.storchaka | create | |
|