Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase test coverage
Browse files Browse the repository at this point in the history
thequackdaddy committed Nov 4, 2018

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0cb862b commit 5a5e657
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions patsy/polynomials.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5a5e657

Please sign in to comment.