Skip to content

Commit df82f48

Browse files
committed
test: add deprecation check on pytz property
1 parent 8240f39 commit df82f48

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

tests/test_location.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import numpy as np
66
from numpy import nan
77
import pandas as pd
8-
from .conftest import assert_frame_equal, assert_index_equal
8+
from .conftest import assert_frame_equal, assert_index_equal, fail_on_pvlib_version
9+
from pvlib._deprecation import pvlibDeprecationWarning
910

1011
import pytest
1112

@@ -20,9 +21,9 @@
2021
def test_location_required():
2122
Location(32.2, -111)
2223

23-
24-
def test_location_all():
25-
Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
24+
@pytest.fixture()
25+
def some_location() -> Location:
26+
return Location(32.2, -111, 'US/Arizona', 700, 'Tucson')
2627

2728

2829
@pytest.mark.parametrize(
@@ -390,3 +391,9 @@ def test_location_lookup_altitude(mocker):
390391
tus = Location(32.2, -111, 'US/Arizona')
391392
location.lookup_altitude.assert_called_once_with(32.2, -111)
392393
assert tus.altitude == location.lookup_altitude(32.2, -111)
394+
395+
396+
@fail_on_pvlib_version('0.17.0')
397+
def test_location_pytz_warning(some_location):
398+
with pytest.warns(pvlibDeprecationWarning):
399+
assert str(some_location.pytz) == 'US/Arizona'

0 commit comments

Comments
 (0)