Esempio n. 1
0
 def test_bulk_create_proxy_inheritance(self):
     RedheadDuck.objects.bulk_create([
         RedheadDuck(name="redheadduck1"),
         Duck(name="duck1"),
         RubberDuck(name="rubberduck1"),
     ])
     RubberDuck.objects.bulk_create([
         RedheadDuck(name="redheadduck2"),
         RubberDuck(name="rubberduck2"),
         Duck(name="duck2"),
     ])
     self.assertEqual(
         sorted(RedheadDuck.objects.values_list("name", flat=True)),
         ["redheadduck1", "redheadduck2"],
     )
     self.assertEqual(
         sorted(RubberDuck.objects.values_list("name", flat=True)),
         ["rubberduck1", "rubberduck2"],
     )
     self.assertEqual(
         sorted(Duck.objects.values_list("name", flat=True)),
         [
             "duck1",
             "duck2",
             "redheadduck1",
             "redheadduck2",
             "rubberduck1",
             "rubberduck2",
         ],
     )
Esempio n. 2
0
 def test_bulk_create_proxy_inheritance(self):
     RedheadDuck.objects.bulk_create([
         RedheadDuck(name='redheadduck1'),
         Duck(name='duck1'),
         RubberDuck(name='rubberduck1'),
     ])
     RubberDuck.objects.bulk_create([
         RedheadDuck(name='redheadduck2'),
         RubberDuck(name='rubberduck2'),
         Duck(name='duck2'),
     ])
     self.assertEqual(
         sorted(RedheadDuck.objects.values_list('name', flat=True)),
         ['redheadduck1', 'redheadduck2'],
     )
     self.assertEqual(
         sorted(RubberDuck.objects.values_list('name', flat=True)),
         ['rubberduck1', 'rubberduck2'],
     )
     self.assertEqual(
         sorted(Duck.objects.values_list('name', flat=True)),
         [
             'duck1', 'duck2', 'redheadduck1', 'redheadduck2',
             'rubberduck1', 'rubberduck2'
         ],
     )