You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Below several NIT ideas for small improvements in Django Tutorial Part 10 'Testing a Django web application' considering PEP 8 guidelines.
In section 'LocalLibrary tests'/'Forms' there is:
self.assertTrue(form.fields['renewal_date'].label == None or form.fields['renewal_date'].label == 'renewal date')
While I believe there should be:
self.assertTrue(form.fields['renewal_date'].label is None or form.fields['renewal_date'].label == 'renewal date')
Explaination:
Comparison with None performed with equality operator. That type of compression should be done with 'is'. PEP 8: comparison to None should be 'if cond is None'.
In section 'LocalLibrary tests'/'Models' there is:
def test_date_of_death_label(self):
author=Author.objects.get(id=1)
While I believe there should be:
def test_date_of_death_label(self):
author = Author.objects.get(id=1)
Explaination:
PEP 8: Missing whitespace around operator (=)
0 commit comments