tests/testthat/test-espn_wbb_game_pbp.R

test_that("ESPN - WBB Play-by-Play", {
  skip_on_cran()
  x <- espn_wbb_pbp(game_id = 401276115)
  
  cols <- c(
    "id",
    "sequence_number",
    "text",
    "away_score",
    "home_score",
    "scoring_play",
    "score_value",
    "wallclock",
    "shooting_play",
    "type_id",
    "type_text",
    "period_number",
    "period_display_value",
    "clock_display_value",
    "team_id",
    "coordinate_x_raw",
    "coordinate_y_raw",
    "coordinate_x",
    "coordinate_y",
    "play_id",
    "athlete_id_1",
    "athlete_id_2",
    "home_team_id",
    "home_team_mascot",
    "home_team_name",
    "home_team_abbrev",
    "home_team_logo",
    "home_team_logo_dark",
    "home_team_full_name",
    "home_team_color",
    "home_team_alternate_color",
    "home_team_score",
    "home_team_winner",
    "home_team_record",
    "away_team_id",
    "away_team_mascot",
    "away_team_name",
    "away_team_abbrev",
    "away_team_logo",
    "away_team_logo_dark",
    "away_team_full_name",
    "away_team_color",
    "away_team_alternate_color",
    "away_team_score",
    "away_team_winner",
    "away_team_record",
    "game_id",
    "season",
    "season_type",
    "game_date",
    "game_date_time"
  )
  
  expect_in(sort(colnames(x)), sort(cols))
  expect_s3_class(x, "data.frame")
})

Try the wehoop package in your browser

Any scripts or data that you put into this service are public.

wehoop documentation built on Nov. 26, 2023, 1:08 a.m.