From 75640d0411fa9e65470e4ab70a24866b602d2890 Mon Sep 17 00:00:00 2001 From: AJ Friend Date: Thu, 9 Nov 2023 15:37:09 -0800 Subject: [PATCH] more interface tests --- tests/polyfill/test_h3.py | 52 ++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/tests/polyfill/test_h3.py b/tests/polyfill/test_h3.py index 6a405c38..bb810678 100644 --- a/tests/polyfill/test_h3.py +++ b/tests/polyfill/test_h3.py @@ -12,6 +12,24 @@ def __geo_interface__(self): return self.dictionary +def get_mocked(): + geo = MockGeoInterface({ + 'type': 'Polygon', + 'coordinates': [ + [ + [-122.4089866999972145, 37.813318999983238], + [-122.3805436999997056, 37.7866302000007224], + [-122.3544736999993603, 37.7198061999978478], + [-122.5123436999983966, 37.7076131999975672], + [-122.5247187000021967, 37.7835871999971715], + [-122.4798767000009008, 37.8151571999998453], + ] + ] + }) + + return geo + + sf_7x7 = [ (37.813318999983238, -122.4089866999972145), (37.7866302000007224, -122.3805436999997056), @@ -90,43 +108,21 @@ def test_polyfill_with_two_holes(): def test_polyfill_geo_json_compliant(): - geo = { - 'type': 'Polygon', - 'coordinates': [ - [ - [-122.4089866999972145, 37.813318999983238], - [-122.3805436999997056, 37.7866302000007224], - [-122.3544736999993603, 37.7198061999978478], - [-122.5123436999983966, 37.7076131999975672], - [-122.5247187000021967, 37.7835871999971715], - [-122.4798767000009008, 37.8151571999998453], - ] - ] - } - + geo = get_mocked().__geo_interface__ out = h3.geo_to_cells(geo, 9) assert len(out) > 1000 def test_polyfill_geo_interface_compliant(): - geo = MockGeoInterface({ - 'type': 'Polygon', - 'coordinates': [ - [ - [-122.4089866999972145, 37.813318999983238], - [-122.3805436999997056, 37.7866302000007224], - [-122.3544736999993603, 37.7198061999978478], - [-122.5123436999983966, 37.7076131999975672], - [-122.5247187000021967, 37.7835871999971715], - [-122.4798767000009008, 37.8151571999998453], - ] - ] - }) - + geo = get_mocked() out = h3.geo_to_cells(geo, 9) assert len(out) > 1000 +def test_geo_to_h3shape(): + pass + + def test_polyfill_down_under(): sydney = [ (-33.8555555, 151.1979259),