def test_game_id_conversion_wrong_input_size(self): season = "201211111" game_id = "02040000" with self.assertRaises(Exception) as context: GameList.convert_game_id(season, game_id) self.assertEqual(context.exception.message, "game_id is length 10 - should be length 8")
def test_game_id_conversion_season_error_message(self): season = "199121444" game_id = "020431" with self.assertRaises(Exception) as context: GameList.convert_game_id(season, game_id) self.assertEqual(context.exception.message, "season value is 91 - should be between 12 and 19")
def test_game_id_conversion_game_id_error_message(self): season = "20122013" game_id = "139299" with self.assertRaises(Exception) as context: GameList.convert_game_id(season, game_id) self.assertEqual(context.exception.message, "game_id starts with 13 - should start with 02 or 03")
def test_good_date_conversion(self): d = "Mar 13 '14" d_converted = GameList.convert_date(d) self.assertEqual(d_converted, datetime.date(2014, 3, 13))
def test_good_game_id_conversion(self): season = "20122013" game_id = "020431" self.assertEqual(12020431, GameList.convert_game_id(season, game_id))