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

Allow assertQuerysetEqual to compare with a collection of values #1201

Merged
merged 1 commit into from Oct 24, 2022

Conversation

flaeppe
Copy link
Member

@flaeppe flaeppe commented Oct 24, 2022

It should be possible to do e.g.

self.assertQuerysetEqual(
    MyModel.objects.all(),
    [(1, timezone.now(), Decimal(1337), 1337), ...],
    transform=attrgetter("pk", "created_at", "some_decimal", "some_int", ...),
)

(Not just compare with pk's, which I think the old hints suggested?)

@flaeppe flaeppe changed the title Allow assertQuerySetEqual to compare with a collection of values Allow assertQuerysetEqual to compare with a collection of values Oct 24, 2022
Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

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

Thanks!

@sobolevn sobolevn merged commit adb2624 into typeddjango:master Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants