mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Refs #33476 -- Reformatted code with Black.
This commit is contained in:
committed by
Mariusz Felisiak
parent
f68fa8b45d
commit
9c19aff7c7
@@ -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,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user