New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:

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.

----------
components: Tests
messages: 365422
nosy: mark.dickinson, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Add test classes for custom __index__, __int__, __float__ and __complex__
type: enhancement
versions: Python 3.9

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

Reply via email to