It seems that the problem with any solution based on interpreting repr (especially when nothing in know about the object) is that there are just too many exceptions. Another approach might be to allow for a custom compare function to be defined on doctest. E.g., in the module to be tested:
Steven D'Aprano wrote:Ah, buggarit, too simple. I neglected to take into account the delimiters.
This approach doesn't try to be too clever: it's a dumb, understandable test which should fit in nicely with the other tests in doctest.OutputChecker.check_output, perhaps something like this:
if optionflags & IGNORE_WORD_ORDER:
if sorted(got.split()) == sorted(want.split()):
return True
Getting this right is harder than I thought, particularly with nested sets/dicts.
Still, I reckon a directive is the right approach.
--
Steven
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas