def test_remove_procedure_exclude(self): """Test that exclude does not list excluded maps""" rmapcalc("test_apples = 100") rmapcalc("test_oranges = 200") rmapcalc("test_apples_big = 300") rmapcalc("test_apples_small = 300") module = SimpleModule('g.remove', type='raster', pattern='test_{apples,oranges}*', exclude="*_small") self.assertModule(module) self.assertMultiLineEqual( module.outputs.stdout, 'raster/test_apples@user1\n' 'raster/test_apples_big@user1\n' 'raster/test_oranges@user1\n'.replace('user1', get_current_mapset())) module = SimpleModule('g.remove', type='raster', pattern='test_{apples,oranges}{_small,_big,*}', flags='f') self.assertModule(module) self.assertMultiLineEqual(module.outputs.stdout, '') self.assertRegexpMatches(module.outputs.stderr, "(.*<.+>[^\n]*\n){4}", msg="4 maps should be removed")
def test_remove_procedure_exclude(self): """Test that exclude does not list excluded maps""" rmapcalc("test_apples = 100") rmapcalc("test_oranges = 200") rmapcalc("test_apples_big = 300") rmapcalc("test_apples_small = 300") module = SimpleModule( "g.remove", type="raster", pattern="test_{apples,oranges}*", exclude="*_small", ) self.assertModule(module) self.assertMultiLineEqual( module.outputs.stdout, "raster/test_apples@user1\n" "raster/test_apples_big@user1\n" "raster/test_oranges@user1\n".replace("user1", get_current_mapset()), ) module = SimpleModule( "g.remove", type="raster", pattern="test_{apples,oranges}{_small,_big,*}", flags="f", ) self.assertModule(module) self.assertMultiLineEqual(module.outputs.stdout, "") self.assertRegexpMatches(module.outputs.stderr, "(.*<.+>[^\n]*\n){4}", msg="4 maps should be removed")
def test_remove_procedure(self): """Test that maps are removed only with -f""" for i in range(0, 10): rmapcalc("test_map_%i = 100" % i) rmapcalc("test_two = 2") module = SimpleModule('g.remove', type='rast', pattern='test_map_*,*two') self.assertModule(module) self.assertMultiLineEqual(module.outputs.stdout, REMOVE_RASTERS.replace('user1', get_current_mapset())) module = SimpleModule('g.remove', type='rast', pattern='test_map_*,*two', flags='f') self.assertModule(module) self.assertMultiLineEqual(module.outputs.stdout, '') self.assertMultiLineEqual(module.outputs.stderr, REMOVING_RASTERS_LOG)
def test_remove_procedure(self): """Test that maps are removed only with -f""" for i in range(0, 10): rmapcalc("test_map_%i = 100" % i) rmapcalc("test_two = 2") module = SimpleModule('g.remove', type='raster', pattern='test_map_*,*two') self.assertModule(module) self.assertMultiLineEqual( module.outputs.stdout, REMOVE_RASTERS.replace('user1', get_current_mapset())) module = SimpleModule('g.remove', type='raster', pattern='test_map_*,*two', flags='f') self.assertModule(module) self.assertMultiLineEqual(module.outputs.stdout, '') self.assertMultiLineEqual(module.outputs.stderr, REMOVING_RASTERS_LOG)
def test_remove_procedure_exclude(self): """Test that exclude does not list excluded maps""" rmapcalc("test_apples = 100") rmapcalc("test_oranges = 200") rmapcalc("test_apples_big = 300") rmapcalc("test_apples_small = 300") module = SimpleModule('g.remove', type='rast', pattern='test_{apples,oranges}*', exclude="*_small") self.assertModule(module) self.assertMultiLineEqual(module.outputs.stdout, 'rast/test_apples@user1\n' 'rast/test_apples_big@user1\n' 'rast/test_oranges@user1\n'.replace( 'user1', get_current_mapset())) module = SimpleModule('g.remove', type='rast', pattern='test_{apples,oranges}{_small,_big,*}', flags='f') self.assertModule(module) self.assertMultiLineEqual(module.outputs.stdout, '') self.assertRegexpMatches(module.outputs.stderr, "(.*<.+>[^\n]*\n){4}", msg="4 maps should be removed")