Shorten intervaltree implementation

parent 6125cc73
Pipeline #146682455 passed with stage
in 5 minutes and 5 seconds
......@@ -378,31 +378,23 @@ def test_dimensions(pdf_document, config):
# If there are two columns, the gutter should be in the middle.
# Margins are the first and last intervals, the ignored parts
# are the left and right columns.
left_margin, _, gutter, _, right_margin = list(sorted(full_tree_x))
left_margin, _, gutter, _, right_margin = \
map(get_interval_width, list(sorted(full_tree_x)))
# For top and bottom margins, we only know they are the first and
# last elements in the list
full_tree_y_list = list(sorted(full_tree_y))
top_margin, bottom_margin = full_tree_y_list[::len(full_tree_y_list)-1]
gutter_width = get_interval_width(gutter)
left_margin_width = get_interval_width(left_margin)
right_margin_width = get_interval_width(right_margin)
top_margin_width = get_interval_width(top_margin)
bottom_margin_width = get_interval_width(bottom_margin)
assert gutter_width > \
config["margins"].get("min_gutter", 0.2)
assert left_margin_width > \
config["margins"].get("min_lr_margin", 0.625)
assert right_margin_width > \
config["margins"].get("min_lr_margin", 0.625)
assert top_margin_width > \
config["margins"].get("min_top_margin", 0.75)
assert bottom_margin_width > \
config["margins"].get("min_bottom_margin", 1)
top_margin, bottom_margin = \
map(
get_interval_width,
full_tree_y_list[::len(full_tree_y_list) - 1]
)
assert gutter > config["margins"].get("min_gutter", 0.2)
assert left_margin > config["margins"].get("min_lr_margin", 0.625)
assert right_margin > config["margins"].get("min_lr_margin", 0.625)
assert top_margin > config["margins"].get("min_top_margin", 0.75)
assert bottom_margin > config["margins"].get("min_bottom_margin", 1)
# save output file
pdf_document.save("layout.pdf",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment