Refactoring
This commit is contained in:
parent
b3cf3e4454
commit
740a9cb3c2
20
test/fixtures/page_generation/page.py
vendored
20
test/fixtures/page_generation/page.py
vendored
@ -1317,19 +1317,24 @@ def page_partitioner(request):
|
||||
return request.param()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def boxes(page_partitioner, blank_page):
|
||||
boxes = page_partitioner(blank_page)
|
||||
return boxes
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def page_with_opaque_content(
|
||||
blank_page, tinted_blank_page, texture, texture_fn, page_partitioner
|
||||
blank_page, tinted_blank_page, texture, texture_fn, boxes
|
||||
) -> Tuple[np.ndarray, Iterable[Rectangle]]:
|
||||
"""Creates a page with content"""
|
||||
|
||||
texture = random_flip(texture)
|
||||
texture = texture_fn(texture)
|
||||
|
||||
boxes = page_partitioner(texture)
|
||||
content_generator = ContentGenerator()
|
||||
boxes = content_generator(boxes)
|
||||
|
||||
texture = random_flip(texture)
|
||||
texture = texture_fn(texture)
|
||||
|
||||
page = paste_contents(texture, boxes)
|
||||
|
||||
return page, boxes
|
||||
@ -1337,18 +1342,17 @@ def page_with_opaque_content(
|
||||
|
||||
@pytest.fixture
|
||||
def page_with_translucent_content(
|
||||
blank_page, tinted_blank_page, texture, texture_fn, page_partitioner
|
||||
blank_page, tinted_blank_page, texture, texture_fn, boxes
|
||||
) -> Tuple[np.ndarray, List[Rectangle]]:
|
||||
"""Creates a page with content"""
|
||||
|
||||
boxes = page_partitioner(blank_page)
|
||||
content_generator = ContentGenerator()
|
||||
boxes = content_generator(boxes)
|
||||
page_content = paste_contents(blank_page, boxes)
|
||||
|
||||
texture = random_flip(texture)
|
||||
texture = texture_fn(texture)
|
||||
|
||||
page_content = paste_contents(blank_page, boxes)
|
||||
page = blend_by_multiply(page_content, texture)
|
||||
|
||||
return page, boxes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user