Skip to content

Commit 216db9e

Browse files
committed
Prevent atmos_refract docstring typo regression
Add tests to ensure parameter name is documented as 'atmos_refract' (not 'atmos_refrac') in spa_python and solar_position docstrings. Related to pvlib#2532
1 parent b70fb0f commit 216db9e

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/test_solarposition.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ def expected_rise_set_ephem():
8686
index=times)
8787

8888

89+
def test_spa_python_atmos_refract_spelling():
90+
"""Test that parameter name is 'atmos_refract' not 'atmos_refrac'."""
91+
import re
92+
# Check for 'atmos_refrac' not followed by 't' (i.e., the typo)
93+
pattern = r'atmos_refrac(?!t)'
94+
assert not re.search(pattern, solarposition.spa_python.__doc__), \
95+
"Found typo 'atmos_refrac' in spa_python docstring. Should be 'atmos_refract'"
96+
97+
8998
# the physical tests are run at the same time as the NREL SPA test.
9099
# pyephem reproduces the NREL result to 2 decimal places.
91100
# this doesn't mean that one code is better than the other.

tests/test_spa.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@
8989
mix_month_actual = mix_year_actual
9090

9191

92+
def test_solar_position_atmos_refract_spelling():
93+
"""Test that parameter name is 'atmos_refract' not 'atmos_refrac'."""
94+
import re
95+
# Check for 'atmos_refrac' not followed by 't' (i.e., the typo)
96+
pattern = r'atmos_refrac(?!t)'
97+
assert not re.search(pattern, pvlib.spa.solar_position.__doc__), \
98+
"Found typo 'atmos_refrac' in solar_position docstring. Should be 'atmos_refract'"
99+
100+
92101
class SpaBase:
93102
"""Test functions common to numpy and numba spa"""
94103
def test_julian_day_dt(self):

0 commit comments

Comments
 (0)