-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixing issue with pass completions not having right yardage
- Loading branch information
1 parent
55b2bb9
commit 092fa94
Showing
2 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
test_that("2024 pbp handles completions properly", { | ||
# skip("working post-fix") # should fail without it | ||
p = cfbd_pbp_data( | ||
year = 2024, | ||
season_type = "regular", | ||
week = 1, | ||
team = "NC State", | ||
play_type = "pass reception", | ||
epa_wpa = T | ||
) | ||
|
||
completions = p %>% | ||
dplyr::filter(game_id == 401634299 & play_type == "Pass Reception" & pos_team == "NC State") %>% | ||
dplyr::mutate( | ||
same_same = (yards_gained == yds_receiving) | ||
) %>% | ||
dplyr::select(yards_gained, yds_receiving, same_same) | ||
|
||
testthat::expect_equal(sum(completions$same_same), nrow(completions)) | ||
}) | ||
|
||
test_that("base case 2023 pbp are already properly handled", { | ||
p = cfbd_pbp_data( | ||
year = 2023, | ||
season_type = "regular", | ||
week = 2, | ||
team = "Georgia Tech", | ||
play_type = "pass reception", | ||
epa_wpa = T | ||
) | ||
|
||
completions = p %>% | ||
dplyr::filter(game_id == 401525494 & play_type == "Pass Reception" & pos_team == "NC State") %>% | ||
dplyr::mutate( | ||
same_same = (yards_gained == yds_receiving) | ||
) %>% | ||
dplyr::select(yards_gained, yds_receiving, same_same) | ||
|
||
testthat::expect_equal(sum(completions$same_same), nrow(completions)) | ||
}) |