From 80e3444eca045799cc40e50c92609e852a299d38 Mon Sep 17 00:00:00 2001 From: David Szotten Date: Sun, 15 Mar 2015 19:07:39 +0000 Subject: 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`. --- tests/model_fields/tests.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'tests/model_fields') 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): -- cgit v1.3