summaryrefslogtreecommitdiff
path: root/tests/forms_tests/widget_tests/test_select.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2026-01-18 21:26:56 +0100
committerJacob Walls <jacobtylerwalls@gmail.com>2026-03-30 15:55:07 -0400
commit0ee44c674cf61efbca2056c40f3e4f2335aaeee6 (patch)
treea27edf3c3c9ee9c50ba78df9e158b28be408a8bb /tests/forms_tests/widget_tests/test_select.py
parent89b4d944f7e331e267aa1030e295f29355b78172 (diff)
[5.2.x] Applied Black's 2026 stable style.
https://github.com/psf/black/releases/tag/26.1.0 Backport of 6cff02078799b7c683a0d39630d49ab4fe532e7c from main.
Diffstat (limited to 'tests/forms_tests/widget_tests/test_select.py')
-rw-r--r--tests/forms_tests/widget_tests/test_select.py78
1 files changed, 26 insertions, 52 deletions
diff --git a/tests/forms_tests/widget_tests/test_select.py b/tests/forms_tests/widget_tests/test_select.py
index 6164d0b6b3..884b768086 100644
--- a/tests/forms_tests/widget_tests/test_select.py
+++ b/tests/forms_tests/widget_tests/test_select.py
@@ -31,14 +31,12 @@ class SelectTest(ChoiceWidgetTest):
self.widget(choices=self.beatles),
"beatle",
None,
- html=(
- """<select name="beatle">
+ html=("""<select name="beatle">
<option value="J">John</option>
<option value="P">Paul</option>
<option value="G">George</option>
<option value="R">Ringo</option>
- </select>"""
- ),
+ </select>"""),
)
def test_render_label_value(self):
@@ -50,14 +48,12 @@ class SelectTest(ChoiceWidgetTest):
self.widget(choices=self.beatles),
"beatle",
"John",
- html=(
- """<select name="beatle">
+ html=("""<select name="beatle">
<option value="J">John</option>
<option value="P">Paul</option>
<option value="G">George</option>
<option value="R">Ringo</option>
- </select>"""
- ),
+ </select>"""),
)
def test_render_selected(self):
@@ -70,15 +66,13 @@ class SelectTest(ChoiceWidgetTest):
self.widget(choices=choices),
"choices",
"0",
- html=(
- """<select name="choices">
+ html=("""<select name="choices">
<option value="0" selected>0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="0">extra</option>
- </select>"""
- ),
+ </select>"""),
)
def test_constructor_attrs(self):
@@ -93,13 +87,11 @@ class SelectTest(ChoiceWidgetTest):
widget,
"num",
2,
- html=(
- """<select name="num" class="super" id="super">
+ html=("""<select name="num" class="super" id="super">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
- </select>"""
- ),
+ </select>"""),
)
def test_compare_to_str(self):
@@ -110,37 +102,31 @@ class SelectTest(ChoiceWidgetTest):
self.widget(choices=[("1", "1"), ("2", "2"), ("3", "3")]),
"num",
2,
- html=(
- """<select name="num">
+ html=("""<select name="num">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
- </select>"""
- ),
+ </select>"""),
)
self.check_html(
self.widget(choices=[(1, 1), (2, 2), (3, 3)]),
"num",
"2",
- html=(
- """<select name="num">
+ html=("""<select name="num">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
- </select>"""
- ),
+ </select>"""),
)
self.check_html(
self.widget(choices=[(1, 1), (2, 2), (3, 3)]),
"num",
2,
- html=(
- """<select name="num">
+ html=("""<select name="num">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
- </select>"""
- ),
+ </select>"""),
)
def test_choices_constructor(self):
@@ -149,13 +135,11 @@ class SelectTest(ChoiceWidgetTest):
widget,
"num",
2,
- html=(
- """<select name="num">
+ html=("""<select name="num">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
- </select>"""
- ),
+ </select>"""),
)
def test_choices_constructor_generator(self):
@@ -173,29 +157,25 @@ class SelectTest(ChoiceWidgetTest):
widget,
"num",
2,
- html=(
- """<select name="num">
+ html=("""<select name="num">
<option value="0">0</option>
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
<option value="4">4</option>
- </select>"""
- ),
+ </select>"""),
)
self.check_html(
widget,
"num",
3,
- html=(
- """<select name="num">
+ html=("""<select name="num">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected>3</option>
<option value="4">4</option>
- </select>"""
- ),
+ </select>"""),
)
def test_choices_escaping(self):
@@ -204,12 +184,10 @@ class SelectTest(ChoiceWidgetTest):
self.widget(choices=choices),
"escape",
None,
- html=(
- """<select name="escape">
+ html=("""<select name="escape">
<option value="bad">you &amp; me</option>
<option value="good">you &gt; me</option>
- </select>"""
- ),
+ </select>"""),
)
def test_choices_unicode(self):
@@ -217,8 +195,7 @@ class SelectTest(ChoiceWidgetTest):
self.widget(choices=[("ŠĐĆŽćžšđ", "ŠĐabcĆŽćžšđ"), ("ćžšđ", "abcćžšđ")]),
"email",
"ŠĐĆŽćžšđ",
- html=(
- """
+ html=("""
<select name="email">
<option value="\u0160\u0110\u0106\u017d\u0107\u017e\u0161\u0111"
selected>
@@ -227,8 +204,7 @@ class SelectTest(ChoiceWidgetTest):
<option value="\u0107\u017e\u0161\u0111">abc\u0107\u017e\u0161\u0111
</option>
</select>
- """
- ),
+ """),
)
def test_choices_optgroup(self):
@@ -429,8 +405,7 @@ class SelectTest(ChoiceWidgetTest):
MultiWidget([self.widget(choices=choices), TextInput()]),
"beatle",
["J", "Some text"],
- html=(
- """
+ html=("""
<select name="beatle_0">
<option value="">------</option>
<option value="J" selected>John</option>
@@ -439,8 +414,7 @@ class SelectTest(ChoiceWidgetTest):
<option value="R">Ringo</option>
</select>
<input name="beatle_1" type="text" value="Some text">
- """
- ),
+ """),
)
def test_fieldset(self):