Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2151 from manfre/ticket-21746

Fixed #21746 - Fixed test_get_reverse_on_unsaved_object test.
  • Loading branch information...
commit fa250c2cf9d9f7b06468e010c86594bf4bb55cf5 2 parents 9691126 + 1dbbdb2
@akaariai akaariai authored
Showing with 9 additions and 5 deletions.
  1. +9 −5 tests/one_to_one_regress/tests.py
View
14 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 @@ def test_get_reverse_on_unsaved_object(self):
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):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.