def test_validation_cases_monotonic(self): with self.assertRaises(Exception) as cm: parse(('Dagsetning,Smit_Samtals\n' '2020-03-29,156\n' '2020-03-30,16'), 'Smit_Samtals', 'cases') exceptions = cm.exception.args[0] exception = exceptions[0] self.assertRegex(str(exceptions[0]), 'cases is not monotonic')
def test_validation_date_format(self): with self.assertRaises(Exception) as cm: parse(('Dagsetning,Smit_Samtals\n' ',156'), 'Smit_Samtals', 'cases') exceptions = cm.exception.args[0] exception = exceptions[0] self.assertRegex(str(exceptions[0]), 'does not match the date format string "%Y-%m-%d"')
def test_corrects_datetime_format(self): df = parse(('Dagsetning,Smit_Samtals\n' '03-29-2020,156\n' '03-30-2020,186'), 'Smit_Samtals', 'cases') assert_csv_equal(self, df, ('date,cases\n' '2020-03-29,156\n' '2020-03-30,186'))
def test_transform_header(self): df = parse(('Dagsetning,Smit_Samtals\n' '2020-03-29,156'), 'Smit_Samtals', 'cases') assert_csv_equal(self, df, ('date,cases\n' '2020-03-29,156'))