Joe Strout <[EMAIL PROTECTED]> writes:
> >>> t.match( "The rain in Spain falls mainly on the train." )
> {'object': 'rain', 'location': 'Spain', 'subloc': 'train'}
You can compare dictionaries for equality:
>>> t.match( "The rain in Spain falls mainly on the train." ) == \
{'o
On Oct 31, 2:43 pm, Joe Strout <[EMAIL PROTECTED]> wrote:
> I love doctest -- the way it combines documentation with verification
> seems elegant and useful, and most of the time it's simple and easy to
> use.
>
> But I've run into a bit of a snag trying to test a method that returns
> a dict
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 wa
Joe Strout <[EMAIL PROTECTED]> wrote:
> What's the standard solution for this? Should I iterate over the
> sorted keys and print those out instead? Is there some built-in
> method somewhere that will print a dictionary in a reliable order?
> Does doctest have some special way to tell it t