Skip to content

Commit 5fd6b23

Browse files
add comments
1 parent d480a9d commit 5fd6b23

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/queryset/test_queryset.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4685,11 +4685,13 @@ class Container(Document):
46854685
source = EmbeddedDocumentField(EmbeddedModelA)
46864686
target = EmbeddedDocumentField(EmbeddedModelA, null=True)
46874687

4688+
# Create one with both values
46884689
Container(
46894690
source=EmbeddedModelA(designator="value1"),
46904691
target=EmbeddedModelB(designator="value2"),
46914692
).save()
46924693

4694+
# Create one with a null target, but the source value will match the query
46934695
Container(
46944696
source=EmbeddedModelA(designator="value1"),
46954697
target=None,
@@ -4698,10 +4700,9 @@ class Container(Document):
46984700
queryset = Container.objects.filter(
46994701
Q(source__designator="value1") | Q(target__designator="value2")
47004702
).values_list("source__designator", "target__designator")
4701-
# This should not raise an AttributeError on NoneType for the second Container's
4702-
# target__designator
4703+
# This should not raise an AttributeError on NoneType for the second Container's target__designator
47034704
values = list(queryset)
4704-
assert values == ["value1", "value2"]
4705+
assert values == ["value1", "value2", None]
47054706

47064707
def test_scalar_decimal(self):
47074708
from decimal import Decimal

0 commit comments

Comments
 (0)