Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update linting and ci/cd from 2022 to 2023 versions (Sourcery refactored) #531

Open
wants to merge 1 commit into
base: where_we_are
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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("/"):

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_modelselectfield_multiple_selected_elements_must_be_retained refactored with the following changes:


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("/"):

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_embedded_model_form refactored with the following changes:


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

Comment on lines +519 to +531
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function test_form_label_modifier refactored with the following changes:


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

Expand Down