def enable_mock(): RasterData.register("mock", MockReader) yield if "mock" in RasterData._concrete_data_types: del RasterData._concrete_data_types["mock"]
def single(): RasterData.register("mock", MockReader) yield RasterData("single.mock") if "mock" in RasterData._concrete_data_types: del RasterData._concrete_data_types["mock"]
def rdc_one(): RasterData.register("mock", MockReader) yield RasterDataCollection(["rect1.mock"]) if "mock" in RasterData._concrete_data_types: del RasterData._concrete_data_types["mock"]
def rect(): RasterData.register("mock", MockReader) yield RasterData("rect.mock") if "mock" in RasterData._concrete_data_types: del RasterData._concrete_data_types["mock"]
def coords(): RasterData.register("mock", MockReader) yield RasterData("coords.mock") if "mock" in RasterData._concrete_data_types: del RasterData._concrete_data_types["mock"]
def rdc_single(): RasterData.register("mock", MockReader) yield RasterDataCollection([ "single1.mock", "single2.mock", "single3.mock"]) if "mock" in RasterData._concrete_data_types: del RasterData._concrete_data_types["mock"]
def enable_mock(): RasterData.register("mock", MockReader) RasterData._default_schema = 'mock' yield if "mock" in RasterData._concrete_schema: del RasterData._concrete_schema["mock"] RasterData._default_schema = 'file'
def rdc_one(): RasterData.register("mock", MockReader) RasterData._default_schema = 'mock' yield RasterDataCollection(["rect1.mock"]) if "mock" in RasterData._concrete_schema: del RasterData._concrete_schema["mock"] RasterData._default_schema = 'file'
def rasterdata_list(): RasterData.register("mock", MockReader) RasterData._default_schema = 'mock' yield RasterDataCollection( ['test_data1.tif', 'test_data2.tif', 'test_data3.tif']) if "mock" in RasterData._concrete_schema: del RasterData._concrete_schema["mock"] RasterData._default_schema = 'file'
def rect(): RasterData.register("mock", MockReader) RasterData._default_schema = 'mock' yield RasterData("rect.mock") if "mock" in RasterData._concrete_schema: del RasterData._concrete_schema["mock"] RasterData._default_schema = 'file'
def test_raster_data_is_not_valid_no_class(tmpdir): p = tmpdir.mkdir("data").join("test.foo") p.write("BOGUS DATA") assert not RasterData.is_valid(str(p))
def test_raster_data_is_not_valid_no_path(tmpdir): assert not RasterData.is_valid("/some/bogus/path.tif")
def test_raster_data_is_valid(tmpdir): p = tmpdir.mkdir("data").join("test.tif") p.write("BOGUS DATA") assert RasterData.is_valid(str(p))
def test_bad_filetype(): with pytest.raises(NotImplementedError): RasterData("foo.bar")