test_path.py 文件源码

python
阅读 39 收藏 0 点赞 0 评论 0

项目:zellij 作者: nedbat 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号