tests.py in the tutorial <https://docs.djangoproject.com/en/2.1/intro/tutorial05/> 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 <https://docs.python.org/3/library/unittest.html#test-cases>, 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 <http://www.google.com/search?q=django+assertIs+stackoverflow> 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? <https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertIs> <https://docs.python.org/3/library/unittest.html#unittest.TestCase.assertIsNot> -- 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+unsubscr...@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.