I think it actually is correct, because False is always False - so technically they are correct. However, that being said, I agree with you fully, as long as we change it to self.assertFalse(), which I think is the correct thing to do here.d
Regards,
Andréas
Den tors 25 okt. 2018 kl 21:42 skrev John Meyer <john.meyer@app-project.com>:
tests.py in the tutorial gives this example:--self.assertIs(future_question.was_published_recently(), False)This implies that assertIs tests equality of two booleans. The code works, but not for the right reason, as per the language documentation, the assertIs does not test equality but tests whether two object references point to the same object:assertIs(first, second, msg=None)assertIsNot(first, second, msg=None)
Test that first and second evaluate (or don't evaluate) to the same object.
New in version 3.1.This invites tests being written that are testing other kinds of equality and the results are not reliable. There are a few posts on StackOverflow indicating this confusion is causing confusion in the community. I want to update the tutorial to use assertEquals or assertTrue. I'm not in charge of the documentation so I'd settle for posting a bug request for this in the right place, if the point is valid.Thoughts?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4a3852af-4809-45b9-bd34-bcc37ee57966%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAK4qSCeq%2BDCPj1Br328tdZkJG9iJatcUDg4ToCPom7Sf%3DaYWOw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment