Skip to content

Commit 128c2fd

Browse files
committed
Ran black
1 parent 2771c78 commit 128c2fd

File tree

3 files changed

+16
-21
lines changed

3 files changed

+16
-21
lines changed

blog/search.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,7 @@ def make_queryset(klass, type_name):
235235
"month": selected_month,
236236
"type": selected_type,
237237
"month_name": (
238-
calendar.month_name[int(selected_month)]
239-
if selected_month.isdigit()
240-
else ""
238+
calendar.month_name[int(selected_month)] if selected_month.isdigit() else ""
241239
),
242240
"from_date": from_date,
243241
"to_date": to_date,

blog/tests.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ def test_cache_header_for_old_content(self):
7979
old_date = timezone.now() - datetime.timedelta(days=181)
8080
entry = EntryFactory(created=old_date)
8181
response = self.client.get(entry.get_absolute_url())
82-
assert response.headers["cache-control"] == "s-maxage=%d" % (
83-
24 * 60 * 60
84-
)
82+
assert response.headers["cache-control"] == "s-maxage=%d" % (24 * 60 * 60)
8583

8684
def test_no_cache_header_for_recent_content(self):
8785
recent_entry = EntryFactory(created=timezone.now())
@@ -399,9 +397,7 @@ def test_search_title_displays_full_month_name(self):
399397
created=datetime.datetime(2025, 7, 1, tzinfo=datetime.timezone.utc)
400398
)
401399
entry.tags.add(tag)
402-
response = self.client.get(
403-
"/search/?tag=llm-release&year=2025&month=7"
404-
)
400+
response = self.client.get("/search/?tag=llm-release&year=2025&month=7")
405401
self.assertContains(
406402
response,
407403
"Posts tagged llm-release in July, 2025",
@@ -424,34 +420,36 @@ def test_archive_month_shows_search_and_counts(self):
424420
'<input type="hidden" name="month" value="7">',
425421
)
426422
self.assertContains(response, "4 posts:")
427-
self.assertContains(response, '>2 entries</a>')
428-
self.assertContains(response, '>1 link</a>')
429-
self.assertContains(response, '>1 quote</a>')
423+
self.assertContains(response, ">2 entries</a>")
424+
self.assertContains(response, ">1 link</a>")
425+
self.assertContains(response, ">1 quote</a>")
430426
self.assertContains(
431427
response,
432-
'/search/?type=entry&year=2025&month=7',
428+
"/search/?type=entry&year=2025&month=7",
433429
)
434430
self.assertContains(
435431
response,
436-
'/search/?type=blogmark&year=2025&month=7',
432+
"/search/?type=blogmark&year=2025&month=7",
437433
)
438434
self.assertContains(
439435
response,
440-
'/search/?type=quotation&year=2025&month=7',
436+
"/search/?type=quotation&year=2025&month=7",
441437
)
442438
summary = response.content.decode()
443-
self.assertNotIn('note', summary)
439+
self.assertNotIn("note", summary)
444440

445441
def test_archive_month_includes_notes(self):
446442
created = datetime.datetime(2025, 7, 1, tzinfo=datetime.timezone.utc)
447443
# Add an entry outside July 2025 so the calendar works
448-
EntryFactory(created=datetime.datetime(2024, 1, 1, tzinfo=datetime.timezone.utc))
444+
EntryFactory(
445+
created=datetime.datetime(2024, 1, 1, tzinfo=datetime.timezone.utc)
446+
)
449447
NoteFactory(created=created)
450448
response = self.client.get("/2025/Jul/")
451449
self.assertEqual(response.status_code, 200)
452450
self.assertContains(response, "1 post:")
453-
self.assertContains(response, '>1 note</a>')
451+
self.assertContains(response, ">1 note</a>")
454452
self.assertContains(
455453
response,
456-
'/search/?type=note&year=2025&month=7',
454+
"/search/?type=note&year=2025&month=7",
457455
)

blog/views.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ def archive_year(request, year):
340340
)
341341

342342

343-
344343
def archive_month(request, year, month):
345344
year = int(year)
346345
month = MONTHS_3_REV[month.lower()]
@@ -379,7 +378,7 @@ def archive_month(request, year, month):
379378
if not items:
380379
raise Http404
381380
items.sort(key=lambda x: x["obj"].created)
382-
# Paginate it
381+
# Paginate it
383382
paginator = Paginator(items, min(1000, int(request.GET.get("size") or "30")))
384383
page_number = request.GET.get("page") or "1"
385384
if page_number == "last":

0 commit comments

Comments
 (0)