Skip to content

Commit

Permalink
Merge pull request #184 from NREL/pp/wildcard_tests
Browse files Browse the repository at this point in the history
Add a test that uses other wildcards for Multi-file resource handler
  • Loading branch information
ppinchuk authored Aug 21, 2024
2 parents 5ecb5fe + 371e948 commit 1f4b2dc
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions tests/test_multi_time_resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ def MultiTimeNSRDB_wildcard_list_res():
return MultiTimeNSRDB(files)


@pytest.fixture
def MultiTimeNSRDB_pattern_list_res():
"""
Init NSRDB resource handler
"""
files = [os.path.join(TESTDATADIR, 'nsrdb/ri_100_nsrdb_20?[2,3].h5')]

return MultiTimeNSRDB(files)


@pytest.fixture
def MultiTimeWind_res():
"""
Expand Down Expand Up @@ -311,6 +321,49 @@ def test_ds(MultiTimeNSRDB_wildcard_list_res, ds_name='dni'):
MultiTimeNSRDB_wildcard_list_res.close()


class TestMultiTimePatternList:
"""
Test multi time resource handler from list of files with patterns
"""
@staticmethod
def test_res(MultiTimeNSRDB_pattern_list_res):
"""
test NSRDB class calls
"""
check_res(MultiTimeNSRDB_pattern_list_res)
assert len(MultiTimeNSRDB_pattern_list_res.h5.files) >= 2
MultiTimeNSRDB_pattern_list_res.close()

@staticmethod
def test_meta(MultiTimeNSRDB_pattern_list_res):
"""
test extraction of NSRDB meta data
"""
check_meta(MultiTimeNSRDB_pattern_list_res)
assert len(MultiTimeNSRDB_pattern_list_res.h5.files) >= 2
MultiTimeNSRDB_pattern_list_res.close()

@staticmethod
def test_time_index(MultiTimeNSRDB_pattern_list_res):
"""
test extraction of NSRDB time_index
"""
check_time_index(MultiTimeNSRDB_pattern_list_res)
assert len(MultiTimeNSRDB_pattern_list_res.h5.files) >= 2
MultiTimeNSRDB_pattern_list_res.close()

@staticmethod
def test_ds(MultiTimeNSRDB_pattern_list_res, ds_name='dni'):
"""
test extraction of a variable array, attributes, and properties
"""
check_dset(MultiTimeNSRDB_pattern_list_res, ds_name)
check_attrs(MultiTimeNSRDB_pattern_list_res, ds_name)
check_properties(MultiTimeNSRDB_pattern_list_res, ds_name)
assert len(MultiTimeNSRDB_pattern_list_res.h5.files) >= 2
MultiTimeNSRDB_pattern_list_res.close()


class TestMultiTimeWindResource:
"""
Multi Year WindResource Resource handler tests
Expand Down

0 comments on commit 1f4b2dc

Please sign in to comment.