def test_poor_cases(self): """Bad formats for check_dataset_format""" for nonsense in ['xls', 'dat', 'xslx']: with self.assertRaises(ValueError) as exc: dataset_format_to_extension(nonsense) self.assertEqual("dataset_format is expected to be one of " "%s. '%s' is not valid" % (', '.join(DATASET_FORMATS.keys()), nonsense), str(exc.exception))
def test_good_cases(self): """Good happy case for check_dataset_format""" for dsf, format_ in DATASET_FORMATS.items(): match = dataset_format_to_extension(dsf) self.assertEqual(format_, match)