Refactoring
Add fixture for page partitioner
This commit is contained in:
parent
2fb450943e
commit
b3cf3e4454
31
test/fixtures/page_generation/page.py
vendored
31
test/fixtures/page_generation/page.py
vendored
@ -33,7 +33,7 @@ logger.remove()
|
||||
logger.add(sys.stderr, level="INFO")
|
||||
|
||||
random_seed = random.randint(0, 2**32 - 1)
|
||||
random_seed = 2973413116
|
||||
# random_seed = 2973413116
|
||||
# random_seed = 2212357755
|
||||
|
||||
rnd = random.Random(random_seed)
|
||||
@ -1307,20 +1307,21 @@ def drop_small_boxes(boxes: Iterable[Rectangle], page_width, page_height, min_pe
|
||||
return lremove(small, boxes)
|
||||
|
||||
|
||||
@pytest.fixture(
|
||||
params=[
|
||||
TwoColumnPagePartitioner,
|
||||
# RandomPagePartitioner
|
||||
]
|
||||
)
|
||||
def page_partitioner(request):
|
||||
return request.param()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def page_with_opaque_content(
|
||||
blank_page,
|
||||
tinted_blank_page,
|
||||
texture,
|
||||
texture_fn,
|
||||
blank_page, tinted_blank_page, texture, texture_fn, page_partitioner
|
||||
) -> Tuple[np.ndarray, Iterable[Rectangle]]:
|
||||
"""Creates a page with content"""
|
||||
page_partitioner = rnd.choice(
|
||||
[
|
||||
TwoColumnPagePartitioner(),
|
||||
# RandomPagePartitioner(),
|
||||
]
|
||||
)
|
||||
|
||||
texture = random_flip(texture)
|
||||
texture = texture_fn(texture)
|
||||
@ -1336,15 +1337,9 @@ def page_with_opaque_content(
|
||||
|
||||
@pytest.fixture
|
||||
def page_with_translucent_content(
|
||||
blank_page, tinted_blank_page, texture, texture_fn
|
||||
blank_page, tinted_blank_page, texture, texture_fn, page_partitioner
|
||||
) -> Tuple[np.ndarray, List[Rectangle]]:
|
||||
"""Creates a page with content"""
|
||||
page_partitioner = rnd.choice(
|
||||
[
|
||||
TwoColumnPagePartitioner(),
|
||||
# RandomPagePartitioner(),
|
||||
]
|
||||
)
|
||||
|
||||
boxes = page_partitioner(blank_page)
|
||||
content_generator = ContentGenerator()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user