From 4a54d309295f87484ecdef431eb7420951e0c64b Mon Sep 17 00:00:00 2001 From: BenjaminLarrousse Date: Fri, 22 Jan 2021 19:03:12 +0100 Subject: [PATCH] Remove attributes in ShotEvent and PassEvent classes. Create a better test. --- kloppy/domain/models/event.py | 6 ------ kloppy/tests/test_statsbomb.py | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/kloppy/domain/models/event.py b/kloppy/domain/models/event.py index 120b1ac8..b2fa18b3 100644 --- a/kloppy/domain/models/event.py +++ b/kloppy/domain/models/event.py @@ -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 @@ -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) @@ -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 @@ -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) diff --git a/kloppy/tests/test_statsbomb.py b/kloppy/tests/test_statsbomb.py index 598f90e2..abec65d6 100644 --- a/kloppy/tests/test_statsbomb.py +++ b/kloppy/tests/test_statsbomb.py @@ -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): """