Code

Ticket #18317: django-ticket18317.diff

File django-ticket18317.diff, 1.1 KB (added by manfre, 2 years ago)

Adjusts raw SQL depending on connection vendor.

Line 
1diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py
2index ea1e1c7..b265e9d 100644
3--- a/tests/regressiontests/model_fields/tests.py
4+++ b/tests/regressiontests/model_fields/tests.py
5@@ -6,7 +6,7 @@ from decimal import Decimal
6 from django import test
7 from django import forms
8 from django.core.exceptions import ValidationError
9-from django.db import models
10+from django.db import connection, models
11 from django.db.models.fields.files import FieldFile
12 from django.utils import unittest
13 
14@@ -207,8 +207,11 @@ class BooleanFieldTests(unittest.TestCase):
15         # http://code.djangoproject.com/ticket/13293
16         # Verify that when an extra clause exists, the boolean
17         # conversions are applied with an offset
18+        length = 'LENGTH(string)'
19+        if connection.vendor == 'microsoft':
20+            length = 'LEN(string)'
21         b5 = BooleanModel.objects.all().extra(
22-            select={'string_length': 'LENGTH(string)'})[0]
23+            select={'string_length': length})[0]
24         self.assertFalse(isinstance(b5.pk, bool))
25 
26 class ChoicesTests(test.TestCase):