1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

[1.5.x] Fixed #20094 - Be more careful when checking for Iterator

Python 2.6 has some different behaviour when checking
isinstance(foo, collections.Iterator).
Backport of 829dc3c5 from master.
This commit is contained in:
Marc Tamlyn
2013-03-20 10:47:56 +00:00
committed by Claude Paroz
parent 7206330c15
commit dd897e4eeb
6 changed files with 43 additions and 6 deletions

View File

@@ -0,0 +1,11 @@
from django.test import TestCase
from .models import Category, Thing
class TestIsIterator(TestCase):
def test_regression(self):
"""This failed on Django 1.5/Py2.6 because category has a next method."""
category = Category.objects.create(name='category')
Thing.objects.create(category=category)
Thing.objects.filter(category=category)