Skip to content

Commit a4298a1

Browse files
committed
[style] fixes
1 parent e067aca commit a4298a1

File tree

3 files changed

+40
-34
lines changed

3 files changed

+40
-34
lines changed

tests/forms/test_widgets.py

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import domilite.tags
22
import pytest
3-
from attr import s
43
from werkzeug.datastructures import MultiDict
54
from wtforms import Field
65
from wtforms import FileField
@@ -258,43 +257,43 @@ def test_select_groups() -> None:
258257
for opt in child.children:
259258
assert isinstance(opt, domilite.tags.html_tag)
260259
assert opt.name == "option"
261-
if opt.attributes.get('value', None) == "a":
260+
if opt.attributes.get("value", None) == "a":
262261
assert opt["selected"]
263262

264-
def test_number_input() -> None:
265263

264+
def test_number_input() -> None:
266265
form = SimpleForm()
267266
widget = widgets.NumberInput(min=2, max=5, step=1)
268267
tag = widget.__form_tag__(form.string)
269268

270-
assert tag['min'] == 2
271-
assert tag['max'] == 5
272-
assert tag['step'] == 1
273-
assert tag['type'] == 'number'
269+
assert tag["min"] == 2
270+
assert tag["max"] == 5
271+
assert tag["step"] == 1
272+
assert tag["type"] == "number"
274273

275274
widget = widgets.NumberInput()
276275
tag = widget.__form_tag__(form.string)
277276

278-
assert tag['type'] == 'number'
279-
assert 'min' not in tag.attributes
280-
assert 'max' not in tag.attributes
281-
assert 'step' not in tag.attributes
277+
assert tag["type"] == "number"
278+
assert "min" not in tag.attributes
279+
assert "max" not in tag.attributes
280+
assert "step" not in tag.attributes
282281

283-
def test_range_input() -> None:
284282

283+
def test_range_input() -> None:
285284
form = SimpleForm()
286285
widget = widgets.RangeInput(min=2, max=5, step=1)
287286
tag = widget.__form_tag__(form.string)
288287

289-
assert tag['min'] == 2
290-
assert tag['max'] == 5
291-
assert tag['step'] == 1
292-
assert tag['type'] == 'range'
288+
assert tag["min"] == 2
289+
assert tag["max"] == 5
290+
assert tag["step"] == 1
291+
assert tag["type"] == "range"
293292

294293
widget = widgets.RangeInput()
295294
tag = widget.__form_tag__(form.string)
296295

297-
assert tag['type'] == 'range'
298-
assert 'min' not in tag.attributes
299-
assert 'max' not in tag.attributes
300-
assert 'step' not in tag.attributes
296+
assert tag["type"] == "range"
297+
assert "min" not in tag.attributes
298+
assert "max" not in tag.attributes
299+
assert "step" not in tag.attributes

tests/test_endpoint.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
from flask import Flask
44
from werkzeug.routing.exceptions import BuildError
55

6-
from bootlace.endpoint import CurrentEndpoint, Endpoint, NoEndpointError
6+
from bootlace.endpoint import CurrentEndpoint
7+
from bootlace.endpoint import Endpoint
8+
from bootlace.endpoint import NoEndpointError
79

810

911
@pytest.fixture
@@ -89,21 +91,22 @@ def test_endpoint_active_context_with_fullname(app: Flask, bp: Blueprint) -> Non
8991
assert endpoint.active is True
9092
assert endpoint.blueprint == "bp"
9193

94+
9295
def test_current_endpoint(app: Flask) -> None:
9396
endpoint = CurrentEndpoint()
94-
with app.test_request_context('/contact'):
97+
with app.test_request_context("/contact"):
9598
assert endpoint.active is True
9699
assert endpoint.blueprint is None
97-
assert endpoint.name == 'contact'
98-
assert endpoint.full_name == 'contact'
99-
assert endpoint.url == '/contact'
100+
assert endpoint.name == "contact"
101+
assert endpoint.full_name == "contact"
102+
assert endpoint.url == "/contact"
100103
assert not endpoint.url_kwargs
101-
assert endpoint(foo='foo') == '/contact?foo=foo'
104+
assert endpoint(foo="foo") == "/contact?foo=foo"
102105

103-
def test_current_endpoint_no_endpoint(app: Flask) -> None:
104106

107+
def test_current_endpoint_no_endpoint(app: Flask) -> None:
105108
endpoint = CurrentEndpoint()
106-
with app.test_request_context('/does-not-exist'):
109+
with app.test_request_context("/does-not-exist"):
107110
with pytest.raises(NoEndpointError):
108111
endpoint.name
109112

tests/test_extension.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
from flask import Flask
22

3-
from bootlace.extension import Bootlace, context
4-
from bootlace.util import as_tag, render
3+
from bootlace.extension import Bootlace
4+
from bootlace.extension import context
5+
from bootlace.util import as_tag
6+
from bootlace.util import render
57

68

79
def test_extension(app: Flask) -> None:
@@ -24,13 +26,15 @@ def test_extension(app: Flask) -> None:
2426

2527
assert len(list(bootstrap.iter_resources(extension="css"))) == 1
2628

29+
2730
def test_extension_configuration(app: Flask) -> None:
28-
app.config['BOOTLACE_CONTEXT_PROCESSORS'] = False
29-
bootlace = Bootlace(app)
31+
app.config["BOOTLACE_CONTEXT_PROCESSORS"] = False
32+
bootlace = Bootlace(app) # noqa: F841
3033

3134
assert len(app.template_context_processors[None]) == 1
3235

36+
3337
def test_extension_context_processor() -> None:
3438
ctx = context()
35-
assert ctx['render'] is render
36-
assert ctx['as_tag'] is as_tag
39+
assert ctx["render"] is render
40+
assert ctx["as_tag"] is as_tag

0 commit comments

Comments
 (0)