diff --git a/tests/test_multi_time_resource.py b/tests/test_multi_time_resource.py index 54de35a8..d94474f0 100644 --- a/tests/test_multi_time_resource.py +++ b/tests/test_multi_time_resource.py @@ -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(): """ @@ -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