It wasn't a decade old convention when python 2.1 added the unittest package a decade ago, to be fair.
>
> What's your position ?
>
> Regards
>
> --
> You received this message because you are subscribed to the Google Groups "Django developers" group.
> To post to this group, send email to django-d...@googlegroups.com.
> To unsubscribe from this group, send email to django-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
Hi,
a) Does this matter at all? I mean what's the difference? You ask if they are equal and if not you get an error ;)
b) I think it's the wrong mailing list for design decisions python took…
It certainly wasn't intentionally reversed from the "convention"; it's
an artefact of Python's documentation not making the ordering
distinction, reinforced by the foo != bar output format that was
referred to.
Should the examples be changed? For my money, I don't think it makes a
whole lot of sense to adopt a convention that isn't reinforced by
Python at a language level.
For what it's worth, I also think the "convention" is bass ackwards...
you write "if variable == value", but you write "assertEqual(value,
variable)"? Where's the consistency in that?
Yours,
Russ Magee %-)
--
You received this message because you are subscribed to the Google Groups "Django developers" group.
To post to this group, send email to django-d...@googlegroups.com.
To unsubscribe from this group, send email to django-develop...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
My guess is that the choice is somehow connected to Yoda conditions,
where you actually write:
if(5 == x) { ... }
to avoid assigning 5 to x by mistake. If you write all your conditions
like that, then the assert order makes sense.
But Python thankfully doesn't need any of that Jedi stuff.
--
Łukasz Rekucki
My Python 2.7 says:
self.assertEqual(result['active'], 2)
AssertionError: 1 != 2
So, no. The message in Python is order agnostic.
--
Łukasz Rekucki
It isn't 'enforced' by Python at a language level, but as dmoisset stated, it makes the failure messages actually make sense:"Expected 'foo', got 'bar'".