mirror of
https://github.com/django/django.git
synced 2025-06-05 11:39:13 +00:00
Fixed #21746 - Fixed test_get_reverse_on_unsaved_object test.
Test will no longer attempt to insert multiple NULL rows in to a unique field if the database doesn't support it.
This commit is contained in:
parent
f343f5e538
commit
1dbbdb29a0
@ -1,5 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import connection
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from .models import (Bar, Favorites, HiddenPointer, Place, Restaurant, Target,
|
from .models import (Bar, Favorites, HiddenPointer, Place, Restaurant, Target,
|
||||||
@ -226,12 +227,15 @@ class OneToOneRegressionTests(TestCase):
|
|||||||
with self.assertRaises(UndergroundBar.DoesNotExist):
|
with self.assertRaises(UndergroundBar.DoesNotExist):
|
||||||
p.undergroundbar
|
p.undergroundbar
|
||||||
|
|
||||||
UndergroundBar.objects.create()
|
# Several instances of the origin are only possible if database allows
|
||||||
|
# inserting multiple NULL rows for a unique constraint
|
||||||
|
if connection.features.ignores_nulls_in_unique_constraints:
|
||||||
|
UndergroundBar.objects.create()
|
||||||
|
|
||||||
# When there are several instances of the origin
|
# When there are several instances of the origin
|
||||||
with self.assertNumQueries(0):
|
with self.assertNumQueries(0):
|
||||||
with self.assertRaises(UndergroundBar.DoesNotExist):
|
with self.assertRaises(UndergroundBar.DoesNotExist):
|
||||||
p.undergroundbar
|
p.undergroundbar
|
||||||
|
|
||||||
def test_set_reverse_on_unsaved_object(self):
|
def test_set_reverse_on_unsaved_object(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user