summaryrefslogtreecommitdiff
path: root/tests/db_functions
diff options
context:
space:
mode:
authorNick Pope <nick.pope@flightdataservices.com>2019-08-20 08:54:41 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-02-04 13:20:06 +0100
commit335c9c94acf263901fb023404408880245b0c4b4 (patch)
tree691e9683de6c9840cd0a9a097d020c499ea735db /tests/db_functions
parent469bf2db15597f2c87cb0f8f64132056d2467f15 (diff)
downloaddjango-335c9c94acf263901fb023404408880245b0c4b4.tar.gz
Simplified imports from django.db and django.contrib.gis.db.
Diffstat (limited to 'tests/db_functions')
-rw-r--r--tests/db_functions/comparison/test_cast.py6
-rw-r--r--tests/db_functions/text/test_sha224.py3
2 files changed, 3 insertions, 6 deletions
diff --git a/tests/db_functions/comparison/test_cast.py b/tests/db_functions/comparison/test_cast.py
index c08e61a9e6..a286e467a0 100644
--- a/tests/db_functions/comparison/test_cast.py
+++ b/tests/db_functions/comparison/test_cast.py
@@ -3,8 +3,6 @@ import decimal
import unittest
from django.db import connection, models
-from django.db.models import Avg
-from django.db.models.expressions import Value
from django.db.models.functions import Cast
from django.test import (
TestCase, ignore_warnings, override_settings, skipUnlessDBFeature,
@@ -19,7 +17,7 @@ class CastTests(TestCase):
Author.objects.create(name='Bob', age=1, alias='1')
def test_cast_from_value(self):
- numbers = Author.objects.annotate(cast_integer=Cast(Value('0'), models.IntegerField()))
+ numbers = Author.objects.annotate(cast_integer=Cast(models.Value('0'), models.IntegerField()))
self.assertEqual(numbers.get().cast_integer, 0)
def test_cast_from_field(self):
@@ -127,7 +125,7 @@ class CastTests(TestCase):
The SQL for the Cast expression is wrapped with parentheses in case
it's a complex expression.
"""
- list(Author.objects.annotate(cast_float=Cast(Avg('age'), models.FloatField())))
+ list(Author.objects.annotate(cast_float=Cast(models.Avg('age'), models.FloatField())))
self.assertIn('(AVG("db_functions_author"."age"))::double precision', connection.queries[-1]['sql'])
def test_cast_to_text_field(self):
diff --git a/tests/db_functions/text/test_sha224.py b/tests/db_functions/text/test_sha224.py
index 9ec0bf933f..a8291d416c 100644
--- a/tests/db_functions/text/test_sha224.py
+++ b/tests/db_functions/text/test_sha224.py
@@ -1,9 +1,8 @@
import unittest
-from django.db import connection
+from django.db import NotSupportedError, connection
from django.db.models import CharField
from django.db.models.functions import SHA224
-from django.db.utils import NotSupportedError
from django.test import TestCase
from django.test.utils import register_lookup