Skip to content

Commit

Permalink
more interface tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfriend committed Nov 9, 2023
1 parent ffa451b commit 75640d0
Showing 1 changed file with 24 additions and 28 deletions.
52 changes: 24 additions & 28 deletions tests/polyfill/test_h3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 75640d0

Please sign in to comment.