Message306510
`doctest` is intended to be anal - there are few things more pointlessly confusing for a user than to see docs that don't match what they actually see when they run the doc's examples. "Is it a bug? Did I do it wrong? Why can't they document what it actually does?! ..."
Things like +ELLIPSIS are intended for cases where the output is _known_ to vary across platforms or runs in ways that can't otherwise be easily hidden (like output that embeds the `id()` of an object), or where only a relatively tiny bit of enormous output is actually interesting.
When someone wants unittest's `assertEqual()`, they should use unittest ;-)
Although that functionality is already easily handled; for example, here's the OP's first example rewritten to be independent of the dict's representation ordering:
>>> dict_fun() == {'foo': 1, 'bar': 2}
True
Now it's testing what you want to test: that the results of the expressions on both sides of `==` compare equal. And this is, to me, clearer on the face of it than introducing a new flag. |
|
Date |
User |
Action |
Args |
2017-11-19 18:58:27 | tim.peters | set | recipients:
+ tim.peters, rhettinger, r.david.murray, serhiy.storchaka, jbakker, Tomáš Petříček |
2017-11-19 18:58:27 | tim.peters | set | messageid: <1511117907.83.0.213398074469.issue32042@psf.upfronthosting.co.za> |
2017-11-19 18:58:27 | tim.peters | link | issue32042 messages |
2017-11-19 18:58:27 | tim.peters | create | |
|