Skip to content

Commit 5a5e657

Browse files
committed
Increase test coverage
1 parent 0cb862b commit 5a5e657

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

patsy/polynomials.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ def test_poly_compat():
145145
from patsy.test_poly_data import (R_poly_test_x,
146146
R_poly_test_data,
147147
R_poly_num_tests)
148+
from numpy.testing import assert_allclose
149+
148150
lines = R_poly_test_data.split("\n")
149151
tests_ran = 0
150152
start_idx = lines.index("--BEGIN TEST CASE--")
@@ -172,6 +174,14 @@ def test_poly_compat():
172174
output = np.asarray(eval(test_data["output"]))
173175
# Do the actual test
174176
check_stateful(Poly, False, R_poly_test_x, output, **kwargs)
177+
raw_poly = Poly.vander(R_poly_test_x, kwargs['degree'])
178+
if kwargs['raw']:
179+
actual = raw_poly[:, 1:]
180+
else:
181+
alpha, norm, beta = Poly.gen_qr(raw_poly, kwargs['degree'])
182+
actual = Poly.apply_qr(R_poly_test_x, kwargs['degree'], alpha,
183+
norm, beta)[:, 1:]
184+
assert_allclose(actual, output)
175185
tests_ran += 1
176186
# Set up for the next one
177187
start_idx = stop_idx + 1

0 commit comments

Comments
 (0)