-
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.
Merge pull request #77 from BenjaminLarrousse/add_length_width_to_pit…
…chdim Add length and width to PitchDimensions
- Loading branch information
Showing
6 changed files
with
93 additions
and
4 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
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,21 @@ | ||
from kloppy.domain import Dimension, PitchDimensions | ||
|
||
|
||
class TestPitchdimensions: | ||
def test_pitchdimensions_properties(self): | ||
pitch_without_scale = PitchDimensions( | ||
x_dim=Dimension(-100, 100), y_dim=Dimension(-50, 50) | ||
) | ||
|
||
assert pitch_without_scale.length is None | ||
assert pitch_without_scale.width is None | ||
|
||
pitch_with_scale = PitchDimensions( | ||
x_dim=Dimension(-100, 100), | ||
y_dim=Dimension(-50, 50), | ||
x_per_meter=20 / 12, | ||
y_per_meter=10 / 8, | ||
) | ||
|
||
assert pitch_with_scale.length == 120 | ||
assert pitch_with_scale.width == 80 |