Skip to content

Commit 112ee56

Browse files
authored
update test for pandas 0.22 (#407)
* fix failing test on pandas 0.22 * add missing function call
1 parent e83927d commit 112ee56

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

docs/sphinx/source/whatsnew/v0.5.2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Documentation
2424
Testing
2525
~~~~~~~
2626
* Test Python 3.6 on Windows with Appveyor instead of 3.4. (:issue:`392`)
27+
* Fix failing test on pandas 0.22 (:issue:`406`)
2728

2829
Contributors
2930
~~~~~~~~~~~~

pvlib/test/conftest.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def numpy_1_10():
4242
not numpy_1_10(), reason='requires numpy 1.10 or greater')
4343

4444

45+
def pandas_0_22():
46+
return parse_version(pd.__version__) >= parse_version('0.22.0')
47+
48+
4549
def has_spa_c():
4650
try:
4751
from pvlib.spa_c_files.spa_py import spa_calc

pvlib/test/test_irradiance.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
from pvlib import irradiance
1616
from pvlib import atmosphere
1717

18-
from conftest import requires_ephem, requires_numba, needs_numpy_1_10
18+
from conftest import (requires_ephem, requires_numba, needs_numpy_1_10,
19+
pandas_0_22)
1920

2021
# setup times and location to be tested.
2122
tus = Location(32.2, -111, 'US/Arizona', 700)
@@ -176,11 +177,16 @@ def test_perez_components():
176177
columns=['isotropic', 'circumsolar', 'horizon'],
177178
index=times
178179
)
180+
if pandas_0_22():
181+
expected_for_sum = expected.copy()
182+
expected_for_sum.iloc[2] = 0
183+
else:
184+
expected_for_sum = expected
179185
sum_components = df_components.sum(axis=1)
180186

181187
assert_series_equal(out, expected, check_less_precise=2)
182188
assert_frame_equal(df_components, expected_components)
183-
assert_series_equal(sum_components, expected, check_less_precise=2)
189+
assert_series_equal(sum_components, expected_for_sum, check_less_precise=2)
184190

185191
@needs_numpy_1_10
186192
def test_perez_arrays():

0 commit comments

Comments
 (0)