Loading django/contrib/gis/gdal/raster/band.py +1 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ class GDALBand(GDALBase): access_flag = 1 # Instantiate ctypes array holding the input data if isinstance(data, (bytes, six.memoryview, numpy.ndarray)): if isinstance(data, (bytes, six.memoryview)) or (numpy and isinstance(data, numpy.ndarray)): data_array = ctypes_array.from_buffer_copy(data) else: data_array = ctypes_array(*data) Loading tests/gis_tests/gdal_tests/test_raster.py +3 −3 Original line number Diff line number Diff line Loading @@ -204,10 +204,10 @@ class GDALBandTests(unittest.TestCase): if numpy: numpy.testing.assert_equal(bandmem.data(), numpy.arange(100).reshape(10, 10)) else: self.assertEqual(bandmem.data(), range(100)) self.assertEqual(bandmem.data(), list(range(100))) # Prepare data for setting values in subsequent tests block = range(100, 104) block = list(range(100, 104)) packed_block = struct.pack('<' + 'B B B B', *block) # Set data from list Loading Loading @@ -267,4 +267,4 @@ class GDALBandTests(unittest.TestCase): numpy.array(range(25)).reshape(5, 5) ) else: self.assertEqual(bandmemjson.data(), range(25)) self.assertEqual(bandmemjson.data(), list(range(25))) Loading
django/contrib/gis/gdal/raster/band.py +1 −1 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ class GDALBand(GDALBase): access_flag = 1 # Instantiate ctypes array holding the input data if isinstance(data, (bytes, six.memoryview, numpy.ndarray)): if isinstance(data, (bytes, six.memoryview)) or (numpy and isinstance(data, numpy.ndarray)): data_array = ctypes_array.from_buffer_copy(data) else: data_array = ctypes_array(*data) Loading
tests/gis_tests/gdal_tests/test_raster.py +3 −3 Original line number Diff line number Diff line Loading @@ -204,10 +204,10 @@ class GDALBandTests(unittest.TestCase): if numpy: numpy.testing.assert_equal(bandmem.data(), numpy.arange(100).reshape(10, 10)) else: self.assertEqual(bandmem.data(), range(100)) self.assertEqual(bandmem.data(), list(range(100))) # Prepare data for setting values in subsequent tests block = range(100, 104) block = list(range(100, 104)) packed_block = struct.pack('<' + 'B B B B', *block) # Set data from list Loading Loading @@ -267,4 +267,4 @@ class GDALBandTests(unittest.TestCase): numpy.array(range(25)).reshape(5, 5) ) else: self.assertEqual(bandmemjson.data(), range(25)) self.assertEqual(bandmemjson.data(), list(range(25)))