33from pvlib .iotools import epw
44from tests .conftest import TESTS_DATA_DIR , RERUNS , RERUNS_DELAY
55
6+ from pvlib ._deprecation import pvlibDeprecationWarning
7+
68epw_testfile = TESTS_DATA_DIR / 'NLD_Amsterdam062400_IWEC.epw'
79
810
911def test_read_epw ():
10- epw .read_epw (epw_testfile )
12+ df , meta = epw .read_epw (epw_testfile )
13+ assert len (df ) == 8760
14+ assert 'ghi' in df .columns
15+ assert meta ['latitude' ] == 52.3
16+
17+
18+ def test_read_epw_buffer ():
19+ with open (epw_testfile , 'r' ) as f :
20+ df , meta = epw .read_epw (f )
21+ assert len (df ) == 8760
22+ assert 'ghi' in df .columns
23+ assert meta ['latitude' ] == 52.3
24+
25+
26+ def test_parse_epw_deprecated ():
27+ with pytest .warns (pvlibDeprecationWarning , match = 'Use read_epw instead' ):
28+ with open (epw_testfile , 'r' ) as f :
29+ df , meta = epw .parse_epw (f )
30+ assert len (df ) == 8760
31+ assert 'ghi' in df .columns
32+ assert meta ['latitude' ] == 52.3
1133
1234
1335@pytest .mark .remote_data
@@ -21,3 +43,5 @@ def test_read_epw_coerce_year():
2143 coerce_year = 1987
2244 data , _ = epw .read_epw (epw_testfile , coerce_year = coerce_year )
2345 assert (data .index .year == 1987 ).all ()
46+
47+
0 commit comments