def test_parsing_date_from_full_path_succeeds(self):
     filename = "/random/Y01A.CARS.#D.444444.D091214"
     expected_date = date(2014, 12, 9)
     parsed_datetime = upload.parse_filename(filename, "444444")
     self.assertEqual(expected_date, parsed_datetime.date())
 def test_incorrect_format_returns_none(self):
     filename = "unrelated_file"
     parsed_datetime = upload.parse_filename(filename, "444444")
     self.assertEqual(None, parsed_datetime)
 def test_incorrect_account_code_returns_none(self):
     filename = "Y01A.CARS.#D.555555.D091214"
     parsed_datetime = upload.parse_filename(filename, "444444")
     self.assertEqual(None, parsed_datetime)
 def test_correct_format_returns_correct_date_pre_2000(self):
     filename = "Y01A.CARS.#D.444444.D091299"
     expected_date = date(1999, 12, 9)
     parsed_datetime = upload.parse_filename(filename, "444444")
     self.assertEqual(expected_date, parsed_datetime.date())