コード例 #1
0
def test_same_coordinates(data: DataObject,
                          coordinates_limits_type: ScalarsLimitsType,
                          sizes_pair: SizesPair) -> None:
    (coordinates, (min_value, max_value)), type_ = coordinates_limits_type
    min_size, max_size = sizes_pair

    strategy = concave_contours(coordinates,
                                min_size=min_size,
                                max_size=max_size)

    result = data.draw(strategy)

    assert is_contour(result)
    assert contour_has_valid_sizes(result,
                                   min_size=min_size,
                                   max_size=max_size)
    assert contour_has_coordinates_types(result, x_type=type_, y_type=type_)
    assert contour_has_coordinates_in_range(result,
                                            min_x_value=min_value,
                                            max_x_value=max_value,
                                            min_y_value=min_value,
                                            max_y_value=max_value)
    assert are_vertices_strict(result.vertices)
    assert are_vertices_non_convex(result.vertices)
    assert is_contour_non_self_intersecting(result)
    assert is_contour_counterclockwise(result)
コード例 #2
0
def test_properties(data: DataObject,
                    coordinates_limits_type_pair: Tuple[ScalarsLimitsType,
                                                        ScalarsLimitsType],
                    sizes_pair: SizesPair) -> None:
    (x_coordinates_limits_type,
     y_coordinates_limits_type) = coordinates_limits_type_pair
    ((x_coordinates, (min_x_value, max_x_value)),
     x_type) = x_coordinates_limits_type
    ((y_coordinates, (min_y_value, max_y_value)),
     y_type) = y_coordinates_limits_type
    min_size, max_size = sizes_pair

    strategy = concave_contours(x_coordinates,
                                y_coordinates,
                                min_size=min_size,
                                max_size=max_size)

    result = data.draw(strategy)

    assert is_contour(result)
    assert contour_has_valid_sizes(result,
                                   min_size=min_size,
                                   max_size=max_size)
    assert contour_has_coordinates_types(result, x_type=x_type, y_type=y_type)
    assert contour_has_coordinates_in_range(result,
                                            min_x_value=min_x_value,
                                            max_x_value=max_x_value,
                                            min_y_value=min_y_value,
                                            max_y_value=max_y_value)
    assert is_contour_strict(result)
    assert are_vertices_non_convex(result.vertices)
    assert is_contour_non_self_intersecting(result)
    assert is_contour_counterclockwise(result)