Skip to content

Commit

Permalink
'Refactored by Sourcery'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourcery AI committed Aug 10, 2023
1 parent dc82dcf commit f9433b7
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ class TestModel(db.Document):
def test_modelselectfield_multiple_selected_elements_must_be_retained(app, db):
with app.test_request_context("/"):


class Dog(db.Document):
name = db.StringField()

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

# Should have one selected option
assert m is not None
assert "fido" == m.group(1)
assert "fido" == m[1]


def test_model_form_help_text(app, db):
Expand Down Expand Up @@ -497,6 +498,7 @@ class BlogPost(db.Document):
def test_embedded_model_form(app, db):
with app.test_request_context("/"):


class Content(db.EmbeddedDocument):
text = db.StringField()
lang = db.StringField(max_length=3)
Expand All @@ -508,21 +510,25 @@ class Post(db.Document):

PostForm = model_form(Post)
form = PostForm()
assert "content-text" in "%s" % form.content.text
assert "content-text" in f"{form.content.text}"


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


class FoodItem(db.Document):
title = db.StringField()



class FoodStore(db.Document):
title = db.StringField(max_length=120, required=True)
food_items = db.ListField(field=db.ReferenceField(document_type=FoodItem))

def food_items_label_modifier(obj):
return obj.title
def food_items_label_modifier(self):
return self.title


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

Expand Down

0 comments on commit f9433b7

Please sign in to comment.