Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
DriesDeprest committed Aug 8, 2024
1 parent 7f63b7e commit 7b8afba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions kloppy/infra/serializers/event/sportec/deserializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ def _team_from_xml_elm(team_elm) -> Team:
first_name=player_elm.attrib["FirstName"],
last_name=player_elm.attrib["LastName"],
starting_position=position_types_mapping.get(
player_elm.attrib["PlayingPosition"], PositionType.Unknown
)
if "PlayingPosition" in player_elm.attrib
else PositionType.Unknown,
player_elm.attrib.get("PlayingPosition"), PositionType.Unknown
),
starting=player_elm.attrib["Starting"] == "true",
)
for player_elm in team_elm.Players.iterchildren("Player")
Expand Down
2 changes: 1 addition & 1 deletion kloppy/tests/test_datafactory.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_correct_deserialization(self, event_data: str):
assert player.player_id == "38804"
assert player.jersey_no == 1
assert str(player) == "Daniel Bold"
assert player.starting_position == PositionType.Unknown
assert player.starting_position == None
assert player.starting

assert dataset.metadata.periods[0].id == 1
Expand Down
2 changes: 1 addition & 1 deletion kloppy/tests/test_opta.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def test_player_position(self, dataset):

# Substituted players don't have a position
sub_player = dataset.metadata.teams[0].get_player_by_id("88022")
assert sub_player.starting_position is None
assert sub_player.starting_position is PositionType.Unknown
assert not sub_player.starting

def test_periods(self, dataset):
Expand Down

0 comments on commit 7b8afba

Please sign in to comment.