def test_distance_with_coords(): event = { "EVENTNUM": 115, "PCTIMESTRING": "00:46", "HOMEDESCRIPTION": "MISS Anthony Jump Shot", "EVENTMSGACTIONTYPE": 1, "EVENTMSGTYPE": 2, "PLAYER1_ID": 2546, "PLAYER1_TEAM_ID": 1610612752, "PLAYER2_ID": None, "PLAYER2_TEAM_ID": None, "PLAYER3_ID": None, "PLAYER3_TEAM_ID": None, } order = 1 fg_event = StatsFieldGoal(event, order) fg_event.locX = -100 fg_event.locY = 150 assert fg_event.distance == 18
def test_shot_type_arc3(): event = { "EVENTNUM": 20, "PCTIMESTRING": "09:57", "HOMEDESCRIPTION": "Rose 3PT Jump Shot (5 PTS) (Anthony 1 AST)", "EVENTMSGACTIONTYPE": 1, "EVENTMSGTYPE": 1, "PLAYER1_ID": 201565, "PLAYER1_TEAM_ID": 1610612752, "PLAYER2_ID": "2546", "PLAYER2_TEAM_ID": 1610612752, "PLAYER3_ID": None, "PLAYER3_TEAM_ID": None, } order = 1 fg_event = StatsFieldGoal(event, order) fg_event.locX = -230 fg_event.locY = 100 assert fg_event.shot_type == pbpstats.ARC_3_STRING
def test_corner3_false(): event = { "EVENTNUM": 20, "PCTIMESTRING": "09:57", "HOMEDESCRIPTION": "Rose 3PT Jump Shot (5 PTS) (Anthony 1 AST)", "EVENTMSGACTIONTYPE": 1, "EVENTMSGTYPE": 1, "PLAYER1_ID": 201565, "PLAYER1_TEAM_ID": 1610612752, "PLAYER2_ID": "2546", "PLAYER2_TEAM_ID": 1610612752, "PLAYER3_ID": None, "PLAYER3_TEAM_ID": None, } order = 1 fg_event = StatsFieldGoal(event, order) fg_event.locX = -230 fg_event.locY = 100 assert fg_event.is_corner_3 is False