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

2017-11-15 Thread Tomáš Petříček
New submission from Tomáš Petříček : Would there be an interest and possibility to add an option to the doctest module to compare values instead of reprs? The idea is that the expected value would be eval'ed prior to comparison if this option was enabled. Motivation for this option

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

2017-11-15 Thread Tomáš Petříček
Tomáš Petříček added the comment: Related to https://bugs.python.org/issue3332 -- ___ Python tracker <https://bugs.python.org/issue32042> ___ ___ Python-bug

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

2017-11-15 Thread Tomáš Petříček
Tomáš Petříček added the comment: This option can be seen as a more general case of the options already available which lift the requirement of exact representation match (True for 1, normalize whitespace etc.). It would enable easier testing of relevant behavior instead of repr's arti

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

2017-11-15 Thread Tomáš Petříček
Tomáš Petříček added the comment: The following tests then succeed: def str_fun(): """ >>> str_fun() 'foo' >>> str_fun() "foo" >>> str_fun() '''foo''' ""&qu

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

2017-11-19 Thread Tomáš Petříček
Tomáš Petříček added the comment: I find the idea of combining documentation with examples and unit testing appealing. I see that this was not the original purpose of doctest but it seems to me as a reasonable use case for doctest. >>> dict_fun() == {'foo': 1, 'bar&#x