diff --git a/patsy/polynomials.py b/patsy/polynomials.py index 85a35d1..31b4541 100644 --- a/patsy/polynomials.py +++ b/patsy/polynomials.py @@ -145,6 +145,8 @@ def test_poly_compat(): from patsy.test_poly_data import (R_poly_test_x, R_poly_test_data, R_poly_num_tests) + from numpy.testing import assert_allclose + lines = R_poly_test_data.split("\n") tests_ran = 0 start_idx = lines.index("--BEGIN TEST CASE--") @@ -172,6 +174,14 @@ def test_poly_compat(): output = np.asarray(eval(test_data["output"])) # Do the actual test check_stateful(Poly, False, R_poly_test_x, output, **kwargs) + raw_poly = Poly.vander(R_poly_test_x, kwargs['degree']) + if kwargs['raw']: + actual = raw_poly[:, 1:] + else: + alpha, norm, beta = Poly.gen_qr(raw_poly, kwargs['degree']) + actual = Poly.apply_qr(R_poly_test_x, kwargs['degree'], alpha, + norm, beta)[:, 1:] + assert_allclose(actual, output) tests_ran += 1 # Set up for the next one start_idx = stop_idx + 1