From cf159e5c939fa609c94e4d762d9d9363a6601a95 Mon Sep 17 00:00:00 2001 From: Shai Berger Date: Sun, 26 May 2013 01:39:34 +0300 Subject: [PATCH] Fix get_or_create test failure under Oracle Test expected that when given invalid utf-8, the backend should raise a DatabaseError, but the Oracle backend raises a UnicodeDecodeError. --- tests/get_or_create/tests.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/get_or_create/tests.py b/tests/get_or_create/tests.py index 5a5956bf746..5eb5edd6d91 100644 --- a/tests/get_or_create/tests.py +++ b/tests/get_or_create/tests.py @@ -5,6 +5,7 @@ import traceback import warnings from django.db import IntegrityError, DatabaseError +from django.utils.encoding import DjangoUnicodeDecodeError from django.test import TestCase, TransactionTestCase from .models import Person, ManualPrimaryKeyTest, Profile, Tag, Thing @@ -76,7 +77,7 @@ class GetOrCreateTests(TestCase): Person.objects.get_or_create( birthday=date(1970, 1, 1), defaults={'first_name': "\xff", 'last_name': "\xff"}) - except DatabaseError: + except (DatabaseError, DjangoUnicodeDecodeError): Person.objects.create( first_name="Bob", last_name="Ross", birthday=date(1950, 1, 1)) else: