summaryrefslogtreecommitdiff
path: root/tests/db_functions/datetime/test_now.py
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2022-02-03 20:24:19 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch)
treef0506b668a013d0063e5fba3dbf4863b466713ba /tests/db_functions/datetime/test_now.py
parentf68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff)
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'tests/db_functions/datetime/test_now.py')
-rw-r--r--tests/db_functions/datetime/test_now.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/tests/db_functions/datetime/test_now.py b/tests/db_functions/datetime/test_now.py
index d7b43609b2..669a973be0 100644
--- a/tests/db_functions/datetime/test_now.py
+++ b/tests/db_functions/datetime/test_now.py
@@ -12,21 +12,24 @@ lorem_ipsum = """
class NowTests(TestCase):
-
def test_basic(self):
a1 = Article.objects.create(
- title='How to Django',
+ title="How to Django",
text=lorem_ipsum,
written=timezone.now(),
)
a2 = Article.objects.create(
- title='How to Time Travel',
+ title="How to Time Travel",
text=lorem_ipsum,
written=timezone.now(),
)
- num_updated = Article.objects.filter(id=a1.id, published=None).update(published=Now())
+ num_updated = Article.objects.filter(id=a1.id, published=None).update(
+ published=Now()
+ )
self.assertEqual(num_updated, 1)
- num_updated = Article.objects.filter(id=a1.id, published=None).update(published=Now())
+ num_updated = Article.objects.filter(id=a1.id, published=None).update(
+ published=Now()
+ )
self.assertEqual(num_updated, 0)
a1.refresh_from_db()
self.assertIsInstance(a1.published, datetime)
@@ -36,11 +39,11 @@ class NowTests(TestCase):
self.assertIsInstance(a2.published, datetime)
self.assertQuerysetEqual(
Article.objects.filter(published__lte=Now()),
- ['How to Django'],
- lambda a: a.title
+ ["How to Django"],
+ lambda a: a.title,
)
self.assertQuerysetEqual(
Article.objects.filter(published__gt=Now()),
- ['How to Time Travel'],
- lambda a: a.title
+ ["How to Time Travel"],
+ lambda a: a.title,
)