The reason why assertIs is used instead of assertFalse is that the latter actually tests for falsy values and can sometimes hide bugs.
self.assertIs(future_question.was_published_recently(), bool)
self.assertEquals(future_question.was_published_recently(), True)
This would be self-documenting in the sense it would help new folks to avoid using assertIs as a general equality check on non-boolean types. Would this be okay or would it break with a best practice?
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/467ff87a-0e19-4784-868d-549826dcd41a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment