fixing unique together validator for fields with source by anveshagarwal · Pull Request #7005 · encode/django-rest-framework (original) (raw)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @anveshagarwal. Please take this feedback constructively, but there is a lot wrong with the PR. I assume a lot of the issues below would have been caught, however, because test_read_only_default doesn't contain an __init__.py, it's not a proper python package. So, the test module isn't discovered and the tests aren't executed. This is why it's often suggested that you write your tests before the fix.

If you write the test first and see the failure, you know two things:

If you fix the bug first then write the tests second, you can't guarantee the above.