-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into interactions_and_invalid_op_checks
- Loading branch information
Showing
26 changed files
with
1,298 additions
and
101 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import List, Tuple | ||
|
||
from s2sphere import LatLng | ||
|
||
from monitoring.monitorlib.geo import generate_slight_overlap_area | ||
|
||
|
||
def _points(in_points: List[Tuple[float, float]]) -> List[LatLng]: | ||
return [LatLng.from_degrees(*p) for p in in_points] | ||
|
||
|
||
def test_generate_slight_overlap_area(): | ||
# Square around 0,0 of edge length 2 -> first corner at 1,1 -> expect a square with overlapping corner at 1,1 | ||
assert generate_slight_overlap_area( | ||
_points([(1, 1), (1, -1), (-1, -1), (-1, 1)]) | ||
) == _points([(1, 1), (1, 2), (2, 2), (2, 1)]) | ||
|
||
# Square with diagonal from 0,0 to 1,1 -> first corner at 1,1 -> expect a square with overlapping corner at 1,1 | ||
assert generate_slight_overlap_area( | ||
_points([(1, 1), (0, 1), (0, 0), (1, 0)]) | ||
) == _points([(1, 1), (1, 1.5), (1.5, 1.5), (1.5, 1)]) | ||
|
||
# Square with diagonal from 0,0 to -1,-1 -> first corner at -1,-1 -> expect a square with overlapping corner at -1,-1 | ||
assert generate_slight_overlap_area( | ||
_points([(-1, -1), (0, -1), (0, 0), (-1, 0)]) | ||
) == _points([(-1, -1), (-1, -1.5), (-1.5, -1.5), (-1.5, -1)]) | ||
|
||
# Square with diagonal from 0,0 to -1,1 -> first corner at -1,1 -> expect a square with overlapping corner at -1,0 | ||
assert generate_slight_overlap_area( | ||
_points([(-1, 1), (-1, 0), (0, 0), (0, 1)]) | ||
) == _points([(-1, 1), (-1, 1.5), (-1.5, 1.5), (-1.5, 1)]) | ||
|
||
# Square with diagonal from 0,0 to 1,-1 -> first corner at 1,-1 -> expect a square with overlapping corner at 1,-1 | ||
assert generate_slight_overlap_area( | ||
_points([(1, -1), (1, 0), (0, 0), (0, -1)]) | ||
) == _points([(1, -1), (1, -1.5), (1.5, -1.5), (1.5, -1)]) |
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
Oops, something went wrong.