Skip to content

converted primary key relations test asserts to pytest #4709

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

Merged
merged 4 commits into from
Nov 28, 2016

Conversation

auvipy
Copy link
Member

@auvipy auvipy commented Nov 28, 2016

not sure about how assertNumqueries should be converted
not sure about self.assertNotIn('target', serializer.validated_data)

and self.assertTrue(serializer.is_valid(), serializer.errors) ?

@xordoquy can you suggest?

@xordoquy
Copy link
Collaborator

self.assertTrue(serializer.is_valid(), serializer.errors)

would be:

assert serializer.is_valid(), serializer.errors

self.assertNotIn('target', serializer.validated_data)

would be:

assert 'target' not in serializer.validated_data

@auvipy
Copy link
Member Author

auvipy commented Nov 28, 2016

thanks done.

@tomchristie
Copy link
Member

Yup, looks good - thanks!

@tomchristie tomchristie merged commit 42d6098 into encode:master Nov 28, 2016
@auvipy auvipy deleted the pytest0 branch November 28, 2016 09:43
@tomchristie tomchristie added this to the 3.5.4 Release milestone Nov 28, 2016
@auvipy
Copy link
Member Author

auvipy commented Nov 28, 2016

I need another help fro you. any cheetsheet for unittest to pytest asserts? that would be very helpful and less time consuming for all of us i guess.

@tomchristie
Copy link
Member

Nothing I know of.

@xordoquy
Copy link
Collaborator

Neither do I. Most are just straight forward. The only one I've seen that doesn't match that pattern is the assertNumqueries. pytest-django may provide one alternative though, need to check

@auvipy
Copy link
Member Author

auvipy commented Nov 28, 2016

OK. Im OK with most of them but some are not. I will check out

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

Successfully merging this pull request may close these issues.

3 participants