Skip to content

Commit 5b30ea9

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent f44ab85 commit 5b30ea9

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

tests/panels/test_staticfiles.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from django.test import AsyncRequestFactory, RequestFactory
77

88
from debug_toolbar.panels.staticfiles import URLMixin
9+
910
from ..base import BaseTestCase
1011

1112

@@ -82,21 +83,21 @@ def test_storage_state_preservation(self):
8283
"""Ensure the URLMixin doesn't affect storage state"""
8384
original_storage = storage.staticfiles_storage
8485
original_attrs = dict(original_storage.__dict__)
85-
86+
8687
# Trigger mixin injection
8788
self.panel.ready()
88-
89+
8990
# Verify all original attributes are preserved
9091
self.assertEqual(original_attrs, dict(original_storage.__dict__))
9192

9293
def test_context_variable_lifecycle(self):
9394
"""Test the request_id context variable lifecycle"""
9495
from debug_toolbar.panels.staticfiles import request_id_context_var
95-
96+
9697
# Should not raise when context not set
9798
url = storage.staticfiles_storage.url("test.css")
9899
self.assertTrue(url.startswith("/static/"))
99-
100+
100101
# Should track when context is set
101102
token = request_id_context_var.set("test-request-id")
102103
try:
@@ -105,18 +106,16 @@ def test_context_variable_lifecycle(self):
105106
# Verify file was tracked
106107
self.assertIn("test.css", [f.path for f in self.panel.used_paths])
107108
finally:
108-
request_id_context_var.reset(token)
109-
109+
request_id_context_var.reset(token)
110+
110111
def test_multiple_initialization(self):
111112
"""Ensure multiple panel initializations don't stack URLMixin"""
112113
storage_class = storage.staticfiles_storage.__class__
113-
114+
114115
# Initialize panel multiple times
115116
for _ in range(3):
116117
self.panel.ready()
117-
118+
118119
# Verify URLMixin appears exactly once in bases
119-
mixin_count = sum(
120-
1 for base in storage_class.__bases__ if base == URLMixin
121-
)
120+
mixin_count = sum(1 for base in storage_class.__bases__ if base == URLMixin)
122121
self.assertEqual(mixin_count, 1)

0 commit comments

Comments
 (0)