[issue32042] Option for comparing values instead of reprs in doctest

Serhiy Storchaka report at bugs.python.org
Sun Nov 19 13:25:35 EST 2017


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

I concur with Raymond. Doctest should test the representation, not value.

But I think it would be nice to support insignificant variations of the representation. Tracebacks already are treated specially, and different doctest options allow to ignore particular details. Of course ignoring the whole content of the dictionary will be not very useful.

   >>> dict_fun() # doctest: +ELLIPSIS
   {...}

But maybe some option should make accepting some permutations in the output. E.g.

   >>> dict_fun() # doctest: +PERMUTATION
   {<'foo': 1>, <'bar': 2>}

should accept both "{'foo': 1, 'bar': 2}" and "{'bar': 2, 'foo': 1}".

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32042>
_______________________________________


More information about the Python-bugs-list mailing list