[issue22032] Use __qualname__ together with __module__

STINNER Victor report at bugs.python.org
Thu Sep 24 09:58:00 CEST 2015


STINNER Victor added the comment:

Barry, Robert: I'm sorry that the change broke tests, but tests should not rely on the exact representation. They can test type(obj).__name__ for example.

Barry: "people should be aware that this can break doctests"

Some years ago, I was a big fan of doctest. But with the release of Python 3, I now think that it's a big mess. It's very hard to write reliable doctests. Most doctests rely on the exact representation of objects and subtle details which break on minor Python releases.

IHMO it's better to write classic unittest tests and use functions like assertEqual(). By the way, the unittest made great progress last years, it shows better error message when a test fails.

Maybe we should document better such changes in the https://docs.python.org/dev/whatsnew/3.5.html#porting-to-python-3-5 section ?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22032>
_______________________________________


More information about the Python-bugs-list mailing list