Skip to content

Commit 5a03f5a

Browse files
committed
Add test to trigger calling in_bulk() on partial function
Related PR: #2889 Related commit: #cd8368b
1 parent f811f81 commit 5a03f5a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/queryset/test_queryset.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4016,6 +4016,28 @@ def objects(klass, queryset):
40164016
assert 0 == Foo.objects.count()
40174017
assert 1 == Bar.objects.count()
40184018

4019+
def test_select_related_when_referenced_has_custom_queryset_manager(self):
4020+
class Foo(Document):
4021+
@queryset_manager
4022+
def objects(klass, queryset, arg1=None, arg2=None, **kwargs):
4023+
return queryset(**kwargs)
4024+
4025+
class Bar(Document):
4026+
foo = ReferenceField(Foo)
4027+
4028+
Foo.drop_collection()
4029+
Bar.drop_collection()
4030+
4031+
foo = Foo()
4032+
foo.save()
4033+
4034+
Bar(foo=foo).save()
4035+
4036+
Bar.objects().select_related()
4037+
4038+
assert 1 == Foo.objects().count()
4039+
assert 1 == Bar.objects().count()
4040+
40194041
def test_query_value_conversion(self):
40204042
"""Ensure that query values are properly converted when necessary."""
40214043

0 commit comments

Comments
 (0)