예제 #1
0
def test_basic(first_pair: BoundPortedBoundsPair,
               second_pair: BoundPortedBoundsPair) -> None:
    first_bound, first_ported = first_pair
    second_bound, second_ported = second_pair

    assert equivalence(bound(first_bound, second_bound),
                       ported(first_ported, second_ported))
예제 #2
0
def test_basic(first_pair: BoundPortedPointsPair,
               second_pair: BoundPortedPointsPair,
               third_points_pair: BoundPortedPointsPair) -> None:
    bound_first, ported_first = first_pair
    bound_second, ported_second = second_pair
    bound_third, ported_third = third_points_pair

    assert equivalence(ported(ported_first, ported_second, ported_third),
                       bound(bound_first, bound_second, bound_third))
예제 #3
0
def test_basic(first_pair: BoundPortedBoundsPair,
               second_pair: BoundPortedBoundsPair,
               lists_pair: BoundPortedBoundsListsPair) -> None:
    first_bound, first_ported = first_pair
    second_bound, second_ported = second_pair
    bound_list, ported_list = lists_pair

    bound_list, bound_result = bound(first_bound, second_bound, bound_list)
    ported_result = ported(first_ported, second_ported, ported_list)

    assert bound_result == ported_result
    assert are_bound_ported_bounds_lists_equal(bound_list, ported_list)
예제 #4
0
def test_basic(lists_pair_index: Tuple[BoundPortedBoundsListsPair, int],
               subject_fill_kinds_pair: BoundPortedFillKindsPair,
               clip_fill_kinds_pair: BoundPortedFillKindsPair) -> None:
    (bound_list, ported_list), index = lists_pair_index
    bound_subject_fill_kind, ported_subject_fill_kind = subject_fill_kinds_pair
    bound_clip_fill_kind, ported_clip_fill_kind = clip_fill_kinds_pair

    bound_list = bound(index, bound_list, bound_subject_fill_kind,
                       bound_clip_fill_kind)
    ported(index, ported_list, ported_subject_fill_kind, ported_clip_fill_kind)

    assert are_bound_ported_bounds_lists_equal(bound_list, ported_list)
예제 #5
0
def test_basic(lists_pair: BoundPortedBoundsListsPair) -> None:
    bound_list, ported_list = lists_pair

    try:
        bound_list, bound_result = bound(bound_list)
    except RuntimeError:
        with pytest.raises(RuntimeError):
            ported(ported_list)
    else:
        ported_list, ported_result = ported(ported_list)

        assert are_bound_ported_bounds_lists_equal(bound_list, ported_list)
        assert are_bound_ported_intersect_nodes_lists_equal(
            bound_result, ported_result)
예제 #6
0
def test_basic(
    comparables_with_comparator: Tuple[List[Domain], Callable[[Domain, Domain],
                                                              bool]]
) -> None:
    comparables, comparator = comparables_with_comparator

    def on_swap(elements: List[Tuple[Domain, Domain]], left: Domain,
                right: Domain) -> None:
        elements.append((left, right))

    bound_swaps, ported_swaps = [], []
    assert (bound(comparables, comparator,
                  partial(on_swap, bound_swaps)) == ported(
                      comparables, comparator, partial(on_swap, ported_swaps)))
    assert bound_swaps == ported_swaps
예제 #7
0
def test_basic(value: float) -> None:
    assert bound(value) == ported(value)
예제 #8
0
def test_basic(edges_lists_pair: BoundPortedEdgesListsPair) -> None:
    bound_edges, ported_edges = edges_lists_pair

    assert are_bound_ported_bounds_equal(bound(bound_edges),
                                         ported(ported_edges))
예제 #9
0
def test_basic(left: float, right: float) -> None:
    assert bound(left, right) is ported(left, right)