summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnssi Kääriäinen <akaariai@gmail.com>2014-01-08 08:08:02 -0800
committerAnssi Kääriäinen <akaariai@gmail.com>2014-01-08 08:08:02 -0800
commitfa250c2cf9d9f7b06468e010c86594bf4bb55cf5 (patch)
tree968b15b657b241030d7b915d5fdb18b59e4f3a65
parent96911261eac4c958e686013fbf65f1cbe085bc91 (diff)
parent1dbbdb29a040106f072a4a0315a066a251cc4939 (diff)
Merge pull request #2151 from manfre/ticket-21746
Fixed #21746 - Fixed test_get_reverse_on_unsaved_object test.
-rw-r--r--tests/one_to_one_regress/tests.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/one_to_one_regress/tests.py b/tests/one_to_one_regress/tests.py
index da4309e821..17528de311 100644
--- a/tests/one_to_one_regress/tests.py
+++ b/tests/one_to_one_regress/tests.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
+from django.db import connection
from django.test import TestCase
from .models import (Bar, Favorites, HiddenPointer, Place, Restaurant, Target,
@@ -226,12 +227,15 @@ class OneToOneRegressionTests(TestCase):
with self.assertRaises(UndergroundBar.DoesNotExist):
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
- with self.assertNumQueries(0):
- with self.assertRaises(UndergroundBar.DoesNotExist):
- p.undergroundbar
+ # When there are several instances of the origin
+ with self.assertNumQueries(0):
+ with self.assertRaises(UndergroundBar.DoesNotExist):
+ p.undergroundbar
def test_set_reverse_on_unsaved_object(self):
"""