Skip to content

Commit

Permalink
Format code with black
Browse files Browse the repository at this point in the history
  • Loading branch information
jams2 committed Aug 11, 2023
1 parent 85a1024 commit 2b76ad6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/wagtail_factories/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class StreamFieldFactory(ParameteredAttribute):
"""

def __init__(self, block_types, defaults: Optional[dict]=None):
def __init__(self, block_types, defaults: Optional[dict] = None):
super().__init__(**(defaults or {}))
if isinstance(block_types, dict):
# Old style definition, dict mapping block name -> block factory
Expand Down
4 changes: 3 additions & 1 deletion src/wagtail_factories/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ def _get_or_create(cls, model_class, *args, **kwargs):
if field not in kwargs:
raise errors.FactoryError(
"django_get_or_create - "
"Unable to find initialization value for '{}' in factory {}".format(field, cls.__name__)
"Unable to find initialization value for '{}' in factory {}".format(
field, cls.__name__
)
)
lookup_fields[field] = kwargs[field]

Expand Down
9 changes: 7 additions & 2 deletions tests/test_stream_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ def test_page_with_deeply_nested_stream_block_defaults(self):
assert page.body[0].value["inner_stream"][0].value is None

assert page.body[1].value["inner_stream"][0].block_type == "struct_block"
assert page.body[1].value["inner_stream"][0].value["title"] == "lazy function foobar"
assert (
page.body[1].value["inner_stream"][0].value["title"]
== "lazy function foobar"
)

def test_page_with_deeply_nested_stream_block_in_list_block(self):
page = PageWithStreamBlockInListBlockFactory(
Expand All @@ -96,7 +99,9 @@ def test_computed_values_on_struct_block_in_nested_stream(self):
)
assert page.body[0].value[0].value["boolean"] is True
assert page.body[0].value[0].value["text"][:4] == "True"
assert page.body[0].value[0].value["text"][4:] == str(page.body[0].value[0].value["number"])
assert page.body[0].value[0].value["text"][4:] == str(
page.body[0].value[0].value["number"]
)

def test_factory_with_anonymous_stream_block_in_tree(self):
# The inner_stream child block is defined as an "anonymous" StreamBlock (i.e. declared
Expand Down

0 comments on commit 2b76ad6

Please sign in to comment.