mirror of
https://github.com/django/django.git
synced 2025-08-03 10:34:04 +00:00
Removed DatabaseFeatures.supports_microsecond_precision.
MySQL 5.5 (refs #28552) was the last database to use it.
This commit is contained in:
parent
8a1768432b
commit
a80903b711
8 changed files with 89 additions and 199 deletions
|
@ -20,10 +20,6 @@ lorem_ipsum = """
|
|||
tempor incididunt ut labore et dolore magna aliqua."""
|
||||
|
||||
|
||||
def truncate_microseconds(value):
|
||||
return value if connection.features.supports_microsecond_precision else value.replace(microsecond=0)
|
||||
|
||||
|
||||
class FunctionTests(TestCase):
|
||||
|
||||
def test_coalesce(self):
|
||||
|
@ -121,7 +117,7 @@ class FunctionTests(TestCase):
|
|||
articles = Article.objects.annotate(
|
||||
last_updated=Greatest('written', 'published'),
|
||||
)
|
||||
self.assertEqual(articles.first().last_updated, truncate_microseconds(now))
|
||||
self.assertEqual(articles.first().last_updated, now)
|
||||
|
||||
@skipUnlessDBFeature('greatest_least_ignores_nulls')
|
||||
def test_greatest_ignores_null(self):
|
||||
|
@ -174,7 +170,7 @@ class FunctionTests(TestCase):
|
|||
Coalesce('published', past_sql),
|
||||
),
|
||||
)
|
||||
self.assertEqual(articles.first().last_updated, truncate_microseconds(now))
|
||||
self.assertEqual(articles.first().last_updated, now)
|
||||
|
||||
def test_greatest_all_null(self):
|
||||
Article.objects.create(title="Testing with Django", written=timezone.now())
|
||||
|
@ -225,7 +221,7 @@ class FunctionTests(TestCase):
|
|||
articles = Article.objects.annotate(
|
||||
first_updated=Least('written', 'published'),
|
||||
)
|
||||
self.assertEqual(articles.first().first_updated, truncate_microseconds(before))
|
||||
self.assertEqual(articles.first().first_updated, before)
|
||||
|
||||
@skipUnlessDBFeature('greatest_least_ignores_nulls')
|
||||
def test_least_ignores_null(self):
|
||||
|
@ -278,7 +274,7 @@ class FunctionTests(TestCase):
|
|||
Coalesce('published', future_sql),
|
||||
),
|
||||
)
|
||||
self.assertEqual(articles.first().last_updated, truncate_microseconds(now))
|
||||
self.assertEqual(articles.first().last_updated, now)
|
||||
|
||||
def test_least_all_null(self):
|
||||
Article.objects.create(title="Testing with Django", written=timezone.now())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue