Skip to content

Commit

Permalink
Remove attributes in ShotEvent and PassEvent classes. Create a better…
Browse files Browse the repository at this point in the history
… test.
  • Loading branch information
BenjaminLarrousse committed Jan 22, 2021
1 parent 8bb089a commit 4a54d30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 0 additions & 6 deletions kloppy/domain/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ class ShotEvent(Event):
event_name (str): `"shot"`,
result_coordinates (Point): See [`Point`][kloppy.domain.models.pitch.Point]
result (ShotResult): See [`ShotResult`][kloppy.domain.models.event.ShotResult]
body_part (BodyPartQualifier): body part attributes.
"""

result: ShotResult
Expand All @@ -409,8 +408,6 @@ class ShotEvent(Event):
event_type: EventType = EventType.SHOT
event_name: str = "shot"

body_part: BodyPartQualifier = None


@dataclass
@docstring_inherit_attributes(Event)
Expand All @@ -425,7 +422,6 @@ class PassEvent(Event):
receiver_coordinates (Point): See [`Point`][kloppy.domain.models.pitch.Point]
receiver_player (Player): See [`Player`][kloppy.domain.models.common.Player]
result (PassResult): See [`PassResult`][kloppy.domain.models.event.PassResult]
body_part (BodyPartQualifier): body part attributes.
"""

receive_timestamp: float
Expand All @@ -437,8 +433,6 @@ class PassEvent(Event):
event_type: EventType = EventType.PASS
event_name: str = "pass"

body_part: BodyPartQualifier = None


@dataclass
@docstring_inherit_attributes(Event)
Expand Down
18 changes: 12 additions & 6 deletions kloppy/tests/test_statsbomb.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,19 @@ def test_correct_deserialization(self):
attacking_direction=AttackingDirection.NOT_SET,
)

for qualifier in dataset.events[791].qualifiers:
if qualifier == BodyPartQualifier:
assert qualifier.value == "HEAD"
assert (
dataset.events[791].get_qualifier_value(BodyPartQualifier).value
== "HEAD"
)

for qualifier in dataset.events[2231].qualifiers:
if qualifier == BodyPartQualifier:
assert qualifier.value == "RIGHT_FOOT"
assert (
dataset.events[2231].get_qualifier_value(BodyPartQualifier).value
== "RIGHT_FOOT"
)

assert (
dataset.events[195].get_qualifier_value(BodyPartQualifier) is None
)

def test_substitution(self):
"""
Expand Down

0 comments on commit 4a54d30

Please sign in to comment.