Opened 7 years ago
Closed 7 years ago
#29828 closed Uncategorized (invalid)
Use assertFalse and assertTrue instead of assertIs in "Writing your first Django app"
| Reported by: | Pablo Fernandez | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 2.1 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
In part 5 of "Writing your first Django app" (https://docs.djangoproject.com/en/2.1/intro/tutorial05/) the tests are using assertIs() instead of assertTrue() or assertFalse, which feel more appropriate.
Change History (3)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
| Has patch: | set |
|---|
Would it be better, since it's the tutorial, to introduce assertEqual, then progress to assertIs, and finally assertTrue / assertFalse ?
I realise this is a Django tutorial, not a unittest one, but I still feel it's better to show new developers the common tools and why they'd pick which.
comment:3 by , 7 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
assertIs() works differently from assertFalse() and assertTrue(). assertFalse() will pass if bool(value) is False and likewise for assertTrue().
I made a pull request here: https://github.com/django/django/compare/master...pupeno:patch-1