@@ -433,41 +433,41 @@ def test_clear_expired_tokens_with_tokens(self):
433433 initial_at_count = AccessToken .objects .count ()
434434 assert initial_at_count == 2 * self .num_tokens , f"{ 2 * self .num_tokens } access tokens should exist."
435435 initial_expired_at_count = AccessToken .objects .filter (expires__lte = self .now ).count ()
436- assert (
437- initial_expired_at_count == self .num_tokens
438- ), f" { self . num_tokens } expired access tokens should exist."
436+ assert initial_expired_at_count == self . num_tokens , (
437+ f" { self .num_tokens } expired access tokens should exist."
438+ )
439439 initial_current_at_count = AccessToken .objects .filter (expires__gt = self .now ).count ()
440- assert (
441- initial_current_at_count == self .num_tokens
442- ), f" { self . num_tokens } current access tokens should exist."
440+ assert initial_current_at_count == self . num_tokens , (
441+ f" { self .num_tokens } current access tokens should exist."
442+ )
443443 initial_rt_count = RefreshToken .objects .count ()
444- assert (
445- initial_rt_count == self .num_tokens // 2
446- ), f" { self . num_tokens // 2 } refresh tokens should exist."
444+ assert initial_rt_count == self . num_tokens // 2 , (
445+ f" { self .num_tokens // 2 } refresh tokens should exist."
446+ )
447447 initial_rt_expired_at_count = RefreshToken .objects .filter (access_token__expires__lte = self .now ).count ()
448- assert (
449- initial_rt_expired_at_count == initial_rt_count / 2
450- ), "half the refresh tokens should be for expired access tokens."
448+ assert initial_rt_expired_at_count == initial_rt_count / 2 , (
449+ "half the refresh tokens should be for expired access tokens."
450+ )
451451 initial_rt_current_at_count = RefreshToken .objects .filter (access_token__expires__gt = self .now ).count ()
452- assert (
453- initial_rt_current_at_count == initial_rt_count / 2
454- ), "half the refresh tokens should be for current access tokens."
452+ assert initial_rt_current_at_count == initial_rt_count / 2 , (
453+ "half the refresh tokens should be for current access tokens."
454+ )
455455 initial_gt_count = Grant .objects .count ()
456456 assert initial_gt_count == self .num_tokens * 2 , f"{ self .num_tokens * 2 } grants should exist."
457457
458458 clear_expired ()
459459
460460 # after clear_expired():
461461 remaining_at_count = AccessToken .objects .count ()
462- assert (
463- remaining_at_count == initial_at_count // 2
464- ), "half the initial access tokens should still exist."
462+ assert remaining_at_count == initial_at_count // 2 , (
463+ "half the initial access tokens should still exist."
464+ )
465465 remaining_expired_at_count = AccessToken .objects .filter (expires__lte = self .now ).count ()
466466 assert remaining_expired_at_count == 0 , "no remaining expired access tokens should still exist."
467467 remaining_current_at_count = AccessToken .objects .filter (expires__gt = self .now ).count ()
468- assert (
469- remaining_current_at_count == initial_current_at_count
470- ), "all current access tokens should still exist."
468+ assert remaining_current_at_count == initial_current_at_count , (
469+ "all current access tokens should still exist."
470+ )
471471 remaining_rt_count = RefreshToken .objects .count ()
472472 assert remaining_rt_count == initial_rt_count // 2 , "half the refresh tokens should still exist."
473473 remaining_rt_expired_at_count = RefreshToken .objects .filter (
@@ -477,9 +477,9 @@ def test_clear_expired_tokens_with_tokens(self):
477477 remaining_rt_current_at_count = RefreshToken .objects .filter (
478478 access_token__expires__gt = self .now
479479 ).count ()
480- assert (
481- remaining_rt_current_at_count == initial_rt_current_at_count
482- ), "all the refresh tokens for current access tokens should still exist."
480+ assert remaining_rt_current_at_count == initial_rt_current_at_count , (
481+ "all the refresh tokens for current access tokens should still exist."
482+ )
483483 remaining_gt_count = Grant .objects .count ()
484484 assert remaining_gt_count == initial_gt_count // 2 , "half the remaining grants should still exist."
485485
0 commit comments