diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index afc23b8..8006760 100644
a
|
b
|
import datetime
|
3 | 3 | from decimal import Decimal |
4 | 4 | |
5 | 5 | from django.core.exceptions import FieldError |
| 6 | from django.db import connection |
6 | 7 | from django.db.models import ( |
7 | 8 | Sum, Count, |
8 | 9 | F, Value, Func, |
… |
… |
class NonAggregateAnnotationTestCase(TestCase):
|
235 | 236 | Company(name='Google', motto='Do No Evil', ticker_name='GOOG', description='Internet Company').save() |
236 | 237 | Company(name='Yahoo', motto=None, ticker_name=None, description='Internet Company').save() |
237 | 238 | |
| 239 | val = Value('No Tag') |
| 240 | if connection.vendor == 'oracle': |
| 241 | val = Func(val, function='CAST', |
| 242 | template='%(function)s(%(expressions)s AS nvarchar2(30))') |
| 243 | |
238 | 244 | qs = Company.objects.annotate( |
239 | 245 | tagline=Func( |
240 | 246 | F('motto'), |
241 | 247 | F('ticker_name'), |
242 | 248 | F('description'), |
243 | | Value('No Tag'), |
| 249 | val, |
244 | 250 | function='COALESCE') |
245 | 251 | ).order_by('name') |
246 | 252 | |
… |
… |
class NonAggregateAnnotationTestCase(TestCase):
|
263 | 269 | class Lower(Func): |
264 | 270 | function = 'LOWER' |
265 | 271 | |
| 272 | val = Value('No Tag') |
| 273 | if connection.vendor == 'oracle': |
| 274 | val = Func(val, function='CAST', |
| 275 | template='%(function)s(%(expressions)s AS nvarchar2(30))') |
| 276 | |
266 | 277 | qs = Company.objects.annotate( |
267 | 278 | tagline=Func( |
268 | 279 | F('motto'), |
269 | 280 | F('ticker_name'), |
270 | 281 | F('description'), |
271 | | Value('No Tag'), |
| 282 | val, |
272 | 283 | function='COALESCE') |
273 | 284 | ).annotate( |
274 | 285 | tagline_lower=Lower(F('tagline'), output_field=CharField()) |