Skip to content

Commit dc478ce

Browse files
committed
tests
1 parent 94834a0 commit dc478ce

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

tests/iotools/test_bsrn.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import pytest
77
import os
88
import tempfile
9-
from pvlib.iotools import read_bsrn, get_bsrn
9+
from pvlib.iotools import read_bsrn, get_bsrn, parse_bsrn
1010
from tests.conftest import (
1111
TESTS_DATA_DIR,
1212
RERUNS,
@@ -15,6 +15,7 @@
1515
requires_bsrn_credentials,
1616
)
1717

18+
from pvlib._deprecation import pvlibDeprecationWarning
1819

1920
@pytest.fixture(scope="module")
2021
def bsrn_credentials():
@@ -33,6 +34,12 @@ def expected_index():
3334
tz='UTC')
3435

3536

37+
def test_parse_bsrn_deprecated():
38+
with pytest.warns(pvlibDeprecationWarning, match='Use read_bsrn instead'):
39+
with open(TESTS_DATA_DIR / 'bsrn-lr0100-pay0616.dat') as fbuf:
40+
data, metadata = parse_bsrn(fbuf)
41+
42+
3643
@pytest.mark.parametrize('testfile', [
3744
('bsrn-pay0616.dat.gz'),
3845
('bsrn-lr0100-pay0616.dat'),
@@ -47,6 +54,17 @@ def test_read_bsrn(testfile, expected_index):
4754
assert 'relative_humidity' in data.columns
4855

4956

57+
def test_read_bsrn_buffer(expected_index):
58+
with open(TESTS_DATA_DIR / 'bsrn-lr0100-pay0616.dat') as fbuf:
59+
data, metadata = read_bsrn(fbuf)
60+
assert_index_equal(expected_index, data.index)
61+
assert 'ghi' in data.columns
62+
assert 'dni_std' in data.columns
63+
assert 'dhi_min' in data.columns
64+
assert 'lwd_max' in data.columns
65+
assert 'relative_humidity' in data.columns
66+
67+
5068
def test_read_bsrn_logical_records(expected_index):
5169
# Test if logical records 0300 and 0500 are correct parsed
5270
# and that 0100 is not passed when not specified

0 commit comments

Comments
 (0)