def test_combine_paths(paths):
combined = combine_paths(paths)
# Property: the points in the combined paths should all have been in the
# original paths.
assert point_set(paths) >= point_set(combined)
# Property: the combined paths should have no duplicate endpoints.
the_ends = endpoints(combined)
assert len(the_ends) == len(set(the_ends))
# Property: the combined paths should have the same or fewer segments as
# the original paths.
assert num_segments(paths) >= num_segments(combined)
# Property: the combined paths should have the same total length as the
# original paths.
assert math.isclose(paths_length(paths), paths_length(combined))
# Property: there should be no collinear triples in any path.
assert not any(path.any_collinear() for path in combined)
评论列表
文章目录