def test_config_text_to_list(self): """Exercise :function:`openquake.job.params.config_text_to_list`.""" expected = ['MagDistPMF', 'MagDistEpsPMF', 'FullDisaggMatrix'] # the input mixes spaces and commas for robustness testing: test_input = 'MagDistPMF,MagDistEpsPMF FullDisaggMatrix' self.assertEqual(expected, config_text_to_list(test_input))
def test_config_text_to_list_all_whitespace_input(self): """Exercise :function:`openquake.job.params.config_text_to_list` with an input of only spaces. """ expected = [] test_input = ' ' self.assertEqual(expected, config_text_to_list(test_input))
def test_config_text_to_list_with_transform(self): """Exercise :function:`openquake.job.params.config_text_to_list` with a transform specified. """ expected = [0.01, 0.02, 0.03, 0.04] # again, mix spaces and commas test_input = '0.01,0.02, 0.03 0.04' self.assertEqual(expected, config_text_to_list(test_input, float))