Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page 226: lists/tests/test_model.py #115

Open
HelloThisIsFlo opened this issue Nov 14, 2019 · 0 comments
Open

Page 226: lists/tests/test_model.py #115

HelloThisIsFlo opened this issue Nov 14, 2019 · 0 comments

Comments

@HelloThisIsFlo
Copy link

It's a bit confusing when you write:

item.save()
item.full_clean()

while the name of the tests is test_cannot_save_empty_list_item
Because in the end... the item is saved. It can be verified by putting the following right after the with block:

self.assertEqual(Item.objects.count(), 0)

Two potential solutions

  • Maybe just swapping the order of the 2 lines might make things less confusing :)

    item.full_clean()
    item.save()
  • Another solution would be to simply rename the tests from test_cannot_save_empty_list_item to test_cannot_validate_empty_list_item
    And removing the call to save() alltogether.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant