

@unittest.skipIf((not numpy), 'Numpy required')
def test_numpy(self):
    from numpy import array, asarray
    from numpy.testing import assert_array_equal
    geom = MultiPoint(array([[0.0, 0.0], [1.0, 2.0]]))
    self.assertIsInstance(geom, MultiPoint)
    self.assertEqual(len(geom.geoms), 2)
    self.assertEqual(dump_coords(geom), [[(0.0, 0.0)], [(1.0, 2.0)]])
    geom = MultiPoint((Point(1.0, 2.0), Point(3.0, 4.0)))
    assert_array_equal(array(geom), array([[1.0, 2.0], [3.0, 4.0]]))
    a = array([[1.0, 2.0], [3.0, 4.0]])
    geoma = asMultiPoint(a)
    assert_array_equal(geoma.context, array([[1.0, 2.0], [3.0, 4.0]]))
    geoma.assertEqual(dump_coords(geoma), [[(1.0, 2.0)], [(3.0, 4.0)]])
    self.assertEqual(geoma.__array_interface__, geoma.context.__array_interface__)
    pas = asarray(geoma)
    assert_array_equal(pas, array([[1.0, 2.0], [3.0, 4.0]]))

dataset/ETHPy150Open Toblerity/Shapely/tests/test_multipoint.py MultiPointTestCase.test_numpy/VarMisuse@206/232 `self`->`geoma`