Skip to content

update test for pandas 0.22 #407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/sphinx/source/whatsnew/v0.5.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Documentation
Testing
~~~~~~~
* Test Python 3.6 on Windows with Appveyor instead of 3.4. (:issue:`392`)
* Fix failing test on pandas 0.22 (:issue:`406`)

Contributors
~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions pvlib/test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def numpy_1_10():
not numpy_1_10(), reason='requires numpy 1.10 or greater')


def pandas_0_22():
return parse_version(pd.__version__) >= parse_version('0.22.0')


def has_spa_c():
try:
from pvlib.spa_c_files.spa_py import spa_calc
Expand Down
10 changes: 8 additions & 2 deletions pvlib/test/test_irradiance.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
from pvlib import irradiance
from pvlib import atmosphere

from conftest import requires_ephem, requires_numba, needs_numpy_1_10
from conftest import (requires_ephem, requires_numba, needs_numpy_1_10,
pandas_0_22)

# setup times and location to be tested.
tus = Location(32.2, -111, 'US/Arizona', 700)
Expand Down Expand Up @@ -176,11 +177,16 @@ def test_perez_components():
columns=['isotropic', 'circumsolar', 'horizon'],
index=times
)
if pandas_0_22():
expected_for_sum = expected.copy()
expected_for_sum.iloc[2] = 0
else:
expected_for_sum = expected
sum_components = df_components.sum(axis=1)

assert_series_equal(out, expected, check_less_precise=2)
assert_frame_equal(df_components, expected_components)
assert_series_equal(sum_components, expected, check_less_precise=2)
assert_series_equal(sum_components, expected_for_sum, check_less_precise=2)

@needs_numpy_1_10
def test_perez_arrays():
Expand Down