Esempio n. 1
0
 def test_multiple_year(self):
     """Test that adding a multiple year constraint works"""
     expected_substring = (
         "WHERE game.home_score != game.away_score "
         "AND game.finished = TRUE "
         "AND play.pos_team != 'UNK' "
         "AND (play.time).phase not in ('Pregame', 'Half', 'Final') "
         "AND game.season_year in (2013,2010)")
     assert expected_substring in utils._make_nfldb_query_string(
         season_years=[2013, 2010])
Esempio n. 2
0
 def test_multiple_season_type(self):
     """Test that adding a single season type constraint works"""
     expected_substring = (
         "WHERE game.home_score != game.away_score "
         "AND game.finished = TRUE "
         "AND play.pos_team != 'UNK' "
         "AND (play.time).phase not in ('Pregame', 'Half', 'Final') "
         "AND game.season_type in ('Regular','Postseason'")
     assert expected_substring in utils._make_nfldb_query_string(
         season_types=["Regular", "Postseason"])
Esempio n. 3
0
 def test_no_args(self):
     expected_string = (
         "SELECT play.gsis_id, play.drive_id, "
         "play.play_id, play.time, play.pos_team AS offense_team, "
         "play.yardline, play.down, play.yards_to_go, "
         "GREATEST("
         "(agg_play.fumbles_rec_tds * 6), "
         "(agg_play.kicking_rec_tds * 6), "
         "(agg_play.passing_tds * 6), "
         "(agg_play.receiving_tds * 6), "
         "(agg_play.rushing_tds * 6), "
         "(agg_play.kicking_xpmade * 1), "
         "(agg_play.passing_twoptm * 2), "
         "(agg_play.receiving_twoptm * 2), "
         "(agg_play.rushing_twoptm * 2), "
         "(agg_play.kicking_fgm * 3)) AS offense_play_points, "
         "GREATEST("
         "(agg_play.defense_frec_tds * 6), "
         "(agg_play.defense_int_tds * 6), "
         "(agg_play.defense_misc_tds * 6), "
         "(agg_play.kickret_tds * 6), "
         "(agg_play.puntret_tds * 6), "
         "(agg_play.defense_safe * 2)) AS defense_play_points, "
         "game.home_team, game.away_team, "
         "((game.home_score > game.away_score AND play.pos_team = game.home_team) OR "
         "(game.away_score > game.home_score AND play.pos_team = game.away_team))"
         " AS offense_won "
         "FROM play INNER JOIN agg_play "
         "ON play.gsis_id = agg_play.gsis_id "
         "AND play.drive_id = agg_play.drive_id "
         "AND play.play_id = agg_play.play_id "
         "INNER JOIN game on play.gsis_id = game.gsis_id "
         "WHERE game.home_score != game.away_score AND game.finished = TRUE "
         "AND play.pos_team != 'UNK' "
         "AND (play.time).phase not in ('Pregame', 'Half', 'Final') "
         "ORDER BY play.gsis_id, play.drive_id, play.play_id;")
     assert expected_string == utils._make_nfldb_query_string()