Ticket #15647: 15647-in-bulk-accepts-iterables.patch

File 15647-in-bulk-accepts-iterables.patch, 818 bytes (added by Calvin Spealman, 14 years ago)

Removes assert from in_bulk and adds tests for iterables passed to it

  • modeltests/lookup/tests.py

     
    115115        self.assertEqual(Article.objects.in_bulk((self.a3.id,)), {self.a3.id: self.a3})
    116116        self.assertEqual(Article.objects.in_bulk([1000]), {})
    117117        self.assertEqual(Article.objects.in_bulk([]), {})
    118         self.assertRaises(AssertionError, Article.objects.in_bulk, 'foo')
     118        self.assertEqual(Article.objects.in_bulk(iter([self.a1.id])), {self.a1.id: self.a1})
     119        self.assertEqual(Article.objects.in_bulk(iter([])), {})
    119120        self.assertRaises(TypeError, Article.objects.in_bulk)
    120121        self.assertRaises(TypeError, Article.objects.in_bulk, headline__startswith='Blah')
    121122
Back to Top