Testing dictionary results with doctest
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Fri Oct 31 11:28:46 EDT 2008
Joe Strout:
> What's the standard solution for this?
I don't know of any standard solution, I generally sort the items in
some ways, or add the result, that has to be equal:
>>> r = foo()
>>> r == {'object': 'rain', 'location': 'Spain', 'subloc': 'train'}
True
> Does doctest have some special way to tell it to consider the result
> as a dictionary rather than a string? Or something else?
A more general solution like this for sets/dics may become useful...
do you have any idea regarding how to design it?
Bye,
bearophile
More information about the Python-list
mailing list