def test_recent_prior2(): P = PriorEngine(config='./test/prior_engine/test_config_recent_prior.yml', datestr='2017-03-01', variables=['sm']) with pytest.raises(AssertionError, message=("Expecting AssertionError \ --> recent prior not implemented")): S = SoilMoisturePriorCreator(config=P.config, datestr='2017-03-01', var="sm", ptype='recent') S.compute_prior_file()
def test_user_prior_initialization(): P = PriorEngine(config='./test/prior_engine/test_config_user_prior.yml', datestr='2017-03-01', variables=['sm']) S = SoilMoisturePriorCreator(config=P.config, datestr='2017-03-01', var="sm", ptype='user1') with pytest.raises(AssertionError, # Expecting AssertionError # --> wrong path in config file. match=r'.*path/to/file*'): S.compute_prior_file()
def test_climatology_prior(): P = PriorEngine(config='./test/prior_engine/test_config_prior.yml', datestr='2017-03-01', variables=['sm']) SoilMoisturePriorCreator(config=P.config, datestr='2017-01-01', ptype='climatology', var=["sm"])
def test_sm_prior_missing_datestr(): P = PriorEngine(config='./test/prior_engine/test_config_prior.yml', datestr='2017-03-01', variables=['sm']) with pytest.raises(AssertionError): # Expecting AssertionError \ # --> no datestr & variable specified SoilMoisturePriorCreator(config=P.config, ptype='climatology')
def test_calc_config(): P = PriorEngine(config='./test/prior_engine/test_config_prior.yml', datestr='2017-03-01', variables=['sm']) S = SoilMoisturePriorCreator(config=P.config, datestr='2017-03-01', ptype='climatology', var="sm") assert type(S.config) is dict
def test_sm_prior_invalid_ptype(): with pytest.raises(AssertionError): # match=r'.*No prior type*'): SoilMoisturePriorCreator(ptype='climatologi')
def test_sm_prior_no_ptype(): with pytest.raises(AssertionError, match=r'.*No prior type*'): SoilMoisturePriorCreator()
def test_sm_prior_init(): with pytest.raises(AssertionError): # match=("Expecting AssertionError \ # --> no config specified")): SoilMoisturePriorCreator()
def test_sm_prior_invalid_ptype(): with pytest.raises(AssertionError, message=("Expecting AssertionError \ --> no config specified")): SoilMoisturePriorCreator(ptype='climatologi')