-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Assert that Serializer was initialized with data=something
in is_valid()
#2228
Comments
@loic, how are you doing that from the interpreter shell when testing the docs? Are you going through the process of setting up the snippet code? Just wondering to see if you have a github project I can clone to try and recreate this issue. |
You need to instantiate your serializer with data=snippet, otherwise it is assumed to be an instance, not data.
|
@vccabral I used the model and serializer from the tutorial part 1. Obviously the docs don't recommend to do this, I was just experimenting. @xordoquy sorry if I wasn't clear, this is an enhancement proposal, not a bug report. I propose that This was discussed a few days ago on IRC:
|
@loic what is the "django-rest-framework" unit test way to do an self.assertRaises? |
@vccabral we are using py.test so http://pytest.org/latest/assert.html#assertions-about-expected-exceptions |
@xordoquy thanks! |
The text was updated successfully, but these errors were encountered: