def test_invalid_order_count_combination(): count = 4 order = 5 with pytest.raises(ezdxf.DXFValueError): required_knot_values(count, order) with pytest.raises(ezdxf.DXFValueError): list(control_frame_knots(n=count - 1, p=order - 1, t_vector=[]))
def test_control_frame_knot_values(fit_points): count = len(fit_points) n = count - 1 degrees = (2, 3, 4) if len(fit_points) > 4 else (2, 3) for p in degrees: # degree order = p + 1 t_vector = uniform_t_vector(fit_points) knots = list(control_frame_knots(n, p, t_vector)) assert len(knots) == required_knot_values(count, order) assert len(set( knots[:order])) == 1, 'first order elements have to be equal' assert len(set( knots[-order:])) == 1, 'last order elements have to be equal' for k1, k2 in zip(knots, knots[1:]): assert k1 <= k2
def test_uniform_knot_order_4(): result = knot_uniform(9, 4) assert len(result) == required_knot_values(9, 4) assert result == uniform_order4
def test_uniform_knot_order_3(): result = knot_uniform(7, 3) assert len(result) == required_knot_values(7, 3) assert result == uniform_order3
def test_uniform_knot_order_2(): result = knot_uniform(5, 2) assert len(result) == required_knot_values(5, 2) assert result == uniform_order2