diff options
author | David Szotten <davidszotten@gmail.com> | 2015-03-15 19:07:39 +0000 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2015-03-24 11:42:53 -0400 |
commit | 80e3444eca045799cc40e50c92609e852a299d38 (patch) | |
tree | 317a51482dedce4ded0f40d7a55f3d5336c22770 /tests/model_fields | |
parent | 118cae2df8c89b63a2dcecab0728e6199f101fa1 (diff) | |
download | django-80e3444eca045799cc40e50c92609e852a299d38.tar.gz |
Fixed #24483 -- Prevented keepdb from breaking with generator choices.
If Field.choices is provided as an iterator, consume it in __init__ instead
of using itertools.tee (which ends up holding everything in memory
anyway). Fixes a bug where deconstruct() was consuming the iterator but
bypassing the call to `tee`.
Diffstat (limited to 'tests/model_fields')
-rw-r--r-- | tests/model_fields/tests.py | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py index a8291b6e71..80d35d18e1 100644 --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -445,13 +445,6 @@ class ChoicesTests(test.TestCase): self.assertEqual(WhizIterEmpty(c=None).c, None) # Blank value self.assertEqual(WhizIterEmpty(c='').c, '') # Empty value - def test_charfield_get_choices_with_blank_iterator(self): - """ - Check that get_choices works with an empty Iterator - """ - f = models.CharField(choices=(x for x in [])) - self.assertEqual(f.get_choices(include_blank=True), [('', '---------')]) - class SlugFieldTests(test.TestCase): def test_slugfield_max_length(self): |