MCPcopy
hub / github.com/django/django / test_values_wrong_alias

Method test_values_wrong_alias

tests/annotations/tests.py:1593–1601  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1591 Book.objects.alias(**{crafted_alias: FilteredRelation("authors")})
1592
1593 def test_values_wrong_alias(self):
1594 expected_message = (
1595 "Cannot resolve keyword 'alias_typo' into field. Choices are: %s"
1596 )
1597 alias_fields = ", ".join(
1598 sorted(["my_alias"] + list(get_field_names_from_opts(Book._meta)))
1599 )
1600 with self.assertRaisesMessage(FieldError, expected_message % alias_fields):
1601 Book.objects.alias(my_alias=F("pk")).order_by("alias_typo")

Callers

nothing calls this directly

Calls 6

FClass · 0.90
assertRaisesMessageMethod · 0.80
order_byMethod · 0.80
aliasMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected