Esempio n. 1
0
 def test_hex_ring2(self):
     hexagons = h3.hex_ring('8928308280fffff', 2)
     self.assertEqual(
         12, len(hexagons),
         'got the expected number of hexagons for the second ring')
     expected_hexagons = [
         '89283082813ffff',
         '89283082817ffff',
         '8928308281bffff',
         '89283082863ffff',
         '89283082823ffff',
         '8928308287bffff',
         '89283082833ffff',
         '8928308282bffff',
         '89283082857ffff',
         '892830828abffff',
         '89283082847ffff',
         '89283082867ffff',
     ]
     for hexagon in expected_hexagons:
         self.assertIn(hexagon, hexagons, 'found an expected hexagon')
     self.assertEqual(
         hexagons,
         h3.k_ring('8928308280fffff', 2) - h3.k_ring('8928308280fffff', 1),
         'the fast and slow hex ring paths match')
Esempio n. 2
0
 def test_hex_ring_pentagon(self):
     try:
         hexagons = h3.hex_ring('821c07fffffffff', 1)
     except Exception as err:
         self.assertEqual(
             str(err),
             "Failed to get hexagon ring for pentagon 821c07fffffffff")
Esempio n. 3
0
 def test_hex_ring(self):
     hexagons = h3.hex_ring('8928308280fffff', 1)
     self.assertEqual(
         6, len(hexagons),
         'got the expected number of hexagons for a single ring')
     expected_hexagons = [
         '8928308280bffff',
         '89283082807ffff',
         '89283082877ffff',
         '89283082803ffff',
         '89283082873ffff',
         '8928308283bffff',
     ]
     for hexagon in expected_hexagons:
         self.assertIn(hexagon, hexagons, 'found an expected hexagon')
     self.assertEqual(
         hexagons,
         h3.k_ring('8928308280fffff', 1) - h3.k_ring('8928308280fffff', 0),
         'the fast and slow hex ring paths match')