Skip to content

Commit

Permalink
Fix test asserts and orientation set to None on dataset when no orien…
Browse files Browse the repository at this point in the history
…tation information available on the metadata file
  • Loading branch information
Bruno committed Jun 12, 2020
1 parent 8e7cc4a commit 36c4214
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion kloppy/infra/serializers/tracking/epts/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def deserialize(self, inputs: Dict[str, Readable], options: Dict = None) -> Trac
Orientation.FIXED_HOME_AWAY
if start_attacking_direction == AttackingDirection.HOME_AWAY else
Orientation.FIXED_AWAY_HOME
) if start_attacking_direction else None
) if start_attacking_direction != AttackingDirection.NOT_SET else None

return TrackingDataset(
flags=~(DatasetFlag.BALL_STATE | DatasetFlag.BALL_OWNING_TEAM),
Expand Down
4 changes: 2 additions & 2 deletions kloppy/tests/test_epts.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ def test_correct_deserialization(self):
)

assert len(dataset.records) == 2
assert len(dataset.periods) == 0
assert dataset.orientation == Orientation.FIXED_HOME_AWAY
assert len(dataset.periods) == 1
assert dataset.orientation is None

assert dataset.records[0].home_team_player_positions['22'] == Point(x=-769, y=-2013)
assert dataset.records[0].away_team_player_positions == {}
Expand Down

0 comments on commit 36c4214

Please sign in to comment.