def test_many_hex_ranges(self): hex_ranges = h3.hex_ranges(list(h3.k_ring('8928308280fffff', 2)), 2) self.assertEqual(19, len(list(hex_ranges.keys()))) hexagons = hex_ranges['8928308280fffff'] self.assertEqual(3, len(hexagons)) self.assertEqual(1, len(hexagons[0])) self.assertEqual(6, len(hexagons[1])) self.assertEqual(12, len(hexagons[2])) hex_ranges_even_larger = h3.hex_ranges( list(h3.k_ring('8928308280fffff', 5)), 5) self.assertEqual(91, len(list(hex_ranges_even_larger.keys()))) hexagons_larger = hex_ranges_even_larger['8928308280fffff'] self.assertEqual(6, len(hexagons_larger)) self.assertEqual(1, len(hexagons_larger[0])) self.assertEqual(6, len(hexagons_larger[1])) self.assertEqual(12, len(hexagons_larger[2])) self.assertEqual(18, len(hexagons_larger[3])) self.assertEqual(24, len(hexagons_larger[4])) self.assertEqual(30, len(hexagons_larger[5]))
def test_hex_ranges(self): hex_ranges = h3.hex_ranges(['8928308280fffff'], 1) self.assertEqual(1, len(list(hex_ranges.keys()))) hexagons = hex_ranges['8928308280fffff'] self.assertEqual(2, len(hexagons)) self.assertEqual(1, len(hexagons[0])) self.assertEqual(6, len(hexagons[1])) self.assertTrue('8928308280fffff' in hexagons[0]) self.assertTrue('8928308280bffff' in hexagons[1]) self.assertTrue('89283082807ffff' in hexagons[1]) self.assertTrue('89283082877ffff' in hexagons[1]) self.assertTrue('89283082803ffff' in hexagons[1]) self.assertTrue('89283082873ffff' in hexagons[1]) self.assertTrue('8928308283bffff' in hexagons[1])
def test_hex_ranges_pentagon(self): with pytest.raises(ValueError) as e_info: h3.hex_ranges(['821c07fffffffff'], 1) self.assertTrue(isinstance(e_info.value, ValueError))