Dealing with dicts in doctest
On Thu, 05 Jul 2018 19:56:59 +0100, MRAB wrote:
> What about sorting the items?
> def func(arg):
> """blah blah blah
> >>> sorted(func(1).items())
> [('a', 1), ('b', 2), ('c', 3)]
Hmmm.... it still has the disadvantage of putting the emphasis on the
sorted() function instead of the function being doctested, and obscuring
the fact that it returns a dict. But I actually like that.
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson