hjwp / Book-TDD-Web-Dev-Python

Book - TDD web dev with Python
https://www.obeythetestinggoat.com
Other
484 stars 175 forks source link

add early return to FT in chapter 13 #239

Closed Xronophobe closed 4 months ago

hjwp commented 4 months ago

the tests are failing because of that listing where we moved item.save() :

[role="sourcecode"]
.src/lists/tests/test_models.py
====
[source,python]
----
    with self.assertRaises(ValidationError):
        item.full_clean()
        item.save()
----
====
//19
// CSANAD: full_clean() should be executed before save() is called. It doesn't
//         make a difference here since the test DB is destroyed anyway, but
// we are actually saving an invalid item and only then calling full_clean().
// Which results in raising the correct error. But I think we should always
// show the correct order even when it doesn't matter: validation first and
// only then attempting save().

do you feel comfortable making the fix to the right commit in the chapter 13 branch?

hjwp commented 4 months ago

happy for you to merge when you've addressed the suggestions! i trust you to make them, don't need to double-check it again...