Skip to content

Commit b6ded3a

Browse files
author
Sourcery AI
committed
'Refactored by Sourcery'
1 parent cf000b9 commit b6ded3a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tests/test_forms.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ class TestModel(db.Document):
426426
def test_modelselectfield_multiple_selected_elements_must_be_retained(app, db):
427427
with app.test_request_context("/"):
428428

429+
429430
class Dog(db.Document):
430431
name = db.StringField()
431432

@@ -448,7 +449,7 @@ class DogOwner(db.Document):
448449

449450
# Should have one selected option
450451
assert m is not None
451-
assert "fido" == m.group(1)
452+
assert "fido" == m[1]
452453

453454

454455
def test_model_form_help_text(app, db):
@@ -497,6 +498,7 @@ class BlogPost(db.Document):
497498
def test_embedded_model_form(app, db):
498499
with app.test_request_context("/"):
499500

501+
500502
class Content(db.EmbeddedDocument):
501503
text = db.StringField()
502504
lang = db.StringField(max_length=3)
@@ -508,21 +510,25 @@ class Post(db.Document):
508510

509511
PostForm = model_form(Post)
510512
form = PostForm()
511-
assert "content-text" in "%s" % form.content.text
513+
assert "content-text" in f"{form.content.text}"
512514

513515

514516
def test_form_label_modifier(app, db):
515517
with app.test_request_context("/"):
516518

519+
517520
class FoodItem(db.Document):
518521
title = db.StringField()
519522

523+
524+
520525
class FoodStore(db.Document):
521526
title = db.StringField(max_length=120, required=True)
522527
food_items = db.ListField(field=db.ReferenceField(document_type=FoodItem))
523528

524-
def food_items_label_modifier(obj):
525-
return obj.title
529+
def food_items_label_modifier(self):
530+
return self.title
531+
526532

527533
fruit_names = ["banana", "apple", "pear"]
528534

0 commit comments

Comments
 (0)