-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(Wyscout v3): Handle unrecognized players gracefully to prevent cr…
…ashes (#358)
- Loading branch information
1 parent
452efe7
commit 3b40d02
Showing
4 changed files
with
3,125 additions
and
6 deletions.
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
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,19 @@ | ||
import pytest | ||
|
||
from kloppy import wyscout | ||
from kloppy.exceptions import DeserializationWarning | ||
|
||
|
||
def test_ignore_unknown_player(base_dir): | ||
with pytest.warns( | ||
DeserializationWarning, | ||
match="the player does not appear to be part of that team's lineup", | ||
): | ||
dataset = wyscout.load( | ||
event_data=base_dir / "prs" / "pr_358" / "wyscout_events_v3.json", | ||
coordinates="wyscout", | ||
) | ||
|
||
assert len(dataset.events) == 2 | ||
|
||
assert dataset.events[1].player is None |
Oops, something went wrong.