I think that printing the result of bool(effective_result==expected_result) 
is sufficient for testing purposes, and has the advantage of testing 
mathematical equality, not only string equality.

You may want to be more explicit when failing : you may try (something 
like) :

res=bool(effective_result==expected_result)
if not res: res="Expected : {} \nEffective : {}".format(expected_result, 
effective_result)
print res

That way, you can expect "True" as the result f the doctest, and still get 
hints about the failure if it fails.

What do you think ?

--
Emmanuel Charpentier


Le mercredi 13 décembre 2017 05:15:30 UTC+1, Michael Orlitzky a écrit :
>
> On 12/12/2017 09:30 AM, Erik Bray wrote: 
> > 
> > Another workaround that's so obvious I smacked myself on the head is 
> > that for many cases, particularly objects that have a small dict in 
> > their representation, is to simply change the __repr__ so that its 
> > dict is always displayed sorted.  If the order doesn't matter anyways 
> > that it doesn't hurt to impose an order at least for the __repr__.  I 
> > doubt there are many cases where this should have any performance 
> > impact either. 
> > 
>
> It makes the user experience worse (i.e. slower) for the sole benefit of 
> a test suite used only non-interactively by developers. That's my slight 
> moral objection, but sometimes it may still be the best option. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to