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

Failing test for ChoiceField eagerly evaluating choices #1648

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from django_filters.fields import (
BaseCSVField,
BaseRangeField,
ChoiceField,
DateRangeField,
DateTimeRangeField,
IsoDateTimeField,
Expand Down Expand Up @@ -58,6 +59,14 @@ def test_clean(self):
self.assertIsNone(f.clean([]))


class ChoiceFieldTests(TestCase):
def test_callable_choices_is_lazy(self):
def choices():
self.fail("choices should not be called during initialization")

ChoiceField(choices=choices)


class DateRangeFieldTests(TestCase):
def test_field(self):
f = DateRangeField()
Expand Down