Browse Source

Apply Black to tests (#1387)

This applies Black 20.8b1 to all Python test. Enable checks in CI.
Vaclav Petras 4 years ago
parent
commit
fd86f50e9a
84 changed files with 5366 additions and 3098 deletions
  1. 7 6
      db/db.columns/testsuite/test_dbcolumns.py
  2. 48 25
      db/db.copy/testsuite/test_dbcopy.py
  3. 10 10
      db/db.describe/testsuite/test_dbdescribe.py
  4. 13 13
      general/g.list/testsuite/test_g_list.py
  5. 36 27
      general/g.remove/testsuite/test_g_remove.py
  6. 54 42
      general/g.rename/testsuite/test_overwrite.py
  7. 11 11
      lib/gis/testsuite/gis_lib_env_test.py
  8. 6 11
      lib/gis/testsuite/gis_lib_str_color.py
  9. 10 6
      lib/gis/testsuite/gis_lib_tokenize.py
  10. 39 25
      lib/gis/testsuite/test_parser_json.py
  11. 27 19
      lib/raster/testsuite/rast_parse_color_rule.py
  12. 73 12
      lib/raster3d/testsuite/raster3d_lib_test.py
  13. 17 9
      lib/vector/Vlib/testsuite/test_vlib_box.py
  14. 0 3
      pyproject.toml
  15. 84 28
      raster/r.basins.fill/testsuite/testrbf.py
  16. 117 83
      raster/r.contour/testsuite/test_r_contour.py
  17. 25 16
      raster/r.contour/testsuite/testrc.py
  18. 73 19
      raster/r.fill.stats/testsuite/test_r_fill_stats.py
  19. 30 19
      raster/r.geomorphon/testsuite/test_r_geom.py
  20. 11 13
      raster/r.grow.distance/testsuite/r_grow_distance_test.py
  21. 58 19
      raster/r.gwflow/testsuite/validation_7x7_grid.py
  22. 34 15
      raster/r.gwflow/testsuite/validation_excavation.py
  23. 68 24
      raster/r.horizon/testsuite/test_r_horizon.py
  24. 60 23
      raster/r.in.ascii/testsuite/test_r_in_ascii.py
  25. 159 108
      raster/r.in.gdal/testsuite/test_r_in_gdal.py
  26. 54 28
      raster/r.in.poly/testsuite/test_rinpoly.py
  27. 25 10
      raster/r.info/testsuite/test_r_info.py
  28. 51 25
      raster/r.mapcalc/testsuite/test_nmedian_bug_3296.py
  29. 32 29
      raster/r.mapcalc/testsuite/test_r3_mapcalc.py
  30. 154 104
      raster/r.mapcalc/testsuite/test_r_mapcalc.py
  31. 30 17
      raster/r.mapcalc/testsuite/test_row_above_below_bug.py
  32. 17 11
      raster/r.mode/testsuite/testrmode.py
  33. 2 1
      raster/r.neighbors/testsuite/test_r_neighbors.py
  34. 63 44
      raster/r.patch/testsuite/test_rpatch_artificial.py
  35. 57 26
      raster/r.profile/testsuite/test_profile_ncspm.py
  36. 34 18
      raster/r.random.cells/testsuite/test_random_cells.py
  37. 209 117
      raster/r.random/testsuite/test_r_random.py
  38. 42 19
      raster/r.random/testsuite/testrandom.py
  39. 29 23
      raster/r.reclass/testsuite/test_r_reclass.py
  40. 46 29
      raster/r.recode/testsuite/test_rrecode_ncspm.py
  41. 12 21
      raster/r.report/testsuite/test_r_report.py
  42. 73 28
      raster/r.series.interp/testsuite/interp_test.py
  43. 150 80
      raster/r.slope.aspect/testsuite/test_r_slope_aspect.py
  44. 64 12
      raster/r.solute.transport/example.py
  45. 119 31
      raster/r.solute.transport/seguin_verify.py
  46. 118 33
      raster/r.solute.transport/seguin_verify_well.py
  47. 115 49
      raster/r.sun/testsuite/test_rsun.py
  48. 41 24
      raster/r.terraflow/testsuite/test_r_terraflow.py
  49. 38 29
      raster/r.texture/testsuite/test_texture.py
  50. 124 65
      raster/r.tile/testsuite/test_r_tile.py
  51. 52 18
      raster/r.tile/testsuite/testrt.py
  52. 27 10
      raster/r.to.vect/testsuite/test_r_to_vect.py
  53. 73 41
      raster/r.univar/testsuite/test_r_univar.py
  54. 103 56
      raster/r.viewshed/testsuite/test_r_viewshed.py
  55. 119 63
      raster/r.watershed/testsuite/r_watershed_test.py
  56. 548 516
      raster/r.what/testsuite/test_r_what.py
  57. 41 24
      raster/r.what/testsuite/testrw.py
  58. 90 37
      raster3d/r3.flow/testsuite/r3flow_test.py
  59. 92 39
      raster3d/r3.gradient/testsuite/r3gradient_test.py
  60. 38 28
      raster3d/r3.to.rast/testsuite/test_a_b_coeff.py
  61. 40 28
      raster3d/r3.to.rast/testsuite/test_integer_rounding.py
  62. 36 28
      raster3d/r3.to.rast/testsuite/test_nulls.py
  63. 36 28
      raster3d/r3.to.rast/testsuite/test_small_data.py
  64. 43 26
      vector/v.db.select/testsuite/test_v_db_select.py
  65. 78 33
      vector/v.distance/testsuite/test_areas_points.py
  66. 55 30
      vector/v.extract/testsuite/test_v_extract.py
  67. 95 57
      vector/v.in.ascii/testsuite/test_csv.py
  68. 89 46
      vector/v.in.lidar/testsuite/decimation_test.py
  69. 45 30
      vector/v.in.lidar/testsuite/mask_test.py
  70. 23 16
      vector/v.in.lidar/testsuite/test_v_in_lidar_basic.py
  71. 96 60
      vector/v.in.lidar/testsuite/test_v_in_lidar_filter.py
  72. 38 20
      vector/v.in.pdal/testsuite/test_v_in_pdal_basic.py
  73. 98 73
      vector/v.in.pdal/testsuite/test_v_in_pdal_filter.py
  74. 176 105
      vector/v.info/testsuite/test_vinfo.py
  75. 29 13
      vector/v.net/testsuite/test_v_net.py
  76. 24 18
      vector/v.out.lidar/testsuite/test_v_out_lidar.py
  77. 114 43
      vector/v.profile/testsuite/test_v_profile.py
  78. 38 12
      vector/v.select/testsuite/test_v_select.py
  79. 87 40
      vector/v.surf.rst/testsuite/test_vsurfrst.py
  80. 20 12
      vector/v.to.3d/testsuite/test_vto3d.py
  81. 25 22
      vector/v.univar/testsuite/v_univar_test.py
  82. 71 28
      vector/v.vect.stats/testsuite/test_vect_stats.py
  83. 37 25
      vector/v.what/testsuite/test_vwhat_layers.py
  84. 21 14
      vector/v.what/testsuite/test_vwhat_ncspm.py

+ 7 - 6
db/db.columns/testsuite/test_dbcolumns.py

@@ -16,18 +16,19 @@ SHAPE_Leng
 SHAPE_Area
 SHAPE_Area
 """
 """
 
 
+
 class TestDbColumns(TestCase):
 class TestDbColumns(TestCase):
-    invect = 'zipcodes'
-    mapset = '$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db'
+    invect = "zipcodes"
+    mapset = "$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
-        cls.runModule('db.connect', flags='c')
+        cls.runModule("db.connect", flags="c")
 
 
     def test_dbcols(self):
     def test_dbcols(self):
-        cols = read_command('db.columns', table=self.invect,
-                            database=self.mapset)
+        cols = read_command("db.columns", table=self.invect, database=self.mapset)
         self.assertEqual(first=cols, second=output)
         self.assertEqual(first=cols, second=output)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 48 - 25
db/db.copy/testsuite/test_dbcopy.py

@@ -4,45 +4,68 @@ from grass.script.core import read_command
 
 
 
 
 class TestDbCopy(TestCase):
 class TestDbCopy(TestCase):
-    invect = 'zipcodes'
-    orig_mapset = '$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db'
-    outable = 'my_' + invect
+    invect = "zipcodes"
+    orig_mapset = "$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db"
+    outable = "my_" + invect
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
-        cls.runModule('db.connect', flags='c')
+        cls.runModule("db.connect", flags="c")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        cls.runModule('db.droptable', table=cls.outable, flags='f',
-                      database='$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db')
+        cls.runModule(
+            "db.droptable",
+            table=cls.outable,
+            flags="f",
+            database="$GISDBASE/$LOCATION_NAME/$MAPSET/sqlite/sqlite.db",
+        )
 
 
     def test_fromtable(self):
     def test_fromtable(self):
-        self.runModule('db.copy', from_database=self.orig_mapset,
-                       from_table=self.invect, to_table=self.outable,
-                       overwrite=True)
-        orig = read_command('db.select', table=self.invect,
-                            database=self.orig_mapset)
-        new = read_command('db.select', table=self.outable)
+        self.runModule(
+            "db.copy",
+            from_database=self.orig_mapset,
+            from_table=self.invect,
+            to_table=self.outable,
+            overwrite=True,
+        )
+        orig = read_command("db.select", table=self.invect, database=self.orig_mapset)
+        new = read_command("db.select", table=self.outable)
         self.assertEqual(first=orig, second=new)
         self.assertEqual(first=orig, second=new)
 
 
     def test_select(self):
     def test_select(self):
-        self.runModule('db.copy', from_database=self.orig_mapset,
-                       to_table=self.outable, overwrite=True,
-                       select="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect))
-        orig = read_command('db.select', database=self.orig_mapset,
-                            sql="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect))
-        new = read_command('db.select', table=self.outable)
+        self.runModule(
+            "db.copy",
+            from_database=self.orig_mapset,
+            to_table=self.outable,
+            overwrite=True,
+            select="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect),
+        )
+        orig = read_command(
+            "db.select",
+            database=self.orig_mapset,
+            sql="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect),
+        )
+        new = read_command("db.select", table=self.outable)
         self.assertEqual(first=orig, second=new)
         self.assertEqual(first=orig, second=new)
 
 
     def test_where(self):
     def test_where(self):
-        self.runModule('db.copy', from_database=self.orig_mapset,
-                       to_table=self.outable, overwrite=True,
-                       from_table=self.invect, where="NAME='RALEIGH'")
-        orig = read_command('db.select', database=self.orig_mapset,
-                            sql="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect))
-        new = read_command('db.select', table=self.outable)
+        self.runModule(
+            "db.copy",
+            from_database=self.orig_mapset,
+            to_table=self.outable,
+            overwrite=True,
+            from_table=self.invect,
+            where="NAME='RALEIGH'",
+        )
+        orig = read_command(
+            "db.select",
+            database=self.orig_mapset,
+            sql="SELECT * from {inp} WHERE NAME='RALEIGH'".format(inp=self.invect),
+        )
+        new = read_command("db.select", table=self.outable)
         self.assertEqual(first=orig, second=new)
         self.assertEqual(first=orig, second=new)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 10 - 10
db/db.describe/testsuite/test_dbdescribe.py

@@ -10,7 +10,7 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.script.core import read_command
 from grass.script.core import read_command
 
 
-output="""table:zipcodes
+output = """table:zipcodes
 description:
 description:
 insert:?
 insert:?
 delete:?
 delete:?
@@ -150,7 +150,7 @@ select:?
 update:?
 update:?
 """
 """
 
 
-outcol="""ncols: 12
+outcol = """ncols: 12
 nrows: 44
 nrows: 44
 Column 1: cat:INTEGER:20
 Column 1: cat:INTEGER:20
 Column 2: OBJECTID:INTEGER:20
 Column 2: OBJECTID:INTEGER:20
@@ -168,23 +168,23 @@ Column 12: SHAPE_Area:DOUBLE PRECISION:20
 
 
 
 
 class TestDbCopy(TestCase):
 class TestDbCopy(TestCase):
-    invect = 'zipcodes'
-    mapset = '$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db'
+    invect = "zipcodes"
+    mapset = "$GISDBASE/$LOCATION_NAME/PERMANENT/sqlite/sqlite.db"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
-        cls.runModule('db.connect', flags='c')
+        cls.runModule("db.connect", flags="c")
 
 
     def test_describe(self):
     def test_describe(self):
-        cols = read_command('db.describe', table=self.invect,
-                            database=self.mapset)
+        cols = read_command("db.describe", table=self.invect, database=self.mapset)
         self.assertEqual(first=cols, second=output)
         self.assertEqual(first=cols, second=output)
 
 
     def test_columns(self):
     def test_columns(self):
-        cols = read_command('db.describe', table=self.invect, flags='c',
-                            database=self.mapset)
+        cols = read_command(
+            "db.describe", table=self.invect, flags="c", database=self.mapset
+        )
         self.assertEqual(first=cols, second=outcol)
         self.assertEqual(first=cols, second=outcol)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 13 - 13
general/g.list/testsuite/test_g_list.py

@@ -21,36 +21,36 @@ class GMlistWrongParamertersTest(TestCase):
 
 
     def test_pt_flags(self):
     def test_pt_flags(self):
         """Test that -p and -t flags are exclusive"""
         """Test that -p and -t flags are exclusive"""
-        module = SimpleModule('g.list', flags='pt', type='raster')
+        module = SimpleModule("g.list", flags="pt", type="raster")
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
-        self.assertIn('-p', stderr)
-        self.assertIn('-t', stderr)
+        self.assertIn("-p", stderr)
+        self.assertIn("-t", stderr)
 
 
     def test_ft_flags(self):
     def test_ft_flags(self):
         """Test that -f and -t flags are exclusive"""
         """Test that -f and -t flags are exclusive"""
-        module = SimpleModule('g.list', flags='ft', type='raster')
+        module = SimpleModule("g.list", flags="ft", type="raster")
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
-        self.assertIn('-f', stderr)
-        self.assertIn('-t', stderr)
+        self.assertIn("-f", stderr)
+        self.assertIn("-t", stderr)
 
 
     def test_pf_flags(self):
     def test_pf_flags(self):
         """Test that -p and -f flags are exclusive"""
         """Test that -p and -f flags are exclusive"""
-        module = SimpleModule('g.list', flags='pf', type='raster')
+        module = SimpleModule("g.list", flags="pf", type="raster")
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
-        self.assertIn('-p', stderr)
-        self.assertIn('-f', stderr)
+        self.assertIn("-p", stderr)
+        self.assertIn("-f", stderr)
 
 
     def test_re_flags(self):
     def test_re_flags(self):
         """Test that -r and -e flags are exclusive"""
         """Test that -r and -e flags are exclusive"""
-        module = SimpleModule('g.list', flags='re', type='raster')
+        module = SimpleModule("g.list", flags="re", type="raster")
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
-        self.assertIn('-r', stderr)
-        self.assertIn('-e', stderr)
+        self.assertIn("-r", stderr)
+        self.assertIn("-e", stderr)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 36 - 27
general/g.remove/testsuite/test_g_remove.py

@@ -56,17 +56,17 @@ class GMRemoveTest(TestCase):
             rmapcalc("test_map_%i = 100" % i)
             rmapcalc("test_map_%i = 100" % i)
         rmapcalc("test_two = 2")
         rmapcalc("test_two = 2")
 
 
-        module = SimpleModule('g.remove',
-                              type='raster', pattern='test_map_*,*two')
+        module = SimpleModule("g.remove", type="raster", pattern="test_map_*,*two")
         self.assertModule(module)
         self.assertModule(module)
-        self.assertMultiLineEqual(module.outputs.stdout,
-                                  REMOVE_RASTERS.replace('user1',
-                                                         get_current_mapset()))
+        self.assertMultiLineEqual(
+            module.outputs.stdout, REMOVE_RASTERS.replace("user1", get_current_mapset())
+        )
 
 
-        module = SimpleModule('g.remove', type='raster',
-                              pattern='test_map_*,*two', flags='f')
+        module = SimpleModule(
+            "g.remove", type="raster", pattern="test_map_*,*two", flags="f"
+        )
         self.assertModule(module)
         self.assertModule(module)
-        self.assertMultiLineEqual(module.outputs.stdout, '')
+        self.assertMultiLineEqual(module.outputs.stdout, "")
         self.assertMultiLineEqual(module.outputs.stderr, REMOVING_RASTERS_LOG)
         self.assertMultiLineEqual(module.outputs.stderr, REMOVING_RASTERS_LOG)
 
 
     def test_remove_procedure_exclude(self):
     def test_remove_procedure_exclude(self):
@@ -75,22 +75,30 @@ class GMRemoveTest(TestCase):
         rmapcalc("test_oranges = 200")
         rmapcalc("test_oranges = 200")
         rmapcalc("test_apples_big = 300")
         rmapcalc("test_apples_big = 300")
         rmapcalc("test_apples_small = 300")
         rmapcalc("test_apples_small = 300")
-        module = SimpleModule('g.remove', type='raster',
-                              pattern='test_{apples,oranges}*',
-                              exclude="*_small")
+        module = SimpleModule(
+            "g.remove",
+            type="raster",
+            pattern="test_{apples,oranges}*",
+            exclude="*_small",
+        )
         self.assertModule(module)
         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.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.assertModule(module)
-        self.assertMultiLineEqual(module.outputs.stdout, '')
-        self.assertRegexpMatches(module.outputs.stderr, "(.*<.+>[^\n]*\n){4}",
-                                 msg="4 maps should be removed")
+        self.assertMultiLineEqual(module.outputs.stdout, "")
+        self.assertRegexpMatches(
+            module.outputs.stderr, "(.*<.+>[^\n]*\n){4}", msg="4 maps should be removed"
+        )
 
 
 
 
 class GMRemoveWrongInputTest(TestCase):
 class GMRemoveWrongInputTest(TestCase):
@@ -98,13 +106,14 @@ class GMRemoveWrongInputTest(TestCase):
 
 
     def test_re_flags(self):
     def test_re_flags(self):
         """Test that -r and -e flags are exclusive"""
         """Test that -r and -e flags are exclusive"""
-        module = SimpleModule('g.remove', flags='re',
-                              type='raster', pattern='xxxyyyzzz')
+        module = SimpleModule(
+            "g.remove", flags="re", type="raster", pattern="xxxyyyzzz"
+        )
         self.assertModuleFail(module)
         self.assertModuleFail(module)
         stderr = module.outputs.stderr
         stderr = module.outputs.stderr
-        self.assertIn('-r', stderr)
-        self.assertIn('-e', stderr)
+        self.assertIn("-r", stderr)
+        self.assertIn("-e", stderr)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 54 - 42
general/g.rename/testsuite/test_overwrite.py

@@ -12,8 +12,7 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gutils import is_map_in_mapset
 from grass.gunittest.gutils import is_map_in_mapset
-from grass.gunittest.checkers import (text_to_keyvalue, keyvalue_equals,
-                                      diff_keyvalue)
+from grass.gunittest.checkers import text_to_keyvalue, keyvalue_equals, diff_keyvalue
 
 
 
 
 class RasterRenameTestCase(TestCase):
 class RasterRenameTestCase(TestCase):
@@ -31,18 +30,18 @@ class RasterRenameTestCase(TestCase):
         self.runModule("r.mapcalc", expression="rename_2 = 20")
         self.runModule("r.mapcalc", expression="rename_2 = 20")
         self.runModule("r.mapcalc", expression="rename_3 = 300")
         self.runModule("r.mapcalc", expression="rename_3 = 300")
         self.runModule("r.mapcalc", expression="exists = 50000")
         self.runModule("r.mapcalc", expression="exists = 50000")
-        self.to_remove = ['rename_1', 'rename_2', 'rename_3', 'exists']
+        self.to_remove = ["rename_1", "rename_2", "rename_3", "exists"]
 
 
     def tearDown(self):
     def tearDown(self):
         """Remove temporary region and renamed maps (and also old if needed)"""
         """Remove temporary region and renamed maps (and also old if needed)"""
-        self.runModule('g.remove', name=self.to_remove, type=['raster'], flags='f')
+        self.runModule("g.remove", name=self.to_remove, type=["raster"], flags="f")
         self.del_temp_region()
         self.del_temp_region()
 
 
     def test_raster(self):
     def test_raster(self):
         """Test that raster rename works"""
         """Test that raster rename works"""
-        module = SimpleModule('g.rename', raster=['rename_1', 'renamed_1'])
+        module = SimpleModule("g.rename", raster=["rename_1", "renamed_1"])
         self.assertModule(module)
         self.assertModule(module)
-        new_names = ['renamed_1']
+        new_names = ["renamed_1"]
         self.to_remove.extend(new_names)
         self.to_remove.extend(new_names)
         for name in new_names:
         for name in new_names:
             self.assertRasterExists(name)
             self.assertRasterExists(name)
@@ -51,23 +50,28 @@ class RasterRenameTestCase(TestCase):
         """Test that existing raster is preserved"""
         """Test that existing raster is preserved"""
         # TODO: write the same for other types
         # TODO: write the same for other types
         # TODO: create a general functions to avoid duplication
         # TODO: create a general functions to avoid duplication
-        runivar = SimpleModule('r.univar', flags='g', map='exists')
+        runivar = SimpleModule("r.univar", flags="g", map="exists")
         self.runModule(runivar, expecting_stdout=True)
         self.runModule(runivar, expecting_stdout=True)
-        original_runivar = text_to_keyvalue(runivar.outputs.stdout,
-                                            sep='=', skip_empty=True)
-        module = SimpleModule('g.rename', raster=['rename_3', 'exists'], overwrite=False)
+        original_runivar = text_to_keyvalue(
+            runivar.outputs.stdout, sep="=", skip_empty=True
+        )
+        module = SimpleModule(
+            "g.rename", raster=["rename_3", "exists"], overwrite=False
+        )
         self.assertModule(module)
         self.assertModule(module)
-        self.assertRasterExists('exists', msg="Destination (existing) map (to) should exist")
-        self.assertRasterExists('rename_3', msg="Source map (from) should exist")
-        runivar = SimpleModule('r.univar', flags='g', map='exists')
+        self.assertRasterExists(
+            "exists", msg="Destination (existing) map (to) should exist"
+        )
+        self.assertRasterExists("rename_3", msg="Source map (from) should exist")
+        runivar = SimpleModule("r.univar", flags="g", map="exists")
         self.runModule(runivar, expecting_stdout=True)
         self.runModule(runivar, expecting_stdout=True)
-        new_runivar = text_to_keyvalue(runivar.outputs.stdout,
-                                       sep='=', skip_empty=True)
-        if not keyvalue_equals(dict_a=original_runivar, dict_b=new_runivar,
-                               precision=1e-7):
-            unused, missing, mismatch = diff_keyvalue(dict_a=original_runivar,
-                                                      dict_b=new_runivar,
-                                                      precision=1e-7)
+        new_runivar = text_to_keyvalue(runivar.outputs.stdout, sep="=", skip_empty=True)
+        if not keyvalue_equals(
+            dict_a=original_runivar, dict_b=new_runivar, precision=1e-7
+        ):
+            unused, missing, mismatch = diff_keyvalue(
+                dict_a=original_runivar, dict_b=new_runivar, precision=1e-7
+            )
             if mismatch:
             if mismatch:
                 msg = "Raster map changed. It was probably overwritten.\n"
                 msg = "Raster map changed. It was probably overwritten.\n"
                 msg += "Difference between r.univar of maps:\n"
                 msg += "Difference between r.univar of maps:\n"
@@ -77,36 +81,44 @@ class RasterRenameTestCase(TestCase):
 
 
     def test_overwrite_existing_raster(self):
     def test_overwrite_existing_raster(self):
         """Test that existing raster is overridden if desired"""
         """Test that existing raster is overridden if desired"""
-        runivar_source = SimpleModule('r.univar', flags='g', map='rename_3')
+        runivar_source = SimpleModule("r.univar", flags="g", map="rename_3")
         self.runModule(runivar_source, expecting_stdout=True)
         self.runModule(runivar_source, expecting_stdout=True)
-        original_runivar_source = text_to_keyvalue(runivar_source.outputs.stdout,
-                                                   sep='=', skip_empty=True)
-        runivar_target = SimpleModule('r.univar', flags='g', map='exists')
+        original_runivar_source = text_to_keyvalue(
+            runivar_source.outputs.stdout, sep="=", skip_empty=True
+        )
+        runivar_target = SimpleModule("r.univar", flags="g", map="exists")
         self.runModule(runivar_target, expecting_stdout=True)
         self.runModule(runivar_target, expecting_stdout=True)
-        original_runivar_target = text_to_keyvalue(runivar_target.outputs.stdout,
-                                                   sep='=', skip_empty=True)
-        module = SimpleModule('g.rename', raster=['rename_3', 'exists'], overwrite=True)
+        original_runivar_target = text_to_keyvalue(
+            runivar_target.outputs.stdout, sep="=", skip_empty=True
+        )
+        module = SimpleModule("g.rename", raster=["rename_3", "exists"], overwrite=True)
         self.assertModule(module)
         self.assertModule(module)
-        self.assertRasterExists('exists', msg="Destination (here: existing) map (to) should exist after rename")
-        self.assertFalse(is_map_in_mapset('rename_3', type='raster'),
-                         msg="Source map (from) should not exist after rename")
-
-        runivar = SimpleModule('r.univar', flags='g', map='exists')
+        self.assertRasterExists(
+            "exists",
+            msg="Destination (here: existing) map (to) should exist after rename",
+        )
+        self.assertFalse(
+            is_map_in_mapset("rename_3", type="raster"),
+            msg="Source map (from) should not exist after rename",
+        )
+
+        runivar = SimpleModule("r.univar", flags="g", map="exists")
         self.runModule(runivar, expecting_stdout=True)
         self.runModule(runivar, expecting_stdout=True)
-        new_runivar = text_to_keyvalue(runivar.outputs.stdout,
-                                       sep='=', skip_empty=True)
+        new_runivar = text_to_keyvalue(runivar.outputs.stdout, sep="=", skip_empty=True)
 
 
         # both these tests are probably redundant but let's test thoroughly
         # both these tests are probably redundant but let's test thoroughly
-        if keyvalue_equals(dict_a=original_runivar_target, dict_b=new_runivar,
-                           precision=1e-7):
+        if keyvalue_equals(
+            dict_a=original_runivar_target, dict_b=new_runivar, precision=1e-7
+        ):
             msg = "Raster map did not change. It probably wasn't overwritten."
             msg = "Raster map did not change. It probably wasn't overwritten."
             self.fail(msg)
             self.fail(msg)
 
 
-        if not keyvalue_equals(dict_a=original_runivar_source, dict_b=new_runivar,
-                               precision=1e-7):
-            unused, missing, mismatch = diff_keyvalue(dict_a=original_runivar_source,
-                                                      dict_b=new_runivar,
-                                                      precision=1e-7)
+        if not keyvalue_equals(
+            dict_a=original_runivar_source, dict_b=new_runivar, precision=1e-7
+        ):
+            unused, missing, mismatch = diff_keyvalue(
+                dict_a=original_runivar_source, dict_b=new_runivar, precision=1e-7
+            )
             if mismatch:
             if mismatch:
                 msg = "Destination raster map is not the same as source."
                 msg = "Destination raster map is not the same as source."
                 msg += " It probably wasn't overwritten.\n"
                 msg += " It probably wasn't overwritten.\n"
@@ -116,5 +128,5 @@ class RasterRenameTestCase(TestCase):
                 self.fail(msg)
                 self.fail(msg)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 11 - 11
lib/gis/testsuite/gis_lib_env_test.py

@@ -5,15 +5,15 @@
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 import grass.lib.gis as libgis
 import grass.lib.gis as libgis
 
 
-class GisLibraryTestEnv(TestCase):
 
 
+class GisLibraryTestEnv(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         libgis.G_gisinit("GisLibraryTestEnv")
         libgis.G_gisinit("GisLibraryTestEnv")
 
 
     def test_gisrc(self):
     def test_gisrc(self):
         # File access
         # File access
-        libgis.G_setenv("TEST", "A");
+        libgis.G_setenv("TEST", "A")
 
 
         value = libgis.G_getenv("TEST")
         value = libgis.G_getenv("TEST")
         self.assertEqual(value, b"A")
         self.assertEqual(value, b"A")
@@ -21,7 +21,7 @@ class GisLibraryTestEnv(TestCase):
         self.assertEqual(value, b"A")
         self.assertEqual(value, b"A")
 
 
         # In memory management
         # In memory management
-        libgis.G_setenv_nogisrc("TEST", "B");
+        libgis.G_setenv_nogisrc("TEST", "B")
 
 
         value = libgis.G_getenv_nofatal("TEST")
         value = libgis.G_getenv_nofatal("TEST")
         self.assertEqual(value, b"B")
         self.assertEqual(value, b"B")
@@ -35,12 +35,12 @@ class GisLibraryTestEnv(TestCase):
         self.assertEqual(value, b"A")
         self.assertEqual(value, b"A")
 
 
     def test_switch_env(self):
     def test_switch_env(self):
-        libgis.G_setenv_nogisrc("TEST", "SWITCH");
-        libgis.G_setenv_nogisrc2("TEST", "SWITCH2", libgis.G_VAR_MAPSET);
+        libgis.G_setenv_nogisrc("TEST", "SWITCH")
+        libgis.G_setenv_nogisrc2("TEST", "SWITCH2", libgis.G_VAR_MAPSET)
         # Create alternative env
         # Create alternative env
         libgis.G_create_alt_env()
         libgis.G_create_alt_env()
-        libgis.G_setenv_nogisrc("TEST", "TARGET");
-        libgis.G_setenv_nogisrc2("TEST", "TARGET2", libgis.G_VAR_MAPSET);
+        libgis.G_setenv_nogisrc("TEST", "TARGET")
+        libgis.G_setenv_nogisrc2("TEST", "TARGET2", libgis.G_VAR_MAPSET)
         value = libgis.G_getenv("TEST")
         value = libgis.G_getenv("TEST")
         self.assertEqual(value, b"TARGET")
         self.assertEqual(value, b"TARGET")
         value = libgis.G_getenv2("TEST", libgis.G_VAR_MAPSET)
         value = libgis.G_getenv2("TEST", libgis.G_VAR_MAPSET)
@@ -54,11 +54,11 @@ class GisLibraryTestEnv(TestCase):
 
 
     def test_mapset(self):
     def test_mapset(self):
         # Mapset VAR file
         # Mapset VAR file
-        libgis.G_setenv2("TEST", "C", libgis.G_VAR_MAPSET);
+        libgis.G_setenv2("TEST", "C", libgis.G_VAR_MAPSET)
         value = libgis.G_getenv2("TEST", libgis.G_VAR_MAPSET)
         value = libgis.G_getenv2("TEST", libgis.G_VAR_MAPSET)
         self.assertEqual(value, b"C")
         self.assertEqual(value, b"C")
 
 
-        libgis.G_setenv_nogisrc2("TEST", "D", libgis.G_VAR_MAPSET);
+        libgis.G_setenv_nogisrc2("TEST", "D", libgis.G_VAR_MAPSET)
         value = libgis.G_getenv_nofatal2("TEST", libgis.G_VAR_MAPSET)
         value = libgis.G_getenv_nofatal2("TEST", libgis.G_VAR_MAPSET)
         self.assertEqual(value, b"D")
         self.assertEqual(value, b"D")
         # Force reading
         # Force reading
@@ -67,7 +67,7 @@ class GisLibraryTestEnv(TestCase):
         self.assertEqual(value, b"C")
         self.assertEqual(value, b"C")
 
 
 
 
-
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 6 - 11
lib/gis/testsuite/gis_lib_str_color.py

@@ -23,16 +23,11 @@ class StringToColorTestCase(TestCase):
         g = c_int()
         g = c_int()
         b = c_int()
         b = c_int()
         ret = libgis.G_str_to_color(string, byref(r), byref(g), byref(b))
         ret = libgis.G_str_to_color(string, byref(r), byref(g), byref(b))
-        colors = ("{string} -> "
-                  "{r.value}, {g.value}, {b.value}".format(**locals()))
-        self.assertEqual(ret, 1,
-                         msg="Not successful return code (%s)" % colors)
-        self.assertEqual(r.value, red,
-                         msg="Wrong number for red (%s)" % colors)
-        self.assertEqual(g.value, green,
-                         msg="Wrong number for green (%s)" % colors)
-        self.assertEqual(b.value, blue,
-                         msg="Wrong number for blue (%s)" % colors)
+        colors = "{string} -> " "{r.value}, {g.value}, {b.value}".format(**locals())
+        self.assertEqual(ret, 1, msg="Not successful return code (%s)" % colors)
+        self.assertEqual(r.value, red, msg="Wrong number for red (%s)" % colors)
+        self.assertEqual(g.value, green, msg="Wrong number for green (%s)" % colors)
+        self.assertEqual(b.value, blue, msg="Wrong number for blue (%s)" % colors)
 
 
     def test_grass_format(self):
     def test_grass_format(self):
         """Test GRASS GIS color format (RRR:GGG:BBB)"""
         """Test GRASS GIS color format (RRR:GGG:BBB)"""
@@ -106,5 +101,5 @@ class StringToColorTestCase(TestCase):
         self.convert_color("white", 255, 255, 255)
         self.convert_color("white", 255, 255, 255)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 10 - 6
lib/gis/testsuite/gis_lib_tokenize.py

@@ -34,9 +34,11 @@ class TokenizeTestCase(TestCase):
         tokens = libgis.G_tokenize("a,'b,c',d", ",")
         tokens = libgis.G_tokenize("a,'b,c',d", ",")
         num_of_tokens = libgis.G_number_of_tokens(tokens)
         num_of_tokens = libgis.G_number_of_tokens(tokens)
         self.assertEqual(
         self.assertEqual(
-            num_of_tokens, 4,
+            num_of_tokens,
+            4,
             msg="Got wrong number of tokens (expecting that the text"
             msg="Got wrong number of tokens (expecting that the text"
-                "delimiter is ignored)")
+            "delimiter is ignored)",
+        )
         # alternatively this can be done using test with expected failure
         # alternatively this can be done using test with expected failure
 
 
 
 
@@ -57,7 +59,7 @@ class Tokenize2TestCase(TestCase):
 
 
     def test_tokenize2_with_alternative_text_delim(self):
     def test_tokenize2_with_alternative_text_delim(self):
         """Test G_tokenize2 with ; as delim and double quote text delim"""
         """Test G_tokenize2 with ; as delim and double quote text delim"""
-        tokens = libgis.G_tokenize2('a;"b;c";d', ';', '"')
+        tokens = libgis.G_tokenize2('a;"b;c";d', ";", '"')
         num_of_tokens = libgis.G_number_of_tokens(tokens)
         num_of_tokens = libgis.G_number_of_tokens(tokens)
         self.assertEqual(num_of_tokens, 3, msg="Got wrong number of tokens")
         self.assertEqual(num_of_tokens, 3, msg="Got wrong number of tokens")
 
 
@@ -70,12 +72,14 @@ class Tokenize2TestCase(TestCase):
     def test_tokenize2_with_real_text(self):
     def test_tokenize2_with_real_text(self):
         """Test G_tokenize2 with real world text"""
         """Test G_tokenize2 with real world text"""
         tokens = libgis.G_tokenize2(
         tokens = libgis.G_tokenize2(
-            '440,617722.81,3464034.494,951.987,'
+            "440,617722.81,3464034.494,951.987,"
             '"Low Erosion (1,5)","High Deposition (8,6)"',
             '"Low Erosion (1,5)","High Deposition (8,6)"',
-            ',', '"')
+            ",",
+            '"',
+        )
         num_of_tokens = libgis.G_number_of_tokens(tokens)
         num_of_tokens = libgis.G_number_of_tokens(tokens)
         self.assertEqual(num_of_tokens, 6, msg="Got wrong number of tokens")
         self.assertEqual(num_of_tokens, 6, msg="Got wrong number of tokens")
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 39 - 25
lib/gis/testsuite/test_parser_json.py

@@ -16,24 +16,36 @@ import json
 
 
 class TestParserJson(TestCase):
 class TestParserJson(TestCase):
     def test_r_slope_aspect_json(self):
     def test_r_slope_aspect_json(self):
-        args = ["r.slope.aspect",
-                "elevation=elevation+https://storage.googleapis.com/graas-geodata/elev_ned_30m.tif",
-                "slope=slope+GTiff",
-                "aspect=aspect+GTiff", "--json"]
+        args = [
+            "r.slope.aspect",
+            "elevation=elevation+https://storage.googleapis.com/graas-geodata/elev_ned_30m.tif",
+            "slope=slope+GTiff",
+            "aspect=aspect+GTiff",
+            "--json",
+        ]
 
 
         inputs = [
         inputs = [
-            {"param": "elevation", "value": "elevation+https://storage.googleapis.com/graas-geodata/elev_ned_30m.tif"},
+            {
+                "param": "elevation",
+                "value": "elevation+https://storage.googleapis.com/graas-geodata/elev_ned_30m.tif",
+            },
             {"param": "format", "value": "degrees"},
             {"param": "format", "value": "degrees"},
             {"param": "precision", "value": "FCELL"},
             {"param": "precision", "value": "FCELL"},
             {"param": "zscale", "value": "1.0"},
             {"param": "zscale", "value": "1.0"},
-            {"param": "min_slope", "value": "0.0"}
+            {"param": "min_slope", "value": "0.0"},
         ]
         ]
 
 
         outputs = [
         outputs = [
-            {"export": {"format": "GTiff", "type": "raster"},
-             "param": "slope", "value": "slope"},
-            {"export": {"format": "GTiff", "type": "raster"},
-             "param": "aspect", "value": "aspect"}
+            {
+                "export": {"format": "GTiff", "type": "raster"},
+                "param": "slope",
+                "value": "slope",
+            },
+            {
+                "export": {"format": "GTiff", "type": "raster"},
+                "param": "aspect",
+                "value": "aspect",
+            },
         ]
         ]
 
 
         stdout, stderr = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
         stdout, stderr = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
@@ -45,10 +57,12 @@ class TestParserJson(TestCase):
         self.assertEqual(json_code["outputs"], outputs)
         self.assertEqual(json_code["outputs"], outputs)
 
 
     def test_v_out_ascii(self):
     def test_v_out_ascii(self):
-        args = ["v.out.ascii",
-                "input=hospitals@PERMANENT",
-                "output=myfile+TXT",
-                "--json"]
+        args = [
+            "v.out.ascii",
+            "input=hospitals@PERMANENT",
+            "output=myfile+TXT",
+            "--json",
+        ]
 
 
         inputs = [
         inputs = [
             {"param": "input", "value": "hospitals@PERMANENT"},
             {"param": "input", "value": "hospitals@PERMANENT"},
@@ -56,12 +70,15 @@ class TestParserJson(TestCase):
             {"param": "type", "value": "point,line,boundary,centroid,area,face,kernel"},
             {"param": "type", "value": "point,line,boundary,centroid,area,face,kernel"},
             {"param": "format", "value": "point"},
             {"param": "format", "value": "point"},
             {"param": "separator", "value": "pipe"},
             {"param": "separator", "value": "pipe"},
-            {"param": "precision", "value": "8"}
+            {"param": "precision", "value": "8"},
         ]
         ]
 
 
         outputs = [
         outputs = [
-            {"export": {"format": "TXT", "type": "file"},
-             "param": "output", "value": "$file::myfile"}
+            {
+                "export": {"format": "TXT", "type": "file"},
+                "param": "output",
+                "value": "$file::myfile",
+            }
         ]
         ]
 
 
         stdout, stderr = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
         stdout, stderr = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
@@ -73,15 +90,12 @@ class TestParserJson(TestCase):
         self.assertEqual(json_code["outputs"], outputs)
         self.assertEqual(json_code["outputs"], outputs)
 
 
     def test_v_info(self):
     def test_v_info(self):
-        args = ["v.info",
-                "map=hospitals@PERMANENT",
-                "-c",
-                "--json"]
+        args = ["v.info", "map=hospitals@PERMANENT", "-c", "--json"]
 
 
         inputs = [
         inputs = [
-         {"param": "map", "value": "hospitals@PERMANENT"},
-         {"param": "layer", "value": "1"}
-            ]
+            {"param": "map", "value": "hospitals@PERMANENT"},
+            {"param": "layer", "value": "1"},
+        ]
 
 
         stdout, stderr = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
         stdout, stderr = subprocess.Popen(args, stdout=subprocess.PIPE).communicate()
         print(stdout)
         print(stdout)
@@ -91,7 +105,7 @@ class TestParserJson(TestCase):
         self.assertEqual(json_code["inputs"], inputs)
         self.assertEqual(json_code["inputs"], inputs)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
 
 
     test()
     test()

+ 27 - 19
lib/raster/testsuite/rast_parse_color_rule.py

@@ -29,8 +29,8 @@ class ParseSingleColorRuleColorsTestCase(TestCase):
         """
         """
         # we are not testing value, but color, so using these values
         # we are not testing value, but color, so using these values
         # so that value and percentage can be used interchangeably
         # so that value and percentage can be used interchangeably
-        min_val = 0.
-        max_val = 100.
+        min_val = 0.0
+        max_val = 100.0
         r = c_int()
         r = c_int()
         g = c_int()
         g = c_int()
         b = c_int()
         b = c_int()
@@ -39,23 +39,31 @@ class ParseSingleColorRuleColorsTestCase(TestCase):
         norm = c_int()
         norm = c_int()
         nv = c_int()
         nv = c_int()
         default = c_int()
         default = c_int()
-        ret = Rast_parse_color_rule(min_val, max_val, string,
-                                    byref(v), byref(r), byref(g), byref(b),
-                                    byref(norm), byref(nv), byref(default))
-        colors = ("{string} -> "
-                  "{v.value}: {r.value}, {g.value}, {b.value}".format(**locals()))
+        ret = Rast_parse_color_rule(
+            min_val,
+            max_val,
+            string,
+            byref(v),
+            byref(r),
+            byref(g),
+            byref(b),
+            byref(norm),
+            byref(nv),
+            byref(default),
+        )
+        colors = "{string} -> " "{v.value}: {r.value}, {g.value}, {b.value}".format(
+            **locals()
+        )
         error_text = Rast_parse_color_rule_error(ret)
         error_text = Rast_parse_color_rule_error(ret)
-        self.assertEqual(error_text, b"",
-                         msg=("Conversion not successful (%s): %s (%s)"
-                              % (colors, error_text, ret)))
-        self.assertEqual(v.value, value,
-                         msg="Wrong number for value (%s)" % colors)
-        self.assertEqual(r.value, red,
-                         msg="Wrong number for red (%s)" % colors)
-        self.assertEqual(g.value, green,
-                         msg="Wrong number for green (%s)" % colors)
-        self.assertEqual(b.value, blue,
-                         msg="Wrong number for blue (%s)" % colors)
+        self.assertEqual(
+            error_text,
+            b"",
+            msg=("Conversion not successful (%s): %s (%s)" % (colors, error_text, ret)),
+        )
+        self.assertEqual(v.value, value, msg="Wrong number for value (%s)" % colors)
+        self.assertEqual(r.value, red, msg="Wrong number for red (%s)" % colors)
+        self.assertEqual(g.value, green, msg="Wrong number for green (%s)" % colors)
+        self.assertEqual(b.value, blue, msg="Wrong number for blue (%s)" % colors)
 
 
     def test_grass_format_separators(self):
     def test_grass_format_separators(self):
         """Test GRASS GIS color format with all allowed separators"""
         """Test GRASS GIS color format with all allowed separators"""
@@ -94,5 +102,5 @@ class ParseSingleColorRuleColorsTestCase(TestCase):
         self.convert_rule("   15 white", 15, 255, 255, 255)
         self.convert_rule("   15 white", 15, 255, 255, 255)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 73 - 12
lib/raster3d/testsuite/raster3d_lib_test.py

@@ -4,8 +4,8 @@
 """
 """
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 
 
-class Raster3dLibraryTest(TestCase):
 
 
+class Raster3dLibraryTest(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.runModule("g.gisenv", set="OVERWRITE=1")
         cls.runModule("g.gisenv", set="OVERWRITE=1")
@@ -20,19 +20,80 @@ class Raster3dLibraryTest(TestCase):
 
 
     def test_large_tilesizes(self):
     def test_large_tilesizes(self):
         """Test for different tile sizes"""
         """Test for different tile sizes"""
-        self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87)
-        self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=8)
-        self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=512)
-        self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=1024)
-        self.assertModule("test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=32768)
+        self.assertModule(
+            "test.raster3d.lib", unit="large", depths=91, rows=89, cols=87
+        )
+        self.assertModule(
+            "test.raster3d.lib", unit="large", depths=91, rows=89, cols=87, tile_size=8
+        )
+        self.assertModule(
+            "test.raster3d.lib",
+            unit="large",
+            depths=91,
+            rows=89,
+            cols=87,
+            tile_size=512,
+        )
+        self.assertModule(
+            "test.raster3d.lib",
+            unit="large",
+            depths=91,
+            rows=89,
+            cols=87,
+            tile_size=1024,
+        )
+        self.assertModule(
+            "test.raster3d.lib",
+            unit="large",
+            depths=91,
+            rows=89,
+            cols=87,
+            tile_size=32768,
+        )
 
 
         # Enable zlib compression
         # Enable zlib compression
-        self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87)
-        self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87, tile_size=8)
-        self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87, tile_size=512)
-        self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87, tile_size=1024)
-        self.assertModule("test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87, tile_size=32768)
+        self.assertModule(
+            "test.raster3d.lib", flags="l", unit="large", depths=91, rows=89, cols=87
+        )
+        self.assertModule(
+            "test.raster3d.lib",
+            flags="l",
+            unit="large",
+            depths=91,
+            rows=89,
+            cols=87,
+            tile_size=8,
+        )
+        self.assertModule(
+            "test.raster3d.lib",
+            flags="l",
+            unit="large",
+            depths=91,
+            rows=89,
+            cols=87,
+            tile_size=512,
+        )
+        self.assertModule(
+            "test.raster3d.lib",
+            flags="l",
+            unit="large",
+            depths=91,
+            rows=89,
+            cols=87,
+            tile_size=1024,
+        )
+        self.assertModule(
+            "test.raster3d.lib",
+            flags="l",
+            unit="large",
+            depths=91,
+            rows=89,
+            cols=87,
+            tile_size=32768,
+        )
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 17 - 9
lib/vector/Vlib/testsuite/test_vlib_box.py

@@ -50,13 +50,17 @@ class TestPointInBoundingBox(TestCase):
 
 
     def check_point_in_3d(self, x, y, z):
     def check_point_in_3d(self, x, y, z):
         """Wraps Vect_point_in_box() with assert and a message"""
         """Wraps Vect_point_in_box() with assert and a message"""
-        self.assertTrue(libvect.Vect_point_in_box(x, y, z, self.c_bbox),
-                        msg="Point should be inside the bbox")
+        self.assertTrue(
+            libvect.Vect_point_in_box(x, y, z, self.c_bbox),
+            msg="Point should be inside the bbox",
+        )
 
 
     def check_point_out_3d(self, x, y, z):
     def check_point_out_3d(self, x, y, z):
         """Wraps Vect_point_in_box() with assert and a message"""
         """Wraps Vect_point_in_box() with assert and a message"""
-        self.assertFalse(libvect.Vect_point_in_box(x, y, z, self.c_bbox),
-                         msg="Point should be outside the bbox")
+        self.assertFalse(
+            libvect.Vect_point_in_box(x, y, z, self.c_bbox),
+            msg="Point should be outside the bbox",
+        )
 
 
     def test_bbox_2d_in(self):
     def test_bbox_2d_in(self):
         """Check Vect_point_in_box_2d() function with 2D points inside bbox"""
         """Check Vect_point_in_box_2d() function with 2D points inside bbox"""
@@ -73,14 +77,18 @@ class TestPointInBoundingBox(TestCase):
 
 
     def check_point_in_2d(self, x, y):
     def check_point_in_2d(self, x, y):
         """Wraps Vect_point_in_box_2d() with assert, message and bbox"""
         """Wraps Vect_point_in_box_2d() with assert, message and bbox"""
-        self.assertTrue(libvect.Vect_point_in_box_2d(x, y, self.c_bbox),
-                        msg="Point should be inside the bbox")
+        self.assertTrue(
+            libvect.Vect_point_in_box_2d(x, y, self.c_bbox),
+            msg="Point should be inside the bbox",
+        )
 
 
     def check_point_out_2d(self, x, y):
     def check_point_out_2d(self, x, y):
         """Wraps Vect_point_in_box_2d() with assert, message and bbox"""
         """Wraps Vect_point_in_box_2d() with assert, message and bbox"""
-        self.assertFalse(libvect.Vect_point_in_box_2d(x, y, self.c_bbox),
-                         msg="Point should be outside the bbox")
+        self.assertFalse(
+            libvect.Vect_point_in_box_2d(x, y, self.c_bbox),
+            msg="Point should be outside the bbox",
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 0 - 3
pyproject.toml

@@ -29,9 +29,6 @@ exclude = '''
     | general
     | general
     | gui
     | gui
     | imagery
     | imagery
-    | lib/gis
-    | raster
-    | vector
     | docker/testdata/test_grass_session.py
     | docker/testdata/test_grass_session.py
     | display/d.mon/render_cmd.py
     | display/d.mon/render_cmd.py
 )
 )

+ 84 - 28
raster/r.basins.fill/testsuite/testrbf.py

@@ -11,55 +11,111 @@ Licence:    This program is free software under the GNU General Public
 import unittest
 import unittest
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 
 
+
 @unittest.skip("See #3822")
 @unittest.skip("See #3822")
 class TestRasterbasin(TestCase):
 class TestRasterbasin(TestCase):
-    celevation='elevation'
-    tgeology='geology'
-    output='basinsoutput'
-    input="lakes"
+    celevation = "elevation"
+    tgeology = "geology"
+    output = "basinsoutput"
+    input = "lakes"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         seed = 500
         seed = 500
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.tgeology, flags='p')
-        cls.runModule('r.watershed', elevation='elevation', stream=cls.celevation, threshold='50000', overwrite=True)
-        cls.runModule('r.geomorphon', elevation=cls.celevation, forms=cls.tgeology, overwrite=True)
-        cls.runModule('r.mapcalc', seed=seed, expression='rand_cell = rand(1, 200)', overwrite=True)
-        cls.runModule('r.thin', input=cls.input, output=cls.output)
-
+        cls.runModule("g.region", raster=cls.tgeology, flags="p")
+        cls.runModule(
+            "r.watershed",
+            elevation="elevation",
+            stream=cls.celevation,
+            threshold="50000",
+            overwrite=True,
+        )
+        cls.runModule(
+            "r.geomorphon", elevation=cls.celevation, forms=cls.tgeology, overwrite=True
+        )
+        cls.runModule(
+            "r.mapcalc",
+            seed=seed,
+            expression="rand_cell = rand(1, 200)",
+            overwrite=True,
+        )
+        cls.runModule("r.thin", input=cls.input, output=cls.output)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(cls):
     def tearDown(cls):
-        cls.runModule('g.remove', flags='f', type='raster', name=cls.output)
+        cls.runModule("g.remove", flags="f", type="raster", name=cls.output)
 
 
     def test_no1(self):
     def test_no1(self):
-        lakes='lakes'
-        self.assertModule('r.basins.fill', cnetwork=self.celevation, tnetwork=self.tgeology, output=self.output, number='1', overwrite=True)
-        self.assertRasterMinMax(map=lakes, refmin=34300, refmax=43600,
-                                msg="lakes in degrees must be between 34300 and 43600")
+        lakes = "lakes"
+        self.assertModule(
+            "r.basins.fill",
+            cnetwork=self.celevation,
+            tnetwork=self.tgeology,
+            output=self.output,
+            number="1",
+            overwrite=True,
+        )
+        self.assertRasterMinMax(
+            map=lakes,
+            refmin=34300,
+            refmax=43600,
+            msg="lakes in degrees must be between 34300 and 43600",
+        )
 
 
     def test_no2(self):
     def test_no2(self):
-        soils='soils'
-        self.assertModule('r.basins.fill', cnetwork=self.celevation, tnetwork=self.tgeology, output=self.output, number='3')
-        self.assertRasterMinMax(map=soils, refmin=18683, refmax=46555,
-                                msg="soils in degrees must be between 18683 and 46555")
+        soils = "soils"
+        self.assertModule(
+            "r.basins.fill",
+            cnetwork=self.celevation,
+            tnetwork=self.tgeology,
+            output=self.output,
+            number="3",
+        )
+        self.assertRasterMinMax(
+            map=soils,
+            refmin=18683,
+            refmax=46555,
+            msg="soils in degrees must be between 18683 and 46555",
+        )
 
 
     def test_no3(self):
     def test_no3(self):
-        landuse='landuse'
-        self.assertModule('r.basins.fill', cnetwork=self.celevation, tnetwork=self.tgeology, output=self.output, number='4')
-        self.assertRasterMinMax(map=landuse, refmin=1, refmax=7,
-                                msg="landuse in degrees must be between 1 and 7")
+        landuse = "landuse"
+        self.assertModule(
+            "r.basins.fill",
+            cnetwork=self.celevation,
+            tnetwork=self.tgeology,
+            output=self.output,
+            number="4",
+        )
+        self.assertRasterMinMax(
+            map=landuse,
+            refmin=1,
+            refmax=7,
+            msg="landuse in degrees must be between 1 and 7",
+        )
 
 
     def test_no4(self):
     def test_no4(self):
-        rand_cell='rand_cell'
-        self.assertModule('r.basins.fill', cnetwork=self.celevation, tnetwork=self.tgeology, output=self.output, number='5')
-        self.assertRasterMinMax(map=rand_cell, refmin=1, refmax=199,
-                                msg="rand_cell in degrees must be between 1 and 199")
+        rand_cell = "rand_cell"
+        self.assertModule(
+            "r.basins.fill",
+            cnetwork=self.celevation,
+            tnetwork=self.tgeology,
+            output=self.output,
+            number="5",
+        )
+        self.assertRasterMinMax(
+            map=rand_cell,
+            refmin=1,
+            refmax=199,
+            msg="rand_cell in degrees must be between 1 and 199",
+        )
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 117 - 83
raster/r.contour/testsuite/test_r_contour.py

@@ -1,83 +1,117 @@
-"""
-Name:       r.contour test
-Purpose:    Tests r.contour module and its options.
-
-Author:     Shubham Sharma, Google Code-in 2018
-Copyright:  (C) 2018 by Shubham Sharma and the GRASS Development Team
-Licence:    This program is free software under the GNU General Public
-            License (>=v2). Read the file COPYING that comes with GRASS
-            for details.
-"""
-
-from grass.gunittest.case import TestCase
-import os
-
-class TestRasterWhat(TestCase):
-    input = 'elevation'
-    output = 'elevationVector'
-    step = 100
-    levels = (60, 90, 120, 150)
-    minlevel = 1000
-    maxlevel = 2000
-    cut = 200
-    test_ref_str = "cat|level\n1|60\n2|90\n3|120\n4|150\n"
-
-    @classmethod
-    def setUpClass(cls):
-        cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input)
-
-    @classmethod
-    def tearDownClass(cls):
-        cls.del_temp_region()
-
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.output)
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.output+"_cut")
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.output+"_cut_flag_t")
-
-        if os.path.isfile('testReport'):
-            os.remove('testReport')
-        if os.path.isfile('testReportCut'):
-            os.remove('testReportCut')
-        if os.path.isfile('testReportCutFlagT'):
-            os.remove('testReportCutFlagT')
-
-
-
-    def test_raster_contour(self):
-        """Testing r.contour runs successfully with input steps,levels, minlevel, maxlevel"""
-        self.assertModule('r.contour', input=self.input, output=self.output, step=self.step, levels=self.levels, minlevel=self.minlevel, maxlevel=self.maxlevel)
-        self.assertVectorExists(name=self.output, msg=self.output+" was not created.")
-
-        # Check the attribute values of contours with v.db.select
-        self.assertModule('v.db.select', map=self.output, file='testReport')
-        self.assertFileExists('testReport', msg='testReport file was not created')
-        if os.path.isfile('testReport'):
-            file = open("testReport", "r")
-            fileData = file.read()
-            self.assertMultiLineEqual(fileData, self.test_ref_str)
-            file.close()
-
-    def test_raster_contour_cut(self):
-        """Testing r.contour runs successfully with input steps,levels, minlevel, maxlevel and cut=100"""
-        self.assertModule('r.contour', input=self.input, output=self.output+"_cut", step=self.step, levels=self.levels, minlevel=self.minlevel, maxlevel=self.maxlevel,cut=self.cut)
-        self.assertVectorExists(name=self.output+"_cut", msg=self.output+" was not created.")
-
-        # Check the attribute values of contours with v.db.select
-        self.assertModule('v.db.select', map=self.output+"_cut", file='testReportCut')
-        self.assertFileExists('testReportCut', msg='testReportCut file was not created')
-        if os.path.isfile('testReportCut'):
-            file = open("testReportCut", "r")
-            fileData = file.read()
-            self.assertMultiLineEqual(fileData, self.test_ref_str)
-            file.close()
-
-    def test_raster_contour_flag_t(self):
-        """Testing r.contour runs successfully with input steps,levels, minlevel, maxlevel ,cut=100 and flag t"""
-        self.assertModule('r.contour', input=self.input, output=self.output+"_cut_flag_t", flags='t', step=self.step, levels=self.levels, minlevel=self.minlevel, maxlevel=self.maxlevel, cut=self.cut)
-        self.assertVectorExists(name=self.output+"_cut_flag_t", msg=self.output+" was not created.")
-        # No need to check the attribute values of contours because attribute table was not created
-
-if __name__ == '__main__':
-    from grass.gunittest.main import test
-    test()
+"""
+Name:       r.contour test
+Purpose:    Tests r.contour module and its options.
+
+Author:     Shubham Sharma, Google Code-in 2018
+Copyright:  (C) 2018 by Shubham Sharma and the GRASS Development Team
+Licence:    This program is free software under the GNU General Public
+            License (>=v2). Read the file COPYING that comes with GRASS
+            for details.
+"""
+
+from grass.gunittest.case import TestCase
+import os
+
+
+class TestRasterWhat(TestCase):
+    input = "elevation"
+    output = "elevationVector"
+    step = 100
+    levels = (60, 90, 120, 150)
+    minlevel = 1000
+    maxlevel = 2000
+    cut = 200
+    test_ref_str = "cat|level\n1|60\n2|90\n3|120\n4|150\n"
+
+    @classmethod
+    def setUpClass(cls):
+        cls.use_temp_region()
+        cls.runModule("g.region", raster=cls.input)
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.del_temp_region()
+
+        cls.runModule("g.remove", type="vector", flags="f", name=cls.output)
+        cls.runModule("g.remove", type="vector", flags="f", name=cls.output + "_cut")
+        cls.runModule(
+            "g.remove", type="vector", flags="f", name=cls.output + "_cut_flag_t"
+        )
+
+        if os.path.isfile("testReport"):
+            os.remove("testReport")
+        if os.path.isfile("testReportCut"):
+            os.remove("testReportCut")
+        if os.path.isfile("testReportCutFlagT"):
+            os.remove("testReportCutFlagT")
+
+    def test_raster_contour(self):
+        """Testing r.contour runs successfully with input steps,levels, minlevel, maxlevel"""
+        self.assertModule(
+            "r.contour",
+            input=self.input,
+            output=self.output,
+            step=self.step,
+            levels=self.levels,
+            minlevel=self.minlevel,
+            maxlevel=self.maxlevel,
+        )
+        self.assertVectorExists(name=self.output, msg=self.output + " was not created.")
+
+        # Check the attribute values of contours with v.db.select
+        self.assertModule("v.db.select", map=self.output, file="testReport")
+        self.assertFileExists("testReport", msg="testReport file was not created")
+        if os.path.isfile("testReport"):
+            file = open("testReport", "r")
+            fileData = file.read()
+            self.assertMultiLineEqual(fileData, self.test_ref_str)
+            file.close()
+
+    def test_raster_contour_cut(self):
+        """Testing r.contour runs successfully with input steps,levels, minlevel, maxlevel and cut=100"""
+        self.assertModule(
+            "r.contour",
+            input=self.input,
+            output=self.output + "_cut",
+            step=self.step,
+            levels=self.levels,
+            minlevel=self.minlevel,
+            maxlevel=self.maxlevel,
+            cut=self.cut,
+        )
+        self.assertVectorExists(
+            name=self.output + "_cut", msg=self.output + " was not created."
+        )
+
+        # Check the attribute values of contours with v.db.select
+        self.assertModule("v.db.select", map=self.output + "_cut", file="testReportCut")
+        self.assertFileExists("testReportCut", msg="testReportCut file was not created")
+        if os.path.isfile("testReportCut"):
+            file = open("testReportCut", "r")
+            fileData = file.read()
+            self.assertMultiLineEqual(fileData, self.test_ref_str)
+            file.close()
+
+    def test_raster_contour_flag_t(self):
+        """Testing r.contour runs successfully with input steps,levels, minlevel, maxlevel ,cut=100 and flag t"""
+        self.assertModule(
+            "r.contour",
+            input=self.input,
+            output=self.output + "_cut_flag_t",
+            flags="t",
+            step=self.step,
+            levels=self.levels,
+            minlevel=self.minlevel,
+            maxlevel=self.maxlevel,
+            cut=self.cut,
+        )
+        self.assertVectorExists(
+            name=self.output + "_cut_flag_t", msg=self.output + " was not created."
+        )
+        # No need to check the attribute values of contours because attribute table was not created
+
+
+if __name__ == "__main__":
+    from grass.gunittest.main import test
+
+    test()

+ 25 - 16
raster/r.contour/testsuite/testrc.py

@@ -12,7 +12,7 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
-out_where = u"""cat|level
+out_where = """cat|level
 1|56
 1|56
 2|58
 2|58
 3|60
 3|60
@@ -66,46 +66,55 @@ out_where = u"""cat|level
 51|156
 51|156
 """
 """
 
 
+
 class Testrr(TestCase):
 class Testrr(TestCase):
-    input='elevation'
-    output='towns'
+    input = "elevation"
+    output = "towns"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input)
+        cls.runModule("g.region", raster=cls.input)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
-
     def tearDown(cls):
     def tearDown(cls):
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.output)
-
+        cls.runModule("g.remove", type="vector", flags="f", name=cls.output)
 
 
     def test_flag_t(self):
     def test_flag_t(self):
         """Testing flag t"""
         """Testing flag t"""
-        string=u"""min=1
+        string = """min=1
         max=6"""
         max=6"""
-        self.assertModule('r.contour', input=self.input, output=self.output, levels=1, step=1, flags='t')
-        self.assertRasterFitsUnivar(self.output,
-                                reference=string, precision=2)
+        self.assertModule(
+            "r.contour",
+            input=self.input,
+            output=self.output,
+            levels=1,
+            step=1,
+            flags="t",
+        )
+        self.assertRasterFitsUnivar(self.output, reference=string, precision=2)
 
 
     def test_vector(self):
     def test_vector(self):
         """Testing vector output"""
         """Testing vector output"""
-        self.assertModule('r.contour', input=self.input, output=self.output, step=5, flags='t')
-        self.assertModule('v.info', map=self.output, flags='t')
+        self.assertModule(
+            "r.contour", input=self.input, output=self.output, step=5, flags="t"
+        )
+        self.assertModule("v.info", map=self.output, flags="t")
         topology = dict(points=0, lines=2222, areas=0)
         topology = dict(points=0, lines=2222, areas=0)
         self.assertVectorFitsTopoInfo(self.output, topology)
         self.assertVectorFitsTopoInfo(self.output, topology)
 
 
     def test_v_db_select(self):
     def test_v_db_select(self):
         """Testing attribute values of contours with v.db.select """
         """Testing attribute values of contours with v.db.select """
-        self.assertModule('r.contour', input=self.input, output=self.output, step=2)
-        v_db_select = SimpleModule('v.db.select', map=self.output)
+        self.assertModule("r.contour", input=self.input, output=self.output, step=2)
+        v_db_select = SimpleModule("v.db.select", map=self.output)
         v_db_select.run()
         v_db_select.run()
         self.assertLooksLike(reference=out_where, actual=v_db_select.outputs.stdout)
         self.assertLooksLike(reference=out_where, actual=v_db_select.outputs.stdout)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 73 - 19
raster/r.fill.stats/testsuite/test_r_fill_stats.py

@@ -5,39 +5,93 @@ from grass.gunittest.main import test
 
 
 class TestRFillStats(TestCase):
 class TestRFillStats(TestCase):
 
 
-    ascii = 'ascii'
-    stats = 'stats'
-    wmean = 'wmean'
-    mean = 'mean'
-    median = 'median'
-    mode = 'mode'
+    ascii = "ascii"
+    stats = "stats"
+    wmean = "wmean"
+    mean = "mean"
+    median = "median"
+    mode = "mode"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('r.in.ascii', input='data/input_ascii.txt', output=cls.ascii, type='CELL')
-        cls.runModule('r.in.ascii', input='data/output_wmean.txt', output=cls.wmean, type='DCELL')
-        cls.runModule('r.in.ascii', input='data/output_mean.txt', output=cls.mean, type='DCELL')
-        cls.runModule('r.in.ascii', input='data/output_median.txt', output=cls.median, type='DCELL')
-        cls.runModule('r.in.ascii', input='data/output_mode.txt', output=cls.mode, type='CELL')
-        cls.runModule('g.region', raster=cls.ascii)
+        cls.runModule(
+            "r.in.ascii", input="data/input_ascii.txt", output=cls.ascii, type="CELL"
+        )
+        cls.runModule(
+            "r.in.ascii", input="data/output_wmean.txt", output=cls.wmean, type="DCELL"
+        )
+        cls.runModule(
+            "r.in.ascii", input="data/output_mean.txt", output=cls.mean, type="DCELL"
+        )
+        cls.runModule(
+            "r.in.ascii",
+            input="data/output_median.txt",
+            output=cls.median,
+            type="DCELL",
+        )
+        cls.runModule(
+            "r.in.ascii", input="data/output_mode.txt", output=cls.mode, type="CELL"
+        )
+        cls.runModule("g.region", raster=cls.ascii)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', flags='f', type='raster',
-                      name=[cls.ascii, cls.wmean, cls.mean, cls.median, cls.mode])
+        cls.runModule(
+            "g.remove",
+            flags="f",
+            type="raster",
+            name=[cls.ascii, cls.wmean, cls.mean, cls.median, cls.mode],
+        )
 
 
     def test_stats(self):
     def test_stats(self):
         """Test if results match verified rasters"""
         """Test if results match verified rasters"""
-        self.assertModule('r.fill.stats', input=self.ascii, output=self.stats, distance=1, mode='wmean', power=2, cells=2, overwrite=True)
+        self.assertModule(
+            "r.fill.stats",
+            input=self.ascii,
+            output=self.stats,
+            distance=1,
+            mode="wmean",
+            power=2,
+            cells=2,
+            overwrite=True,
+        )
         self.assertRastersNoDifference(self.stats, self.wmean, precision=1e-6)
         self.assertRastersNoDifference(self.stats, self.wmean, precision=1e-6)
-        self.assertModule('r.fill.stats', input=self.ascii, output=self.stats, distance=1, mode='mean', power=2, cells=2, overwrite=True)
+        self.assertModule(
+            "r.fill.stats",
+            input=self.ascii,
+            output=self.stats,
+            distance=1,
+            mode="mean",
+            power=2,
+            cells=2,
+            overwrite=True,
+        )
         self.assertRastersNoDifference(self.stats, self.mean, precision=1e-6)
         self.assertRastersNoDifference(self.stats, self.mean, precision=1e-6)
-        self.assertModule('r.fill.stats', input=self.ascii, output=self.stats, distance=1, mode='median', power=2, cells=2, overwrite=True)
+        self.assertModule(
+            "r.fill.stats",
+            input=self.ascii,
+            output=self.stats,
+            distance=1,
+            mode="median",
+            power=2,
+            cells=2,
+            overwrite=True,
+        )
         self.assertRastersNoDifference(self.stats, self.median, precision=1e-6)
         self.assertRastersNoDifference(self.stats, self.median, precision=1e-6)
-        self.assertModule('r.fill.stats', input=self.ascii, output=self.stats, distance=1, mode='mode', power=2, cells=2, overwrite=True)
+        self.assertModule(
+            "r.fill.stats",
+            input=self.ascii,
+            output=self.stats,
+            distance=1,
+            mode="mode",
+            power=2,
+            cells=2,
+            overwrite=True,
+        )
         self.assertRastersNoDifference(self.stats, self.mode, precision=1e-6)
         self.assertRastersNoDifference(self.stats, self.mode, precision=1e-6)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 30 - 19
raster/r.geomorphon/testsuite/test_r_geom.py

@@ -14,8 +14,7 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.script.core import read_command
 from grass.script.core import read_command
 
 
-synth_out = \
-    """1	flat
+synth_out = """1	flat
 3	ridge
 3	ridge
 4	shoulder
 4	shoulder
 6	slope
 6	slope
@@ -23,8 +22,7 @@ synth_out = \
 9	valley
 9	valley
 """
 """
 
 
-ele_out = \
-    """1	flat
+ele_out = """1	flat
 2	summit
 2	summit
 3	ridge
 3	ridge
 4	shoulder
 4	shoulder
@@ -36,37 +34,50 @@ ele_out = \
 10	depression
 10	depression
 """
 """
 
 
+
 class TestClipling(TestCase):
 class TestClipling(TestCase):
-    inele = 'elevation'
-    insint = 'synthetic_dem'
-    outele = 'ele_geomorph'
-    outsint = 'synth_geomorph'
+    inele = "elevation"
+    insint = "synthetic_dem"
+    outele = "ele_geomorph"
+    outsint = "synth_geomorph"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and generated data"""
         """Ensures expected computational region and generated data"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.inele)
-        cls.runModule('r.mapcalc', expression="{ou} = sin(x() / 5.0) + (sin(x() / 5.0) * 100.0 + 200)".format(ou=cls.insint))
+        cls.runModule("g.region", raster=cls.inele)
+        cls.runModule(
+            "r.mapcalc",
+            expression="{ou} = sin(x() / 5.0) + (sin(x() / 5.0) * 100.0 + 200)".format(
+                ou=cls.insint
+            ),
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove the temporary region and generated data"""
         """Remove the temporary region and generated data"""
-        cls.runModule('g.remove', flags='f', type='raster',
-                      name=(cls.insint, cls.outele, cls.outsint))
+        cls.runModule(
+            "g.remove",
+            flags="f",
+            type="raster",
+            name=(cls.insint, cls.outele, cls.outsint),
+        )
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def test_ele(self):
     def test_ele(self):
-        self.runModule('r.geomorphon', elevation=self.inele, forms=self.outele,
-                      search=10)
-        category = read_command('r.category', map=self.outele)
+        self.runModule(
+            "r.geomorphon", elevation=self.inele, forms=self.outele, search=10
+        )
+        category = read_command("r.category", map=self.outele)
         self.assertEqual(first=ele_out, second=category)
         self.assertEqual(first=ele_out, second=category)
 
 
     def test_sint(self):
     def test_sint(self):
-        self.runModule('r.geomorphon', elevation=self.insint,
-                       forms=self.outsint, search=10)
-        category = read_command('r.category', map=self.outsint)
+        self.runModule(
+            "r.geomorphon", elevation=self.insint, forms=self.outsint, search=10
+        )
+        category = read_command("r.category", map=self.outsint)
         self.assertEqual(first=synth_out, second=category)
         self.assertEqual(first=synth_out, second=category)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 11 - 13
raster/r.grow.distance/testsuite/r_grow_distance_test.py

@@ -12,16 +12,16 @@ class TestGrowDistance(TestCase):
     """Test case for grow distance module"""
     """Test case for grow distance module"""
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    distance = 'test_distance'
-    lakes = 'lakes'
-    elevation = 'elevation'
+    distance = "test_distance"
+    lakes = "lakes"
+    elevation = "elevation"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and setup"""
         """Ensures expected computational region and setup"""
         # Always use the computational region of the raster elevation
         # Always use the computational region of the raster elevation
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.elevation)
+        cls.runModule("g.region", raster=cls.elevation)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
@@ -33,20 +33,18 @@ class TestGrowDistance(TestCase):
 
 
         This is executed after each test run.
         This is executed after each test run.
         """
         """
-        self.runModule('g.remove', flags='f', type='raster',
-                       name=self.distance)
+        self.runModule("g.remove", flags="f", type="raster", name=self.distance)
 
 
     def test_grow(self):
     def test_grow(self):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
         # run the grow distance module
         # run the grow distance module
-        self.assertModule('r.grow.distance', input=self.lakes,
-                          distance=self.distance)
+        self.assertModule("r.grow.distance", input=self.lakes, distance=self.distance)
         # check to see if distance output is in mapset
         # check to see if distance output is in mapset
-        self.assertRasterExists(self.distance,
-                                msg='distance output was not created')
-        self.assertRasterMinMax(self.distance, 0, 5322,
-                                msg='distance output not in range')
+        self.assertRasterExists(self.distance, msg="distance output was not created")
+        self.assertRasterMinMax(
+            self.distance, 0, 5322, msg="distance output not in range"
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 58 - 19
raster/r.gwflow/testsuite/validation_7x7_grid.py

@@ -9,8 +9,8 @@ year = "1995"
 """
 """
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 
 
-class Validation7x7Grid(TestCase):
 
 
+class Validation7x7Grid(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
@@ -19,16 +19,18 @@ class Validation7x7Grid(TestCase):
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        """!Remove the temporary region
-        """
+        """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def setUp(self):
     def setUp(self):
-        """Create input data for transient groundwater flow computation
-        """
+        """Create input data for transient groundwater flow computation"""
         self.runModule("r.mapcalc", expression="phead=50")
         self.runModule("r.mapcalc", expression="phead=50")
-        self.runModule("r.mapcalc", expression="status=if(col() == 1 || col() == 7 , 2, 1)")
-        self.runModule("r.mapcalc", expression="well=if((row() == 4 && col() == 4), -0.1, 0)")
+        self.runModule(
+            "r.mapcalc", expression="status=if(col() == 1 || col() == 7 , 2, 1)"
+        )
+        self.runModule(
+            "r.mapcalc", expression="well=if((row() == 4 && col() == 4), -0.1, 0)"
+        )
         self.runModule("r.mapcalc", expression="hydcond=0.0005")
         self.runModule("r.mapcalc", expression="hydcond=0.0005")
         self.runModule("r.mapcalc", expression="recharge=0")
         self.runModule("r.mapcalc", expression="recharge=0")
         self.runModule("r.mapcalc", expression="top_conf=20")
         self.runModule("r.mapcalc", expression="top_conf=20")
@@ -37,19 +39,51 @@ class Validation7x7Grid(TestCase):
         self.runModule("r.mapcalc", expression="null=0.0")
         self.runModule("r.mapcalc", expression="null=0.0")
 
 
     def test_transient(self):
     def test_transient(self):
-        #First compute the groundwater flow after 500 seconds to have initial conditions
-        self.assertModule("r.gwflow", flags="f", solver="cholesky", top="top_conf", bottom="bottom", phead="phead",
-         status="status", hc_x="hydcond", hc_y="hydcond", q="well", s="s",
-         recharge="recharge", output="gwresult_conf", dtime=500, type="confined", budget="water_budget", overwrite=True)
+        # First compute the groundwater flow after 500 seconds to have initial conditions
+        self.assertModule(
+            "r.gwflow",
+            flags="f",
+            solver="cholesky",
+            top="top_conf",
+            bottom="bottom",
+            phead="phead",
+            status="status",
+            hc_x="hydcond",
+            hc_y="hydcond",
+            q="well",
+            s="s",
+            recharge="recharge",
+            output="gwresult_conf",
+            dtime=500,
+            type="confined",
+            budget="water_budget",
+            overwrite=True,
+        )
 
 
         # loop over the timesteps each 500 seconds
         # loop over the timesteps each 500 seconds
         for i in range(20):
         for i in range(20):
-            self.assertModule("r.gwflow", flags="f", solver="cholesky", top="top_conf", bottom="bottom", phead="gwresult_conf",
-             status="status", hc_x="hydcond", hc_y="hydcond", q="well", s="s",
-             recharge="recharge", output="gwresult_conf", dtime=500, type="confined", budget="water_budget", overwrite=True)
+            self.assertModule(
+                "r.gwflow",
+                flags="f",
+                solver="cholesky",
+                top="top_conf",
+                bottom="bottom",
+                phead="gwresult_conf",
+                status="status",
+                hc_x="hydcond",
+                hc_y="hydcond",
+                q="well",
+                s="s",
+                recharge="recharge",
+                output="gwresult_conf",
+                dtime=500,
+                type="confined",
+                budget="water_budget",
+                overwrite=True,
+            )
 
 
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=49
+        univar_string = """n=49
         null_cells=0
         null_cells=0
         cells=49
         cells=49
         min=45.1219899394172
         min=45.1219899394172
@@ -63,7 +97,7 @@ class Validation7x7Grid(TestCase):
         sum=2405.00000082079"""
         sum=2405.00000082079"""
 
 
         # Output of r.info, only a subset of the output is needed
         # Output of r.info, only a subset of the output is needed
-        info_string="""north=700
+        info_string = """north=700
         south=0
         south=0
         east=700
         east=700
         west=0
         west=0
@@ -78,10 +112,15 @@ class Validation7x7Grid(TestCase):
         max=50
         max=50
         map=gwresult_conf"""
         map=gwresult_conf"""
 
 
-        self.assertRasterFitsUnivar(raster="gwresult_conf", reference=univar_string, precision=3)
-        self.assertRasterFitsInfo(raster="gwresult_conf", reference=info_string, precision=3)
+        self.assertRasterFitsUnivar(
+            raster="gwresult_conf", reference=univar_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="gwresult_conf", reference=info_string, precision=3
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 34 - 15
raster/r.gwflow/testsuite/validation_excavation.py

@@ -10,8 +10,8 @@ year = "1995"
 
 
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 
 
-class ValidationExcavation(TestCase):
 
 
+class ValidationExcavation(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
@@ -20,19 +20,20 @@ class ValidationExcavation(TestCase):
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        """!Remove the temporary region
-        """
+        """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def setUp(self):
     def setUp(self):
-        """Create input data for steady state groundwater flow computation
-        """
+        """Create input data for steady state groundwater flow computation"""
         self.runModule("r.mapcalc", expression="phead= if(row() == 19, 5, 3)")
         self.runModule("r.mapcalc", expression="phead= if(row() == 19, 5, 3)")
-        self.runModule("r.mapcalc", expression="status=if((col() == 1 && row() == 13) ||\
+        self.runModule(
+            "r.mapcalc",
+            expression="status=if((col() == 1 && row() == 13) ||\
                                       (col() == 1 && row() == 14) ||\
                                       (col() == 1 && row() == 14) ||\
                                       (col() == 2 && row() == 13) ||\
                                       (col() == 2 && row() == 13) ||\
                                       (col() == 2 && row() == 14) ||\
                                       (col() == 2 && row() == 14) ||\
-                                      (row() == 19), 2, 1)")
+                                      (row() == 19), 2, 1)",
+        )
 
 
         self.runModule("r.mapcalc", expression="hydcond=0.001")
         self.runModule("r.mapcalc", expression="hydcond=0.001")
         self.runModule("r.mapcalc", expression="recharge=0.000000006")
         self.runModule("r.mapcalc", expression="recharge=0.000000006")
@@ -42,13 +43,27 @@ class ValidationExcavation(TestCase):
         self.runModule("r.mapcalc", expression="null=0.0")
         self.runModule("r.mapcalc", expression="null=0.0")
 
 
     def test_steady_state(self):
     def test_steady_state(self):
-        #compute a steady state groundwater flow
-        self.assertModule("r.gwflow", flags="f", solver="cholesky", top="top", bottom="bottom", phead="phead",
-            status="status", hc_x="hydcond", hc_y="hydcond", s="poros",
-            recharge="recharge", output="gwresult", dtime=864000000000, type="unconfined", budget="water_budget")
+        # compute a steady state groundwater flow
+        self.assertModule(
+            "r.gwflow",
+            flags="f",
+            solver="cholesky",
+            top="top",
+            bottom="bottom",
+            phead="phead",
+            status="status",
+            hc_x="hydcond",
+            hc_y="hydcond",
+            s="poros",
+            recharge="recharge",
+            output="gwresult",
+            dtime=864000000000,
+            type="unconfined",
+            budget="water_budget",
+        )
 
 
         # Output of r.univar -g
         # Output of r.univar -g
-        univar_string="""n=760
+        univar_string = """n=760
         null_cells=0
         null_cells=0
         cells=760
         cells=760
         min=3
         min=3
@@ -62,7 +77,7 @@ class ValidationExcavation(TestCase):
         sum=3821.63682623547"""
         sum=3821.63682623547"""
 
 
         # Output of r.info -gre, only a subset of the output is needed
         # Output of r.info -gre, only a subset of the output is needed
-        info_string="""north=950
+        info_string = """north=950
         south=0
         south=0
         east=2000
         east=2000
         west=0
         west=0
@@ -77,9 +92,13 @@ class ValidationExcavation(TestCase):
         max=5.3976262918968
         max=5.3976262918968
         map=gwresult"""
         map=gwresult"""
 
 
-        self.assertRasterFitsUnivar(raster="gwresult", reference=univar_string, precision=3)
+        self.assertRasterFitsUnivar(
+            raster="gwresult", reference=univar_string, precision=3
+        )
         self.assertRasterFitsInfo(raster="gwresult", reference=info_string, precision=3)
         self.assertRasterFitsInfo(raster="gwresult", reference=info_string, precision=3)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 68 - 24
raster/r.horizon/testsuite/test_r_horizon.py

@@ -66,13 +66,13 @@ ref3 = """azimuth,horizon_height
 
 
 class TestHorizon(TestCase):
 class TestHorizon(TestCase):
 
 
-    horizon = 'test_horizon_from_elevation'
-    horizon_output = 'test_horizon_output_from_elevation'
+    horizon = "test_horizon_from_elevation"
+    horizon_output = "test_horizon_output_from_elevation"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster='elevation')
+        cls.runModule("g.region", raster="elevation")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
@@ -80,53 +80,97 @@ class TestHorizon(TestCase):
 
 
     def tearDown(self):
     def tearDown(self):
         """Remove horizon map after each test method"""
         """Remove horizon map after each test method"""
-        self.runModule('g.remove', flags='f', type='raster',
-                       name=self.horizon)
-        self.runModule('g.remove', flags='f', type='raster',
-                       pattern=self.horizon_output + '*')
+        self.runModule("g.remove", flags="f", type="raster", name=self.horizon)
+        self.runModule(
+            "g.remove", flags="f", type="raster", pattern=self.horizon_output + "*"
+        )
 
 
     def test_point_mode_one_direction(self):
     def test_point_mode_one_direction(self):
         """Test mode with 1 point and 1 direction"""
         """Test mode with 1 point and 1 direction"""
-        module = SimpleModule('r.horizon', elevation='elevation',
-                              coordinates=(634720, 216180), output=self.horizon, direction=180, step=0)
+        module = SimpleModule(
+            "r.horizon",
+            elevation="elevation",
+            coordinates=(634720, 216180),
+            output=self.horizon,
+            direction=180,
+            step=0,
+        )
         self.assertModule(module)
         self.assertModule(module)
         stdout = module.outputs.stdout
         stdout = module.outputs.stdout
         self.assertMultiLineEqual(first=ref1, second=stdout)
         self.assertMultiLineEqual(first=ref1, second=stdout)
 
 
     def test_point_mode_multiple_direction(self):
     def test_point_mode_multiple_direction(self):
         """Test mode with 1 point and multiple directions"""
         """Test mode with 1 point and multiple directions"""
-        module = SimpleModule('r.horizon', elevation='elevation',
-                              coordinates=(634720, 216180), output=self.horizon, direction=180, step=20)
+        module = SimpleModule(
+            "r.horizon",
+            elevation="elevation",
+            coordinates=(634720, 216180),
+            output=self.horizon,
+            direction=180,
+            step=20,
+        )
         self.assertModule(module)
         self.assertModule(module)
         stdout = module.outputs.stdout
         stdout = module.outputs.stdout
         self.assertMultiLineEqual(first=ref2, second=stdout)
         self.assertMultiLineEqual(first=ref2, second=stdout)
 
 
     def test_raster_mode_one_direction(self):
     def test_raster_mode_one_direction(self):
         """Test mode with 1 point and one direction"""
         """Test mode with 1 point and one direction"""
-        module = SimpleModule('r.horizon', elevation='elevation',
-                              output=self.horizon_output, direction=50)
+        module = SimpleModule(
+            "r.horizon", elevation="elevation", output=self.horizon_output, direction=50
+        )
         self.assertModule(module)
         self.assertModule(module)
-        ref = {'min': -1.57079637050629, 'max': 0.70678365230560, 'stddev': 0.0708080140468585}
-        self.assertRasterFitsUnivar(raster='test_horizon_output_from_elevation_050', reference=ref, precision=1e6)
+        ref = {
+            "min": -1.57079637050629,
+            "max": 0.70678365230560,
+            "stddev": 0.0708080140468585,
+        }
+        self.assertRasterFitsUnivar(
+            raster="test_horizon_output_from_elevation_050",
+            reference=ref,
+            precision=1e6,
+        )
 
 
     def test_raster_mode_multiple_direction(self):
     def test_raster_mode_multiple_direction(self):
-        module = SimpleModule('r.horizon', elevation='elevation',
-                              output=self.horizon_output, start=10, end=50, step=15.512)
+        module = SimpleModule(
+            "r.horizon",
+            elevation="elevation",
+            output=self.horizon_output,
+            start=10,
+            end=50,
+            step=15.512,
+        )
         self.assertModule(module)
         self.assertModule(module)
-        module_list = SimpleModule('g.list', type='raster', pattern=self.horizon_output + '*')
+        module_list = SimpleModule(
+            "g.list", type="raster", pattern=self.horizon_output + "*"
+        )
         self.runModule(module_list)
         self.runModule(module_list)
         stdout = module_list.outputs.stdout.strip()
         stdout = module_list.outputs.stdout.strip()
-        self.assertMultiLineEqual(first="test_horizon_output_from_elevation_010_000\ntest_horizon_output_from_elevation_025_512", second=stdout)
+        self.assertMultiLineEqual(
+            first="test_horizon_output_from_elevation_010_000\ntest_horizon_output_from_elevation_025_512",
+            second=stdout,
+        )
 
 
     def test_raster_mode_multiple_direction_offset(self):
     def test_raster_mode_multiple_direction_offset(self):
-        module = SimpleModule('r.horizon', elevation='elevation',
-                              output=self.horizon_output, start=10, end=50, step=15.512, direction=80)
+        module = SimpleModule(
+            "r.horizon",
+            elevation="elevation",
+            output=self.horizon_output,
+            start=10,
+            end=50,
+            step=15.512,
+            direction=80,
+        )
         self.assertModule(module)
         self.assertModule(module)
-        module_list = SimpleModule('g.list', type='raster', pattern=self.horizon_output + '*')
+        module_list = SimpleModule(
+            "g.list", type="raster", pattern=self.horizon_output + "*"
+        )
         self.runModule(module_list)
         self.runModule(module_list)
         stdout = module_list.outputs.stdout.strip()
         stdout = module_list.outputs.stdout.strip()
-        self.assertMultiLineEqual(first="test_horizon_output_from_elevation_090_000\ntest_horizon_output_from_elevation_105_512", second=stdout)
+        self.assertMultiLineEqual(
+            first="test_horizon_output_from_elevation_090_000\ntest_horizon_output_from_elevation_105_512",
+            second=stdout,
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 60 - 23
raster/r.in.ascii/testsuite/test_r_in_ascii.py

@@ -12,7 +12,7 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.script.core import read_command
 from grass.script.core import read_command
 
 
-INPUT_NOQUOTES="""north:                   4299000.00
+INPUT_NOQUOTES = """north:                   4299000.00
 south:                   4247000.00
 south:                   4247000.00
 east:                     528000.00
 east:                     528000.00
 west:                     500000.00
 west:                     500000.00
@@ -31,7 +31,7 @@ null:                      -9999
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 """
 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 """
 
 
-INPUT_TSV="""north:                   4299000.00
+INPUT_TSV = """north:                   4299000.00
 south:                   4247000.00
 south:                   4247000.00
 east:                     528000.00
 east:                     528000.00
 west:                     500000.00
 west:                     500000.00
@@ -50,7 +50,7 @@ null:                      -9999
 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15
 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15 """
 1\ 2\ 3\ 4\ 5\ 6\ 7\ 8\ 9\ 10\ 11\ 12\ 13\ 14\ 15 """
 
 
-INPUT_UNCOMMON="""north:                   4299000.00
+INPUT_UNCOMMON = """north:                   4299000.00
 south:                   4247000.00
 south:                   4247000.00
 east:                     528000.00
 east:                     528000.00
 west:                     500000.00
 west:                     500000.00
@@ -69,14 +69,15 @@ null:                      -9999
 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15
 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15 """
 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 10@ 11@ 12@ 13@ 14@ 15 """
 
 
+
 class SimpleCsvTestCase(TestCase):
 class SimpleCsvTestCase(TestCase):
-    ascii_test = 'ascii'
+    ascii_test = "ascii"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=4299000.00, s=4247000.00, e=528000.00, w=500000.00)
+        cls.runModule("g.region", n=4299000.00, s=4247000.00, e=528000.00, w=500000.00)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
@@ -84,35 +85,71 @@ class SimpleCsvTestCase(TestCase):
 
 
     def tearDown(self):
     def tearDown(self):
         """Remove the raster map after each test method"""
         """Remove the raster map after each test method"""
-        self.runModule('g.remove', flags='f', type='raster', pattern=self.ascii_test)
+        self.runModule("g.remove", flags="f", type="raster", pattern=self.ascii_test)
 
 
     def test_no_text_delimeter(self):
     def test_no_text_delimeter(self):
         """Test loading no quotes"""
         """Test loading no quotes"""
-        self.assertModule('r.in.ascii', input='-', output=self.ascii_test,
-                          type='CELL', stdin_=INPUT_NOQUOTES)
-        self.assertRasterMinMax(map=self.ascii_test, refmin=1, refmax=15,
-                                msg="ascii_test in degrees must be between 1 and 15")
+        self.assertModule(
+            "r.in.ascii",
+            input="-",
+            output=self.ascii_test,
+            type="CELL",
+            stdin_=INPUT_NOQUOTES,
+        )
+        self.assertRasterMinMax(
+            map=self.ascii_test,
+            refmin=1,
+            refmax=15,
+            msg="ascii_test in degrees must be between 1 and 15",
+        )
 
 
     def test_text_delimeter(self):
     def test_text_delimeter(self):
         """Testing with external file"""
         """Testing with external file"""
-        self.assertModule('r.in.ascii', input='data/input_ascii.txt', output=self.ascii_test,
-                          type='CELL')
-        self.assertRasterMinMax(map=self.ascii_test, refmin=1, refmax=5,
-                                msg="ascii_test in degrees must be between 1 and 5")
+        self.assertModule(
+            "r.in.ascii",
+            input="data/input_ascii.txt",
+            output=self.ascii_test,
+            type="CELL",
+        )
+        self.assertRasterMinMax(
+            map=self.ascii_test,
+            refmin=1,
+            refmax=5,
+            msg="ascii_test in degrees must be between 1 and 5",
+        )
 
 
     def test_tsv(self):
     def test_tsv(self):
         """Test loading TSV"""
         """Test loading TSV"""
-        self.assertModule('r.in.ascii', input='-', output=self.ascii_test,
-                          type='CELL', stdin_=INPUT_TSV)
-        self.assertRasterMinMax(map=self.ascii_test, refmin=1, refmax=15,
-                                msg="ascii_test in degrees must be between 1 and 15")
+        self.assertModule(
+            "r.in.ascii",
+            input="-",
+            output=self.ascii_test,
+            type="CELL",
+            stdin_=INPUT_TSV,
+        )
+        self.assertRasterMinMax(
+            map=self.ascii_test,
+            refmin=1,
+            refmax=15,
+            msg="ascii_test in degrees must be between 1 and 15",
+        )
 
 
     def test_uncommon_delims(self):
     def test_uncommon_delims(self):
         """Test loading with uncommon delimiters"""
         """Test loading with uncommon delimiters"""
-        self.assertModule('r.in.ascii', input='-', output=self.ascii_test,
-                          type='CELL', stdin_=INPUT_UNCOMMON)
-        self.assertRasterMinMax(map=self.ascii_test, refmin=1, refmax=15,
-                                msg="ascii_test in degrees must be between 1 and 15")
+        self.assertModule(
+            "r.in.ascii",
+            input="-",
+            output=self.ascii_test,
+            type="CELL",
+            stdin_=INPUT_UNCOMMON,
+        )
+        self.assertRasterMinMax(
+            map=self.ascii_test,
+            refmin=1,
+            refmax=15,
+            msg="ascii_test in degrees must be between 1 and 15",
+        )
+
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 159 - 108
raster/r.in.gdal/testsuite/test_r_in_gdal.py

@@ -4,8 +4,8 @@
 """
 """
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 
 
-class TestGdalImport(TestCase):
 
 
+class TestGdalImport(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
@@ -13,25 +13,27 @@ class TestGdalImport(TestCase):
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        """!Remove the temporary region
-        """
+        """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(self):
     def tearDown(self):
-        self.runModule("g.remove", type="raster", flags="f",
-                       pattern="test_gdal_import_map*")
-
+        self.runModule(
+            "g.remove", type="raster", flags="f", pattern="test_gdal_import_map*"
+        )
 
 
     def test_1(self):
     def test_1(self):
 
 
-        self.assertModule("r.in.gdal", "Import GTiff Format",
-                          input="data/elevation.tif",
-                          output="test_gdal_import_map")
+        self.assertModule(
+            "r.in.gdal",
+            "Import GTiff Format",
+            input="data/elevation.tif",
+            output="test_gdal_import_map",
+        )
 
 
         self.runModule("g.region", raster="test_gdal_import_map")
         self.runModule("g.region", raster="test_gdal_import_map")
 
 
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=20250
+        univar_string = """n=20250
                          null_cells=0
                          null_cells=0
                          cells=20250
                          cells=20250
                          min=56.1364936828613
                          min=56.1364936828613
@@ -44,19 +46,23 @@ class TestGdalImport(TestCase):
                          coeff_var=18.4170719597623
                          coeff_var=18.4170719597623
                          sum=2234751.09436035"""
                          sum=2234751.09436035"""
 
 
-        self.assertRasterFitsUnivar(raster="test_gdal_import_map", reference=univar_string,
-                                    precision=3)
+        self.assertRasterFitsUnivar(
+            raster="test_gdal_import_map", reference=univar_string, precision=3
+        )
 
 
     def test_2(self):
     def test_2(self):
 
 
-        self.assertModule("r.in.gdal", "Import GTiff Format",
-                          input="data/elevation.tiff",
-                          output="test_gdal_import_map")
+        self.assertModule(
+            "r.in.gdal",
+            "Import GTiff Format",
+            input="data/elevation.tiff",
+            output="test_gdal_import_map",
+        )
 
 
         self.runModule("g.region", raster="test_gdal_import_map")
         self.runModule("g.region", raster="test_gdal_import_map")
 
 
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=20250
+        univar_string = """n=20250
                          null_cells=0
                          null_cells=0
                          cells=20250
                          cells=20250
                          min=56.1364936828613
                          min=56.1364936828613
@@ -69,19 +75,23 @@ class TestGdalImport(TestCase):
                          coeff_var=18.4170719597623
                          coeff_var=18.4170719597623
                          sum=2234751.09436035"""
                          sum=2234751.09436035"""
 
 
-        self.assertRasterFitsUnivar(raster="test_gdal_import_map", reference=univar_string,
-                                    precision=3)
+        self.assertRasterFitsUnivar(
+            raster="test_gdal_import_map", reference=univar_string, precision=3
+        )
 
 
     def test_3(self):
     def test_3(self):
 
 
-        self.assertModule("r.in.gdal", "Import AAIGrid Format",
-                          input="data/elevation.asc",
-                          output="test_gdal_import_map")
+        self.assertModule(
+            "r.in.gdal",
+            "Import AAIGrid Format",
+            input="data/elevation.asc",
+            output="test_gdal_import_map",
+        )
 
 
         self.runModule("g.region", raster="test_gdal_import_map")
         self.runModule("g.region", raster="test_gdal_import_map")
 
 
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=20250
+        univar_string = """n=20250
                          null_cells=0
                          null_cells=0
                          cells=20250
                          cells=20250
                          min=56.1364936828613
                          min=56.1364936828613
@@ -94,19 +104,23 @@ class TestGdalImport(TestCase):
                          coeff_var=18.4170719597623
                          coeff_var=18.4170719597623
                          sum=2234751.09436035"""
                          sum=2234751.09436035"""
 
 
-        self.assertRasterFitsUnivar(raster="test_gdal_import_map", reference=univar_string,
-                                    precision=3)
+        self.assertRasterFitsUnivar(
+            raster="test_gdal_import_map", reference=univar_string, precision=3
+        )
 
 
     def test_4(self):
     def test_4(self):
 
 
-        self.assertModule("r.in.gdal", "Import netCDF Format",
-                          input="data/elevation.nc",
-                          output="test_gdal_import_map")
+        self.assertModule(
+            "r.in.gdal",
+            "Import netCDF Format",
+            input="data/elevation.nc",
+            output="test_gdal_import_map",
+        )
 
 
         self.runModule("g.region", raster="test_gdal_import_map")
         self.runModule("g.region", raster="test_gdal_import_map")
 
 
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=20250
+        univar_string = """n=20250
                          null_cells=0
                          null_cells=0
                          cells=20250
                          cells=20250
                          min=56.1364936828613
                          min=56.1364936828613
@@ -119,19 +133,23 @@ class TestGdalImport(TestCase):
                          coeff_var=18.4170719597623
                          coeff_var=18.4170719597623
                          sum=2234751.09436035"""
                          sum=2234751.09436035"""
 
 
-        self.assertRasterFitsUnivar(raster="test_gdal_import_map", reference=univar_string,
-                                    precision=3)
+        self.assertRasterFitsUnivar(
+            raster="test_gdal_import_map", reference=univar_string, precision=3
+        )
 
 
     def test_netCDF_3d_1(self):
     def test_netCDF_3d_1(self):
 
 
-        self.assertModule("r.in.gdal", "Import netCDF Format",
-                          input="data/elevation3d.nc",
-                          num_digits="3",
-                          flags="o",
-                          output="test_gdal_import_map")
+        self.assertModule(
+            "r.in.gdal",
+            "Import netCDF Format",
+            input="data/elevation3d.nc",
+            num_digits="3",
+            flags="o",
+            output="test_gdal_import_map",
+        )
 
 
         # Output of r.info
         # Output of r.info
-        info_string="""north=228500
+        info_string = """north=228500
                        south=215000
                        south=215000
                        east=644640
                        east=644640
                        west=629640
                        west=629640
@@ -143,28 +161,36 @@ class TestGdalImport(TestCase):
                        datatype=FCELL
                        datatype=FCELL
                        ncats=0"""
                        ncats=0"""
 
 
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.001", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.002", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.003", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.004", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.005", reference=info_string,
-                                    precision=3)
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.001", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.002", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.003", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.004", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.005", reference=info_string, precision=3
+        )
 
 
     def test_netCDF_3d_2(self):
     def test_netCDF_3d_2(self):
 
 
-        self.assertModule("r.in.gdal", "Import netCDF Format",
-                          input="data/elevation3d.nc",
-                          num_digits=0,
-                          offset=100,
-                          flags="o",
-                          output="test_gdal_import_map")
+        self.assertModule(
+            "r.in.gdal",
+            "Import netCDF Format",
+            input="data/elevation3d.nc",
+            num_digits=0,
+            offset=100,
+            flags="o",
+            output="test_gdal_import_map",
+        )
 
 
         # Output of r.info
         # Output of r.info
-        info_string="""north=228500
+        info_string = """north=228500
                        south=215000
                        south=215000
                        east=644640
                        east=644640
                        west=629640
                        west=629640
@@ -176,28 +202,36 @@ class TestGdalImport(TestCase):
                        datatype=FCELL
                        datatype=FCELL
                        ncats=0"""
                        ncats=0"""
 
 
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.101", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.102", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.103", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.104", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.105", reference=info_string,
-                                    precision=3)
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.101", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.102", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.103", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.104", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.105", reference=info_string, precision=3
+        )
 
 
     def test_netCDF_3d_3(self):
     def test_netCDF_3d_3(self):
 
 
-        self.assertModule("r.in.gdal", "Import netCDF Format",
-                          input="data/elevation3d.nc",
-                          num_digits=5,
-                          offset=100,
-                          flags="o",
-                          output="test_gdal_import_map")
+        self.assertModule(
+            "r.in.gdal",
+            "Import netCDF Format",
+            input="data/elevation3d.nc",
+            num_digits=5,
+            offset=100,
+            flags="o",
+            output="test_gdal_import_map",
+        )
 
 
         # Output of r.info
         # Output of r.info
-        info_string="""north=228500
+        info_string = """north=228500
                        south=215000
                        south=215000
                        east=644640
                        east=644640
                        west=629640
                        west=629640
@@ -209,28 +243,36 @@ class TestGdalImport(TestCase):
                        datatype=FCELL
                        datatype=FCELL
                        ncats=0"""
                        ncats=0"""
 
 
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.00101", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.00102", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.00103", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.00104", reference=info_string,
-                                    precision=3)
-        self.assertRasterFitsInfo(raster="test_gdal_import_map.00105", reference=info_string,
-                                    precision=3)
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.00101", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.00102", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.00103", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.00104", reference=info_string, precision=3
+        )
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map.00105", reference=info_string, precision=3
+        )
 
 
     def test_netCDF_3d_4(self):
     def test_netCDF_3d_4(self):
 
 
-        self.assertModule("r.in.gdal", "Import netCDF Format",
-                          input="data/elevation3d.nc",
-                          num_digits="3",
-                          flags="o",
-                          band=2,
-                          output="test_gdal_import_map")
+        self.assertModule(
+            "r.in.gdal",
+            "Import netCDF Format",
+            input="data/elevation3d.nc",
+            num_digits="3",
+            flags="o",
+            band=2,
+            output="test_gdal_import_map",
+        )
 
 
         # Output of r.info
         # Output of r.info
-        info_string="""north=228500
+        info_string = """north=228500
                        south=215000
                        south=215000
                        east=644640
                        east=644640
                        west=629640
                        west=629640
@@ -242,21 +284,25 @@ class TestGdalImport(TestCase):
                        datatype=FCELL
                        datatype=FCELL
                        ncats=0"""
                        ncats=0"""
 
 
-        self.assertRasterFitsInfo(raster="test_gdal_import_map", reference=info_string,
-                                    precision=3)
+        self.assertRasterFitsInfo(
+            raster="test_gdal_import_map", reference=info_string, precision=3
+        )
 
 
     def test_netCDF_3d_5(self):
     def test_netCDF_3d_5(self):
         """Test the output map names file option"""
         """Test the output map names file option"""
 
 
-        self.assertModule("r.in.gdal", "Import netCDF Format",
-                          input="data/elevation3d.nc",
-                          num_digits=10,
-                          offset=100,
-                          flags="o",
-                          map_names_file="map_names_file.txt",
-                          output="test_gdal_import_map")
-
-        map_list="""test_gdal_import_map.0000000101
+        self.assertModule(
+            "r.in.gdal",
+            "Import netCDF Format",
+            input="data/elevation3d.nc",
+            num_digits=10,
+            offset=100,
+            flags="o",
+            map_names_file="map_names_file.txt",
+            output="test_gdal_import_map",
+        )
+
+        map_list = """test_gdal_import_map.0000000101
 test_gdal_import_map.0000000102
 test_gdal_import_map.0000000102
 test_gdal_import_map.0000000103
 test_gdal_import_map.0000000103
 test_gdal_import_map.0000000104
 test_gdal_import_map.0000000104
@@ -269,21 +315,26 @@ test_gdal_import_map.0000000105
 
 
 
 
 class TestGdalImportFails(TestCase):
 class TestGdalImportFails(TestCase):
-
     def test_error_handling_1(self):
     def test_error_handling_1(self):
         # Wrong number of digits
         # Wrong number of digits
-        self.assertModuleFail("r.in.gdal",
-                              input="data/elevation.nc",
-                              num_digits="-1",
-                              output="test_gdal_import_map")
+        self.assertModuleFail(
+            "r.in.gdal",
+            input="data/elevation.nc",
+            num_digits="-1",
+            output="test_gdal_import_map",
+        )
 
 
     def test_error_handling_2(self):
     def test_error_handling_2(self):
         # No location specified
         # No location specified
-        self.assertModuleFail("r.in.gdal",
-                              input="data/elevation.nc",
-                              flags="c",
-                              output="test_gdal_import_map")
+        self.assertModuleFail(
+            "r.in.gdal",
+            input="data/elevation.nc",
+            flags="c",
+            output="test_gdal_import_map",
+        )
+
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 54 - 28
raster/r.in.poly/testsuite/test_rinpoly.py

@@ -5,8 +5,7 @@ from grass.gunittest.main import test
 from grass.script.core import read_command
 from grass.script.core import read_command
 
 
 
 
-input1 = \
-    b"""
+input1 = b"""
 A
 A
 634308.630394 223320.356473
 634308.630394 223320.356473
 640640.712946 223092.401501
 640640.712946 223092.401501
@@ -27,12 +26,12 @@ L
 
 
 class TestRInPoly(TestCase):
 class TestRInPoly(TestCase):
 
 
-    rinpoly = 'test_rinpoly'
+    rinpoly = "test_rinpoly"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster='elevation')
+        cls.runModule("g.region", raster="elevation")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
@@ -43,70 +42,97 @@ class TestRInPoly(TestCase):
 
 
     def tearDown(self):
     def tearDown(self):
         """Remove rinpoly map after each test method"""
         """Remove rinpoly map after each test method"""
-        self.runModule('g.remove', flags='f', type='raster',
-                       name=self.rinpoly)
+        self.runModule("g.remove", flags="f", type="raster", name=self.rinpoly)
         os.unlink(self.tmpFile.name)
         os.unlink(self.tmpFile.name)
 
 
     def testTypeCell(self):
     def testTypeCell(self):
         """Test type of resulting map"""
         """Test type of resulting map"""
         self.tmpFile.write(input1)
         self.tmpFile.write(input1)
         self.tmpFile.close()
         self.tmpFile.close()
-        self.assertModule('r.in.poly', input=self.tmpFile.name, output=self.rinpoly, type='CELL')
-        minmax = 'min=-8\nmax=10\ndatatype=CELL'
+        self.assertModule(
+            "r.in.poly", input=self.tmpFile.name, output=self.rinpoly, type="CELL"
+        )
+        minmax = "min=-8\nmax=10\ndatatype=CELL"
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax)
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax)
 
 
     def testTypeFCell(self):
     def testTypeFCell(self):
         """Test type of resulting map"""
         """Test type of resulting map"""
         self.tmpFile.write(input1)
         self.tmpFile.write(input1)
         self.tmpFile.close()
         self.tmpFile.close()
-        self.assertModule('r.in.poly', input=self.tmpFile.name, output=self.rinpoly, type='FCELL')
-        minmax = 'min=-8\nmax=10.01\ndatatype=FCELL'
+        self.assertModule(
+            "r.in.poly", input=self.tmpFile.name, output=self.rinpoly, type="FCELL"
+        )
+        minmax = "min=-8\nmax=10.01\ndatatype=FCELL"
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
 
 
     def testTypeDCell(self):
     def testTypeDCell(self):
         """Test type of resulting map"""
         """Test type of resulting map"""
         self.tmpFile.write(input1)
         self.tmpFile.write(input1)
         self.tmpFile.close()
         self.tmpFile.close()
-        self.assertModule('r.in.poly', input=self.tmpFile.name, output=self.rinpoly, type='DCELL')
-        minmax = 'min=-8\nmax=10.01\ndatatype=DCELL'
+        self.assertModule(
+            "r.in.poly", input=self.tmpFile.name, output=self.rinpoly, type="DCELL"
+        )
+        minmax = "min=-8\nmax=10.01\ndatatype=DCELL"
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
 
 
     def testTypeCellNull(self):
     def testTypeCellNull(self):
         """Test type of resulting map"""
         """Test type of resulting map"""
         self.tmpFile.write(input1)
         self.tmpFile.write(input1)
         self.tmpFile.close()
         self.tmpFile.close()
-        self.assertModule('r.in.poly', input=self.tmpFile.name, output=self.rinpoly, type='CELL',
-                          null=-8)
-        minmax = 'min=3\nmax=10\ndatatype=CELL'
+        self.assertModule(
+            "r.in.poly",
+            input=self.tmpFile.name,
+            output=self.rinpoly,
+            type="CELL",
+            null=-8,
+        )
+        minmax = "min=3\nmax=10\ndatatype=CELL"
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
 
 
     def testTypeDCellNull(self):
     def testTypeDCellNull(self):
         """Test type of resulting map"""
         """Test type of resulting map"""
         self.tmpFile.write(input1)
         self.tmpFile.write(input1)
         self.tmpFile.close()
         self.tmpFile.close()
-        self.assertModule('r.in.poly', input=self.tmpFile.name, output=self.rinpoly, type='DCELL',
-                          null=-8)
-        minmax = 'min=3\nmax=10.01\ndatatype=DCELL'
+        self.assertModule(
+            "r.in.poly",
+            input=self.tmpFile.name,
+            output=self.rinpoly,
+            type="DCELL",
+            null=-8,
+        )
+        minmax = "min=3\nmax=10.01\ndatatype=DCELL"
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
 
 
     def testTypeDCellNull2(self):
     def testTypeDCellNull2(self):
         """Test type of resulting map"""
         """Test type of resulting map"""
         self.tmpFile.write(input1)
         self.tmpFile.write(input1)
         self.tmpFile.close()
         self.tmpFile.close()
-        self.assertModule('r.in.poly', input=self.tmpFile.name, output=self.rinpoly, type='DCELL',
-                          null=0)
-        minmax = 'min=-8\nmax=10.01\ndatatype=DCELL'
+        self.assertModule(
+            "r.in.poly",
+            input=self.tmpFile.name,
+            output=self.rinpoly,
+            type="DCELL",
+            null=0,
+        )
+        minmax = "min=-8\nmax=10.01\ndatatype=DCELL"
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
         self.assertRasterFitsInfo(raster=self.rinpoly, reference=minmax, precision=1e-8)
 
 
     def testLabels(self):
     def testLabels(self):
         """Test type of resulting map"""
         """Test type of resulting map"""
         self.tmpFile.write(input1)
         self.tmpFile.write(input1)
         self.tmpFile.close()
         self.tmpFile.close()
-        self.assertModule('r.in.poly', input=self.tmpFile.name, output=self.rinpoly, type='DCELL')
-        category = read_command('r.category', map=self.rinpoly, values=[-8, 3, 10.01]).strip()
-        self.assertEqual(first="-8\t{newline}3\tlabel2{newline}10.01".format(newline=os.linesep),
-                         second=category, msg="Labels do not match")
-
-
-if __name__ == '__main__':
+        self.assertModule(
+            "r.in.poly", input=self.tmpFile.name, output=self.rinpoly, type="DCELL"
+        )
+        category = read_command(
+            "r.category", map=self.rinpoly, values=[-8, 3, 10.01]
+        ).strip()
+        self.assertEqual(
+            first="-8\t{newline}3\tlabel2{newline}10.01".format(newline=os.linesep),
+            second=category,
+            msg="Labels do not match",
+        )
+
+
+if __name__ == "__main__":
     test()
     test()

+ 25 - 10
raster/r.info/testsuite/test_r_info.py

@@ -10,8 +10,9 @@ Licence:    This program is free software under the GNU General Public
 """
 """
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
-class TestReport(TestCase):
 
 
+
+class TestReport(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
@@ -24,7 +25,7 @@ class TestReport(TestCase):
 
 
     def test_flagg(self):
     def test_flagg(self):
         """Testing flag g with map geology_30m using simple module"""
         """Testing flag g with map geology_30m using simple module"""
-        output_str="""north=228500
+        output_str = """north=228500
         south=215000
         south=215000
         east=645000
         east=645000
         west=630000
         west=630000
@@ -35,24 +36,38 @@ class TestReport(TestCase):
         cells=2025000
         cells=2025000
         datatype=CELL
         datatype=CELL
         ncats=43600"""
         ncats=43600"""
-        self.assertModuleKeyValue(module='r.info', map='lakes', flags='g', reference=output_str,
-                                  precision=2, sep="=")
+        self.assertModuleKeyValue(
+            module="r.info",
+            map="lakes",
+            flags="g",
+            reference=output_str,
+            precision=2,
+            sep="=",
+        )
 
 
     def test_flagr(self):
     def test_flagr(self):
         """Testing flag r with map landcover_1m using simple module"""
         """Testing flag r with map landcover_1m using simple module"""
-        output_str="""min=34300
+        output_str = """min=34300
         max=43600"""
         max=43600"""
-        self.assertModuleKeyValue(module='r.info', map='lakes', flags='r', reference=output_str,
-                                  precision=2, sep="=")
+        self.assertModuleKeyValue(
+            module="r.info",
+            map="lakes",
+            flags="r",
+            reference=output_str,
+            precision=2,
+            sep="=",
+        )
 
 
     def test_flage(self):
     def test_flage(self):
         """Testing flag e with map lsat7_2002_50"""
         """Testing flag e with map lsat7_2002_50"""
-        self.assertModule('r.info', map='lakes', flags='e')
+        self.assertModule("r.info", map="lakes", flags="e")
 
 
     def test_flagh(self):
     def test_flagh(self):
         """Testing flag h with map zipcodes"""
         """Testing flag h with map zipcodes"""
-        self.assertModule('r.info', map='lakes', flags='h')
+        self.assertModule("r.info", map="lakes", flags="h")
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 51 - 25
raster/r.mapcalc/testsuite/test_nmedian_bug_3296.py

@@ -51,54 +51,80 @@ null: *
 
 
 class TestNmedianBug(TestCase):
 class TestNmedianBug(TestCase):
     to_remove = []
     to_remove = []
-    input = 'r_mapcalc_test_pattern'
-    output = 'r_mapcalc_test_output'
-    output_ref = 'r_mapcalc_test_output_ref'
-    output_cell = 'r_mapcalc_test_output_cell'
+    input = "r_mapcalc_test_pattern"
+    output = "r_mapcalc_test_output"
+    output_ref = "r_mapcalc_test_output_ref"
+    output_cell = "r_mapcalc_test_output_cell"
 
 
     def setUp(self):
     def setUp(self):
         expression = "{o}=row()*col()".format(o=self.input)
         expression = "{o}=row()*col()".format(o=self.input)
         self.use_temp_region()
         self.use_temp_region()
-        self.runModule('g.region', n=3, s=0, e=3, w=0, res=1)
-        self.runModule('r.mapcalc', expression=expression, overwrite=True)
+        self.runModule("g.region", n=3, s=0, e=3, w=0, res=1)
+        self.runModule("r.mapcalc", expression=expression, overwrite=True)
         self.to_remove.append(self.input)
         self.to_remove.append(self.input)
-        self.runModule('r.in.ascii', input='-', stdin_=OUTPUT,
-                       output=self.output_ref, overwrite=True)
+        self.runModule(
+            "r.in.ascii",
+            input="-",
+            stdin_=OUTPUT,
+            output=self.output_ref,
+            overwrite=True,
+        )
         self.to_remove.append(self.output_ref)
         self.to_remove.append(self.output_ref)
-        self.runModule('r.in.ascii', input='-', stdin_=OUTPUT_CELL,
-                       output=self.output_cell, overwrite=True)
+        self.runModule(
+            "r.in.ascii",
+            input="-",
+            stdin_=OUTPUT_CELL,
+            output=self.output_cell,
+            overwrite=True,
+        )
         self.to_remove.append(self.output_cell)
         self.to_remove.append(self.output_cell)
 
 
     def tearDown(self):
     def tearDown(self):
         self.del_temp_region()
         self.del_temp_region()
         if 0 and self.to_remove:
         if 0 and self.to_remove:
-            self.runModule('g.remove', flags='f', type='raster',
-                           name=','.join(self.to_remove), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(self.to_remove),
+                verbose=True,
+            )
 
 
     def test_cell(self):
     def test_cell(self):
-        expression = "{o}=nmedian(({i}[0,-1] - {i})^2,({i}[0,1] - {i})^2)".format(o=self.output, i=self.input)
-        self.assertModule('r.mapcalc', expression=expression, overwrite=True)
+        expression = "{o}=nmedian(({i}[0,-1] - {i})^2,({i}[0,1] - {i})^2)".format(
+            o=self.output, i=self.input
+        )
+        self.assertModule("r.mapcalc", expression=expression, overwrite=True)
         self.assertRasterExists(self.output)
         self.assertRasterExists(self.output)
         self.to_remove.append(self.output)
         self.to_remove.append(self.output)
-        self.assertRastersNoDifference(actual=self.output,
-            reference=self.output_cell, precision=0)
+        self.assertRastersNoDifference(
+            actual=self.output, reference=self.output_cell, precision=0
+        )
 
 
     def test_fcell(self):
     def test_fcell(self):
-        expression = "{o}=nmedian(float(({i}[0,-1] - {i})^2), float(({i}[0,1] - {i})^2))".format(o=self.output, i=self.input)
-        self.assertModule('r.mapcalc', expression=expression, overwrite=True)
+        expression = (
+            "{o}=nmedian(float(({i}[0,-1] - {i})^2), float(({i}[0,1] - {i})^2))".format(
+                o=self.output, i=self.input
+            )
+        )
+        self.assertModule("r.mapcalc", expression=expression, overwrite=True)
         self.assertRasterExists(self.output)
         self.assertRasterExists(self.output)
         self.to_remove.append(self.output)
         self.to_remove.append(self.output)
-        self.assertRastersNoDifference(actual=self.output,
-            reference=self.output_ref, precision=0)
+        self.assertRastersNoDifference(
+            actual=self.output, reference=self.output_ref, precision=0
+        )
 
 
     def test_dcell(self):
     def test_dcell(self):
-        expression = "{o}=nmedian(double(({i}[0,-1] - {i})^2), double(({i}[0,1] - {i})^2))".format(o=self.output, i=self.input)
-        self.assertModule('r.mapcalc', expression=expression, overwrite=True)
+        expression = "{o}=nmedian(double(({i}[0,-1] - {i})^2), double(({i}[0,1] - {i})^2))".format(
+            o=self.output, i=self.input
+        )
+        self.assertModule("r.mapcalc", expression=expression, overwrite=True)
         self.assertRasterExists(self.output)
         self.assertRasterExists(self.output)
         self.to_remove.append(self.output)
         self.to_remove.append(self.output)
-        self.assertRastersNoDifference(actual=self.output,
-            reference=self.output_ref, precision=0)
+        self.assertRastersNoDifference(
+            actual=self.output, reference=self.output_ref, precision=0
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 32 - 29
raster/r.mapcalc/testsuite/test_r3_mapcalc.py

@@ -5,6 +5,7 @@ from grass.gunittest.main import test
 # TODO: add more expressions
 # TODO: add more expressions
 # TODO: add tests with prepared data
 # TODO: add tests with prepared data
 
 
+
 class TestBasicOperations(TestCase):
 class TestBasicOperations(TestCase):
 
 
     # TODO: replace by unified handing of maps
     # TODO: replace by unified handing of maps
@@ -13,53 +14,55 @@ class TestBasicOperations(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region',
-            n=85, s=5, e=85, w=5,
-            b=0, t=2000,
-            res=1, res3=1)
+        cls.runModule("g.region", n=85, s=5, e=85, w=5, b=0, t=2000, res=1, res3=1)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='raster_3d',
-                name=','.join(cls.to_remove), verbose=True)
+            cls.runModule(
+                "g.remove",
+                flags="f",
+                type="raster_3d",
+                name=",".join(cls.to_remove),
+                verbose=True,
+            )
 
 
     def test_difference_of_the_same_map_double(self):
     def test_difference_of_the_same_map_double(self):
         """Test zero difference of map with itself"""
         """Test zero difference of map with itself"""
-        self.runModule('r3.mapcalc', flags='s',
-                       expression='a = rand(1.0, 200)')
-        self.to_remove.append('a')
-        self.assertModule('r3.mapcalc',
-            expression='diff_a_a = a - a')
-        self.to_remove.append('diff_a_a')
-        self.assertRaster3dMinMax('diff_a_a', refmin=0, refmax=0)
+        self.runModule("r3.mapcalc", flags="s", expression="a = rand(1.0, 200)")
+        self.to_remove.append("a")
+        self.assertModule("r3.mapcalc", expression="diff_a_a = a - a")
+        self.to_remove.append("diff_a_a")
+        self.assertRaster3dMinMax("diff_a_a", refmin=0, refmax=0)
 
 
     def test_difference_of_the_same_map_float(self):
     def test_difference_of_the_same_map_float(self):
         """Test zero difference of map with itself"""
         """Test zero difference of map with itself"""
-        self.runModule('r3.mapcalc', flags='s',
-                       expression='af = rand(float(1), 200)')
-        self.to_remove.append('af')
-        self.assertModule('r3.mapcalc',
-            expression='diff_af_af = af - af')
-        self.to_remove.append('diff_af_af')
-        self.assertRaster3dMinMax('diff_af_af', refmin=0, refmax=0)
+        self.runModule("r3.mapcalc", flags="s", expression="af = rand(float(1), 200)")
+        self.to_remove.append("af")
+        self.assertModule("r3.mapcalc", expression="diff_af_af = af - af")
+        self.to_remove.append("diff_af_af")
+        self.assertRaster3dMinMax("diff_af_af", refmin=0, refmax=0)
 
 
     def test_difference_of_the_same_expression(self):
     def test_difference_of_the_same_expression(self):
         """Test zero difference of two same expressions"""
         """Test zero difference of two same expressions"""
-        self.assertModule('r3.mapcalc',
-            expression='diff_e_e = 3 * x() * y() * z() - 3 * x() * y() * z()')
-        self.to_remove.append('diff_e_e')
-        self.assertRaster3dMinMax('diff_e_e', refmin=0, refmax=0)
+        self.assertModule(
+            "r3.mapcalc",
+            expression="diff_e_e = 3 * x() * y() * z() - 3 * x() * y() * z()",
+        )
+        self.to_remove.append("diff_e_e")
+        self.assertRaster3dMinMax("diff_e_e", refmin=0, refmax=0)
 
 
     def test_nrows_ncols_ndepths_sum(self):
     def test_nrows_ncols_ndepths_sum(self):
         """Test if sum of nrows, ncols and ndepths matches one
         """Test if sum of nrows, ncols and ndepths matches one
         expected from current region settigs"""
         expected from current region settigs"""
-        self.assertModule('r3.mapcalc',
-            expression='nrows_ncols_ndepths_sum = nrows() + ncols() + ndepths()')
-        self.to_remove.append('nrows_ncols_ndepths_sum')
-        self.assertRaster3dMinMax('nrows_ncols_ndepths_sum', refmin=2160, refmax=2160)
+        self.assertModule(
+            "r3.mapcalc",
+            expression="nrows_ncols_ndepths_sum = nrows() + ncols() + ndepths()",
+        )
+        self.to_remove.append("nrows_ncols_ndepths_sum")
+        self.assertRaster3dMinMax("nrows_ncols_ndepths_sum", refmin=2160, refmax=2160)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 154 - 104
raster/r.mapcalc/testsuite/test_r_mapcalc.py

@@ -68,103 +68,113 @@ class TestRandFunction(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='raster',
-                name=','.join(cls.to_remove))
+            cls.runModule(
+                "g.remove", flags="f", type="raster", name=",".join(cls.to_remove)
+            )
 
 
     def rinfo_contains_number(self, raster, number):
     def rinfo_contains_number(self, raster, number):
         """Test that r.info standard output for raster contains a given number
         """Test that r.info standard output for raster contains a given number
 
 
         To be used in test methods for testing presence of a given number.
         To be used in test methods for testing presence of a given number.
         """
         """
-        rinfo = SimpleModule('r.info', map=raster)
+        rinfo = SimpleModule("r.info", map=raster)
         self.runModule(rinfo)
         self.runModule(rinfo)
         self.assertIn(str(number), rinfo.outputs.stdout)
         self.assertIn(str(number), rinfo.outputs.stdout)
 
 
     def test_seed_not_required(self):
     def test_seed_not_required(self):
         """Test that seed is not required when rand() is not used"""
         """Test that seed is not required when rand() is not used"""
-        self.assertModule('r.mapcalc', expression='nonrand_cell = 200')
-        self.to_remove.append('nonrand_cell')
+        self.assertModule("r.mapcalc", expression="nonrand_cell = 200")
+        self.to_remove.append("nonrand_cell")
 
 
     def test_seed_required(self):
     def test_seed_required(self):
         """Test that seed is required when rand() is used
         """Test that seed is required when rand() is used
 
 
         This test can, and probably should, generate an error message.
         This test can, and probably should, generate an error message.
         """
         """
-        self.assertModuleFail('r.mapcalc', expression='rand_x = rand(1, 200)')
+        self.assertModuleFail("r.mapcalc", expression="rand_x = rand(1, 200)")
         # TODO: assert map not exists but it would be handy here
         # TODO: assert map not exists but it would be handy here
         # TODO: test that error message was generated
         # TODO: test that error message was generated
 
 
     def test_seed_cell(self):
     def test_seed_cell(self):
         """Test given seed with CELL against reference map"""
         """Test given seed with CELL against reference map"""
         seed = 500
         seed = 500
-        self.runModule('r.in.ascii', input='-', stdin=cell_seed_500,
-                       output='rand_cell_ref')
-        self.to_remove.append('rand_cell_ref')
-        self.assertModule('r.mapcalc', seed=seed,
-                          expression='rand_cell = rand(1, 200)')
-        self.to_remove.append('rand_cell')
+        self.runModule(
+            "r.in.ascii", input="-", stdin=cell_seed_500, output="rand_cell_ref"
+        )
+        self.to_remove.append("rand_cell_ref")
+        self.assertModule("r.mapcalc", seed=seed, expression="rand_cell = rand(1, 200)")
+        self.to_remove.append("rand_cell")
         # this assert is using r.mapcalc but we are testing different
         # this assert is using r.mapcalc but we are testing different
         # functionality than used by assert
         # functionality than used by assert
-        self.assertRastersNoDifference(actual='rand_cell',
-                                       reference='rand_cell_ref',
-                                       precision=0)
-        self.rinfo_contains_number('rand_cell', seed)
+        self.assertRastersNoDifference(
+            actual="rand_cell", reference="rand_cell_ref", precision=0
+        )
+        self.rinfo_contains_number("rand_cell", seed)
 
 
     def test_seed_dcell(self):
     def test_seed_dcell(self):
         """Test given seed with DCELL against reference map"""
         """Test given seed with DCELL against reference map"""
         seed = 600
         seed = 600
-        self.runModule('r.in.ascii', input='-', stdin=dcell_seed_600,
-                       output='rand_dcell_ref')
-        self.to_remove.append('rand_dcell_ref')
-        self.assertModule('r.mapcalc', seed=seed,
-                          expression='rand_dcell = rand(1.0, 200.0)')
-        self.to_remove.append('rand_dcell')
+        self.runModule(
+            "r.in.ascii", input="-", stdin=dcell_seed_600, output="rand_dcell_ref"
+        )
+        self.to_remove.append("rand_dcell_ref")
+        self.assertModule(
+            "r.mapcalc", seed=seed, expression="rand_dcell = rand(1.0, 200.0)"
+        )
+        self.to_remove.append("rand_dcell")
         # this assert is using r.mapcalc but we are testing different
         # this assert is using r.mapcalc but we are testing different
         # functionality than used by assert
         # functionality than used by assert
-        self.assertRastersNoDifference(actual='rand_dcell',
-                                       reference='rand_dcell_ref',
-                                       precision=0.00000000000001)
-        self.rinfo_contains_number('rand_dcell', seed)
+        self.assertRastersNoDifference(
+            actual="rand_dcell", reference="rand_dcell_ref", precision=0.00000000000001
+        )
+        self.rinfo_contains_number("rand_dcell", seed)
 
 
     def test_seed_fcell(self):
     def test_seed_fcell(self):
         """Test given seed with FCELL against reference map"""
         """Test given seed with FCELL against reference map"""
         seed = 700
         seed = 700
-        self.runModule('r.in.ascii', input='-', stdin=fcell_seed_700,
-                       output='rand_fcell_ref')
-        self.to_remove.append('rand_fcell_ref')
-        self.assertModule('r.mapcalc', seed=seed,
-                          expression='rand_fcell = rand(float(1), 200)')
-        self.to_remove.append('rand_fcell')
+        self.runModule(
+            "r.in.ascii", input="-", stdin=fcell_seed_700, output="rand_fcell_ref"
+        )
+        self.to_remove.append("rand_fcell_ref")
+        self.assertModule(
+            "r.mapcalc", seed=seed, expression="rand_fcell = rand(float(1), 200)"
+        )
+        self.to_remove.append("rand_fcell")
         # this assert is using r.mapcalc but we are testing different
         # this assert is using r.mapcalc but we are testing different
         # functionality than used by assert
         # functionality than used by assert
-        self.assertRastersNoDifference(actual='rand_fcell',
-                                       reference='rand_fcell_ref',
-                                       precision=0.000001)
-        self.rinfo_contains_number('rand_fcell', seed)
+        self.assertRastersNoDifference(
+            actual="rand_fcell", reference="rand_fcell_ref", precision=0.000001
+        )
+        self.rinfo_contains_number("rand_fcell", seed)
 
 
     def test_auto_seed(self):
     def test_auto_seed(self):
         """Test that two runs with -s does not give same maps"""
         """Test that two runs with -s does not give same maps"""
-        self.assertModule('r.mapcalc', flags='s',
-                          expression='rand_auto_1 = rand(1., 2)')
-        self.to_remove.append('rand_auto_1')
-        self.assertModule('r.mapcalc', flags='s',
-                          expression='rand_auto_2 = rand(1., 2)')
-        self.to_remove.append('rand_auto_2')
+        self.assertModule(
+            "r.mapcalc", flags="s", expression="rand_auto_1 = rand(1., 2)"
+        )
+        self.to_remove.append("rand_auto_1")
+        self.assertModule(
+            "r.mapcalc", flags="s", expression="rand_auto_2 = rand(1., 2)"
+        )
+        self.to_remove.append("rand_auto_2")
         self.assertRastersDifference(
         self.assertRastersDifference(
-            'rand_auto_1', 'rand_auto_2',
+            "rand_auto_1",
+            "rand_auto_2",
             statistics=dict(min=-1, max=1, mean=0),
             statistics=dict(min=-1, max=1, mean=0),
-            precision=0.5)  # low precision, we have few cells
+            precision=0.5,
+        )  # low precision, we have few cells
 
 
 
 
 # TODO: add more expressions
 # TODO: add more expressions
 # TODO: add tests with prepared data
 # TODO: add tests with prepared data
 
 
+
 class TestBasicOperations(TestCase):
 class TestBasicOperations(TestCase):
 
 
     # TODO: replace by unified handing of maps
     # TODO: replace by unified handing of maps
@@ -173,59 +183,58 @@ class TestBasicOperations(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='raster',
-                name=','.join(cls.to_remove), verbose=True)
+            cls.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(cls.to_remove),
+                verbose=True,
+            )
 
 
     def test_difference_of_the_same_map_double(self):
     def test_difference_of_the_same_map_double(self):
         """Test zero difference of map with itself"""
         """Test zero difference of map with itself"""
-        self.runModule('r.mapcalc', flags='s',
-                       expression='a = rand(1.0, 200)')
-        self.to_remove.append('a')
-        self.assertModule('r.mapcalc',
-            expression='diff_a_a = a - a')
-        self.to_remove.append('diff_a_a')
-        self.assertRasterMinMax('diff_a_a', refmin=0, refmax=0)
+        self.runModule("r.mapcalc", flags="s", expression="a = rand(1.0, 200)")
+        self.to_remove.append("a")
+        self.assertModule("r.mapcalc", expression="diff_a_a = a - a")
+        self.to_remove.append("diff_a_a")
+        self.assertRasterMinMax("diff_a_a", refmin=0, refmax=0)
 
 
     def test_difference_of_the_same_map_float(self):
     def test_difference_of_the_same_map_float(self):
         """Test zero difference of map with itself"""
         """Test zero difference of map with itself"""
-        self.runModule('r.mapcalc', flags='s',
-                       expression='af = rand(float(1), 200)')
-        self.to_remove.append('af')
-        self.assertModule('r.mapcalc',
-            expression='diff_af_af = af - af')
-        self.to_remove.append('diff_af_af')
-        self.assertRasterMinMax('diff_af_af', refmin=0, refmax=0)
+        self.runModule("r.mapcalc", flags="s", expression="af = rand(float(1), 200)")
+        self.to_remove.append("af")
+        self.assertModule("r.mapcalc", expression="diff_af_af = af - af")
+        self.to_remove.append("diff_af_af")
+        self.assertRasterMinMax("diff_af_af", refmin=0, refmax=0)
 
 
     def test_difference_of_the_same_map_int(self):
     def test_difference_of_the_same_map_int(self):
         """Test zero difference of map with itself"""
         """Test zero difference of map with itself"""
-        self.runModule('r.mapcalc', flags='s',
-                       expression='ai = rand(1, 200)')
-        self.to_remove.append('ai')
-        self.assertModule('r.mapcalc',
-            expression='diff_ai_ai = ai - ai')
-        self.to_remove.append('diff_ai_ai')
-        self.assertRasterMinMax('diff_ai_ai', refmin=0, refmax=0)
+        self.runModule("r.mapcalc", flags="s", expression="ai = rand(1, 200)")
+        self.to_remove.append("ai")
+        self.assertModule("r.mapcalc", expression="diff_ai_ai = ai - ai")
+        self.to_remove.append("diff_ai_ai")
+        self.assertRasterMinMax("diff_ai_ai", refmin=0, refmax=0)
 
 
     def test_difference_of_the_same_expression(self):
     def test_difference_of_the_same_expression(self):
         """Test zero difference of two same expressions"""
         """Test zero difference of two same expressions"""
-        self.assertModule('r.mapcalc',
-            expression='diff_e_e = 3 * x() * y() - 3 * x() * y()')
-        self.to_remove.append('diff_e_e')
-        self.assertRasterMinMax('diff_e_e', refmin=0, refmax=0)
+        self.assertModule(
+            "r.mapcalc", expression="diff_e_e = 3 * x() * y() - 3 * x() * y()"
+        )
+        self.to_remove.append("diff_e_e")
+        self.assertRasterMinMax("diff_e_e", refmin=0, refmax=0)
 
 
     def test_nrows_ncols_sum(self):
     def test_nrows_ncols_sum(self):
         """Test if sum of nrows and ncols matches one
         """Test if sum of nrows and ncols matches one
         expected from current region settigs"""
         expected from current region settigs"""
-        self.assertModule('r.mapcalc',
-            expression='nrows_ncols_sum = nrows() + ncols()')
-        self.to_remove.append('nrows_ncols_sum')
-        self.assertRasterMinMax('nrows_ncols_sum', refmin=20, refmax=20)
+        self.assertModule("r.mapcalc", expression="nrows_ncols_sum = nrows() + ncols()")
+        self.to_remove.append("nrows_ncols_sum")
+        self.assertRasterMinMax("nrows_ncols_sum", refmin=20, refmax=20)
 
 
 
 
 class TestRegionOperations(TestCase):
 class TestRegionOperations(TestCase):
@@ -236,12 +245,12 @@ class TestRegionOperations(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=30, s=15, e=30, w=15, res=5)
-        cls.runModule('r.mapcalc', expression="test_region_1 = 1", seed=1)
-        cls.runModule('g.region', n=25, s=10, e=25, w=10, res=5)
-        cls.runModule('r.mapcalc', expression="test_region_2 = 2", seed=1)
-        cls.runModule('g.region', n=20, s=5, e=20, w=5, res=1)
-        cls.runModule('r.mapcalc', expression="test_region_3 = 3", seed=1)
+        cls.runModule("g.region", n=30, s=15, e=30, w=15, res=5)
+        cls.runModule("r.mapcalc", expression="test_region_1 = 1", seed=1)
+        cls.runModule("g.region", n=25, s=10, e=25, w=10, res=5)
+        cls.runModule("r.mapcalc", expression="test_region_2 = 2", seed=1)
+        cls.runModule("g.region", n=20, s=5, e=20, w=5, res=1)
+        cls.runModule("r.mapcalc", expression="test_region_3 = 3", seed=1)
 
 
         cls.to_remove.append("test_region_1")
         cls.to_remove.append("test_region_1")
         cls.to_remove.append("test_region_2")
         cls.to_remove.append("test_region_2")
@@ -251,31 +260,72 @@ class TestRegionOperations(TestCase):
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='raster',
-                name=','.join(cls.to_remove), verbose=True)
+            cls.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(cls.to_remove),
+                verbose=True,
+            )
 
 
     def test_union(self):
     def test_union(self):
         """Test the union region option"""
         """Test the union region option"""
-        self.assertModule('r.mapcalc', region="union", seed=1,
-                          expression='test_region_4 = test_region_1 + test_region_2 + test_region_3')
-        self.to_remove.append('test_region_4')
-
-        self.assertModuleKeyValue('r.info', map='test_region_4', flags='gr',
-                                  reference=dict(min=6, max=6, cells=625, north=30,
-                                  south=5, west=5, east=30, nsres=1, ewres=1),
-                                  precision=0.01, sep='=')
+        self.assertModule(
+            "r.mapcalc",
+            region="union",
+            seed=1,
+            expression="test_region_4 = test_region_1 + test_region_2 + test_region_3",
+        )
+        self.to_remove.append("test_region_4")
+
+        self.assertModuleKeyValue(
+            "r.info",
+            map="test_region_4",
+            flags="gr",
+            reference=dict(
+                min=6,
+                max=6,
+                cells=625,
+                north=30,
+                south=5,
+                west=5,
+                east=30,
+                nsres=1,
+                ewres=1,
+            ),
+            precision=0.01,
+            sep="=",
+        )
 
 
     def test_intersect(self):
     def test_intersect(self):
         """Test the intersect region option"""
         """Test the intersect region option"""
-        self.assertModule('r.mapcalc', region="intersect", seed=1,
-                          expression='test_region_5 = test_region_1 + test_region_2 + test_region_3')
-        self.to_remove.append('test_region_5')
-
-        self.assertModuleKeyValue('r.info', map='test_region_5', flags='gr',
-                                  reference=dict(min=6, max=6, cells=25, north=20,
-                                  south=15, west=15, east=20, nsres=1, ewres=1),
-                                  precision=0.01, sep='=')
-
-
-if __name__ == '__main__':
+        self.assertModule(
+            "r.mapcalc",
+            region="intersect",
+            seed=1,
+            expression="test_region_5 = test_region_1 + test_region_2 + test_region_3",
+        )
+        self.to_remove.append("test_region_5")
+
+        self.assertModuleKeyValue(
+            "r.info",
+            map="test_region_5",
+            flags="gr",
+            reference=dict(
+                min=6,
+                max=6,
+                cells=25,
+                north=20,
+                south=15,
+                west=15,
+                east=20,
+                nsres=1,
+                ewres=1,
+            ),
+            precision=0.01,
+            sep="=",
+        )
+
+
+if __name__ == "__main__":
     test()
     test()

+ 30 - 17
raster/r.mapcalc/testsuite/test_row_above_below_bug.py

@@ -47,42 +47,55 @@ null: *
 * * *
 * * *
 """
 """
 
 
+
 class TestRowAboveAndBelowBug(TestCase):
 class TestRowAboveAndBelowBug(TestCase):
     # TODO: replace by unified handing of maps
     # TODO: replace by unified handing of maps
     to_remove = []
     to_remove = []
-    input = 'r_mapcalc_test_input'
-    output = 'r_mapcalc_test_output'
-    output_ref = 'r_mapcalc_test_output_ref'
+    input = "r_mapcalc_test_input"
+    output = "r_mapcalc_test_output"
+    output_ref = "r_mapcalc_test_output_ref"
 
 
     def setUp(self):
     def setUp(self):
         self.use_temp_region()
         self.use_temp_region()
-        self.runModule('r.in.ascii', input='-', stdin_=INPUT,
-                       output=self.input, overwrite=True)
+        self.runModule(
+            "r.in.ascii", input="-", stdin_=INPUT, output=self.input, overwrite=True
+        )
         self.to_remove.append(self.input)
         self.to_remove.append(self.input)
-        self.runModule('g.region', raster=self.input)
-        self.runModule('r.in.ascii', input='-', stdin_=OUTPUT,
-                       output=self.output_ref, overwrite=True)
+        self.runModule("g.region", raster=self.input)
+        self.runModule(
+            "r.in.ascii",
+            input="-",
+            stdin_=OUTPUT,
+            output=self.output_ref,
+            overwrite=True,
+        )
         self.to_remove.append(self.output_ref)
         self.to_remove.append(self.output_ref)
 
 
     def tearDown(self):
     def tearDown(self):
         self.del_temp_region()
         self.del_temp_region()
         if 0 and self.to_remove:
         if 0 and self.to_remove:
-            self.runModule('g.remove', flags='f', type='raster',
-                           name=','.join(self.to_remove), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(self.to_remove),
+                verbose=True,
+            )
 
 
     def r_mapcalc_with_test(self, expression):
     def r_mapcalc_with_test(self, expression):
         """Expects just RHS and inputs as ``{m}`` for format function"""
         """Expects just RHS and inputs as ``{m}`` for format function"""
         expression = expression.format(m=self.input)
         expression = expression.format(m=self.input)
         expression = "{0} = {1}".format(self.output, expression)
         expression = "{0} = {1}".format(self.output, expression)
-        self.assertModule('r.mapcalc', expression=expression, overwrite=True)
+        self.assertModule("r.mapcalc", expression=expression, overwrite=True)
         self.assertRasterExists(self.output)
         self.assertRasterExists(self.output)
         self.to_remove.append(self.output)
         self.to_remove.append(self.output)
         ref_univar = dict(null_cells=6, cells=9)
         ref_univar = dict(null_cells=6, cells=9)
-        self.assertRasterFitsUnivar(raster=self.output,
-                                    reference=ref_univar, precision=0)
-        self.assertRastersNoDifference(actual=self.output,
-                                       reference=self.output_ref,
-                                       precision=0)  # it's CELL type
+        self.assertRasterFitsUnivar(
+            raster=self.output, reference=ref_univar, precision=0
+        )
+        self.assertRastersNoDifference(
+            actual=self.output, reference=self.output_ref, precision=0
+        )  # it's CELL type
 
 
     def test_below_above(self):
     def test_below_above(self):
         self.r_mapcalc_with_test("{m}[1,0] + {m}[-1,0]")
         self.r_mapcalc_with_test("{m}[1,0] + {m}[-1,0]")
@@ -91,5 +104,5 @@ class TestRowAboveAndBelowBug(TestCase):
         self.r_mapcalc_with_test("{m}[-1,0] + {m}[1,0]")
         self.r_mapcalc_with_test("{m}[-1,0] + {m}[1,0]")
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 17 - 11
raster/r.mode/testsuite/testrmode.py

@@ -15,27 +15,33 @@ from grass.gunittest.main import test
 
 
 
 
 class Testrmode(TestCase):
 class Testrmode(TestCase):
-    output = 'rmode'
-    base = 'geology'
-    cover = 'soils'
+    output = "rmode"
+    base = "geology"
+    cover = "soils"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.base, flags='d')
+        cls.runModule("g.region", raster=cls.base, flags="d")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(self):
     def tearDown(self):
-        self.runModule('g.remove', type='raster', flags='f', name=self.output)
+        self.runModule("g.remove", type="raster", flags="f", name=self.output)
 
 
     def test_1(self):
     def test_1(self):
-        self.assertModule('r.mode', base=self.base, cover=self.cover, output=self.output)
-        self.assertRasterMinMax(map=self.output, refmin=21513, refmax=46487,
-                                msg="soils must be between 21513 and 46487")
-
-
-if __name__ == '__main__':
+        self.assertModule(
+            "r.mode", base=self.base, cover=self.cover, output=self.output
+        )
+        self.assertRasterMinMax(
+            map=self.output,
+            refmin=21513,
+            refmax=46487,
+            msg="soils must be between 21513 and 46487",
+        )
+
+
+if __name__ == "__main__":
     test()
     test()

+ 2 - 1
raster/r.neighbors/testsuite/test_r_neighbors.py

@@ -509,7 +509,8 @@ class TestNeighbors(TestCase):
         selection = "test_neighbors_selection"
         selection = "test_neighbors_selection"
         self.to_remove.append(selection)
         self.to_remove.append(selection)
         self.runModule(
         self.runModule(
-            "r.mapcalc", expression="{}=if(y()==15,1,null())".format(selection),
+            "r.mapcalc",
+            expression="{}=if(y()==15,1,null())".format(selection),
         )
         )
         self.assertModule(
         self.assertModule(
             "r.neighbors",
             "r.neighbors",

+ 63 - 44
raster/r.patch/testsuite/test_rpatch_artificial.py

@@ -125,99 +125,118 @@ class TestSmallDataNoOverlap(TestCase):
 
 
     # TODO: replace by unified handing of maps
     # TODO: replace by unified handing of maps
     to_remove = []
     to_remove = []
-    cell_1 = 'rpatch_small_test_cell_1'
-    cell_2 = 'rpatch_small_test_cell_2'
-    cell_patched = 'rpatch_small_test_cell_patched'
-    cell_patched_ref = 'rpatch_small_test_cell_patched_ref'
+    cell_1 = "rpatch_small_test_cell_1"
+    cell_2 = "rpatch_small_test_cell_2"
+    cell_patched = "rpatch_small_test_cell_patched"
+    cell_patched_ref = "rpatch_small_test_cell_patched_ref"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
         # 10 / 4 == 2.5 (size of raster / number of cells)
         # 10 / 4 == 2.5 (size of raster / number of cells)
-        cls.runModule('g.region', n=30, s=10, e=25, w=15, res=2.5)
+        cls.runModule("g.region", n=30, s=10, e=25, w=15, res=2.5)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='raster',
-                          name=','.join(cls.to_remove), verbose=True)
+            cls.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(cls.to_remove),
+                verbose=True,
+            )
 
 
     def test_patching_cell(self):
     def test_patching_cell(self):
         """Test patching two neighboring CELL raster maps"""
         """Test patching two neighboring CELL raster maps"""
-        self.runModule('r.in.ascii', input='-', stdin=cell_1,
-                       output=self.cell_1)
+        self.runModule("r.in.ascii", input="-", stdin=cell_1, output=self.cell_1)
         self.to_remove.append(self.cell_1)
         self.to_remove.append(self.cell_1)
-        self.runModule('r.in.ascii', input='-', stdin=cell_2,
-                       output=self.cell_2)
+        self.runModule("r.in.ascii", input="-", stdin=cell_2, output=self.cell_2)
         self.to_remove.append(self.cell_2)
         self.to_remove.append(self.cell_2)
 
 
-        self.assertModule('r.patch', input=(self.cell_1, self.cell_2),
-                          output=self.cell_patched)
+        self.assertModule(
+            "r.patch", input=(self.cell_1, self.cell_2), output=self.cell_patched
+        )
         self.to_remove.append(self.cell_patched)
         self.to_remove.append(self.cell_patched)
-        self.runModule('r.in.ascii', input='-', stdin=cell_patched_ref,
-                       output=self.cell_patched_ref)
+        self.runModule(
+            "r.in.ascii",
+            input="-",
+            stdin=cell_patched_ref,
+            output=self.cell_patched_ref,
+        )
         self.to_remove.append(self.cell_patched_ref)
         self.to_remove.append(self.cell_patched_ref)
-        self.assertRastersNoDifference(self.cell_patched,
-                                       self.cell_patched_ref, precision=0)
+        self.assertRastersNoDifference(
+            self.cell_patched, self.cell_patched_ref, precision=0
+        )
 
 
 
 
 class TestSmallDataOverlap(TestCase):
 class TestSmallDataOverlap(TestCase):
 
 
     # TODO: replace by unified handing of maps
     # TODO: replace by unified handing of maps
     to_remove = []
     to_remove = []
-    cell_a = 'rpatch_small_test_cell_a'
-    cell_b = 'rpatch_small_test_cell_b'
-    cell_ab = 'rpatch_small_test_cell_ab_reference'
-    cell_ba = 'rpatch_small_test_cell_ba_reference'
-    cell_ab_result = 'rpatch_small_test_cell_ab_result'
-    cell_ba_result = 'rpatch_small_test_cell_ba_result'
+    cell_a = "rpatch_small_test_cell_a"
+    cell_b = "rpatch_small_test_cell_b"
+    cell_ab = "rpatch_small_test_cell_ab_reference"
+    cell_ba = "rpatch_small_test_cell_ba_reference"
+    cell_ab_result = "rpatch_small_test_cell_ab_result"
+    cell_ba_result = "rpatch_small_test_cell_ba_result"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
         # 15 / 6 == 2.5 ((n-s) / number of cells)
         # 15 / 6 == 2.5 ((n-s) / number of cells)
         # 10 / 8 == 1.25 ((e-w) / number of cells)
         # 10 / 8 == 1.25 ((e-w) / number of cells)
-        cls.runModule('g.region', n=35, s=20, e=25, w=15,
-                      nsres=2.5, ewres=1.25)
-        cls.runModule('r.in.ascii', input='-', stdin=cell_overlap_a,
-                      output=cls.cell_a)
+        cls.runModule("g.region", n=35, s=20, e=25, w=15, nsres=2.5, ewres=1.25)
+        cls.runModule("r.in.ascii", input="-", stdin=cell_overlap_a, output=cls.cell_a)
         cls.to_remove.append(cls.cell_a)
         cls.to_remove.append(cls.cell_a)
-        cls.runModule('r.in.ascii', input='-', stdin=cell_overlap_b,
-                      output=cls.cell_b)
+        cls.runModule("r.in.ascii", input="-", stdin=cell_overlap_b, output=cls.cell_b)
         cls.to_remove.append(cls.cell_b)
         cls.to_remove.append(cls.cell_b)
-        cls.runModule('r.in.ascii', input='-', stdin=cell_overlap_ab,
-                      output=cls.cell_ab)
+        cls.runModule(
+            "r.in.ascii", input="-", stdin=cell_overlap_ab, output=cls.cell_ab
+        )
         cls.to_remove.append(cls.cell_ab)
         cls.to_remove.append(cls.cell_ab)
-        cls.runModule('r.in.ascii', input='-', stdin=cell_overlap_ba,
-                      output=cls.cell_ba)
+        cls.runModule(
+            "r.in.ascii", input="-", stdin=cell_overlap_ba, output=cls.cell_ba
+        )
         cls.to_remove.append(cls.cell_ba)
         cls.to_remove.append(cls.cell_ba)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='raster',
-                          name=','.join(cls.to_remove), verbose=True)
+            cls.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(cls.to_remove),
+                verbose=True,
+            )
 
 
     def test_patch_oder_ab_cell(self):
     def test_patch_oder_ab_cell(self):
         """Test patching two overlapping CELL raster maps (watching order)"""
         """Test patching two overlapping CELL raster maps (watching order)"""
-        self.assertModule('r.patch', input=(self.cell_a, self.cell_b),
-                          output=self.cell_ab_result, flags='z')
+        self.assertModule(
+            "r.patch",
+            input=(self.cell_a, self.cell_b),
+            output=self.cell_ab_result,
+            flags="z",
+        )
         self.assertRasterExists(self.cell_ab_result)
         self.assertRasterExists(self.cell_ab_result)
         self.to_remove.append(self.cell_ab_result)
         self.to_remove.append(self.cell_ab_result)
-        self.assertRastersNoDifference(self.cell_ab_result,
-                                       self.cell_ab, precision=0)
+        self.assertRastersNoDifference(self.cell_ab_result, self.cell_ab, precision=0)
 
 
     def test_patch_oder_ba_cell(self):
     def test_patch_oder_ba_cell(self):
         """Test patching two overlapping CELL raster maps (watching order)"""
         """Test patching two overlapping CELL raster maps (watching order)"""
-        self.assertModule('r.patch', input=(self.cell_b, self.cell_a),
-                          output=self.cell_ba_result, flags='z')
+        self.assertModule(
+            "r.patch",
+            input=(self.cell_b, self.cell_a),
+            output=self.cell_ba_result,
+            flags="z",
+        )
         self.assertRasterExists(self.cell_ba_result)
         self.assertRasterExists(self.cell_ba_result)
         self.to_remove.append(self.cell_ba_result)
         self.to_remove.append(self.cell_ba_result)
-        self.assertRastersNoDifference(self.cell_ba_result,
-                                       self.cell_ba, precision=0)
+        self.assertRastersNoDifference(self.cell_ba_result, self.cell_ba, precision=0)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 57 - 26
raster/r.profile/testsuite/test_profile_ncspm.py

@@ -4,7 +4,7 @@ from grass.gunittest.gmodules import SimpleModule
 import grass.script.core as gcore
 import grass.script.core as gcore
 
 
 # not used yet
 # not used yet
-LOCATION = 'nc_spm'
+LOCATION = "nc_spm"
 
 
 output1 = """
 output1 = """
  0.000000 88.370453
  0.000000 88.370453
@@ -131,61 +131,92 @@ output5 = """
 
 
 
 
 class TestProfileNCSPM(TestCase):
 class TestProfileNCSPM(TestCase):
-
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         gcore.use_temp_region()
         gcore.use_temp_region()
-        gcore.run_command('g.region', raster='elevation')
+        gcore.run_command("g.region", raster="elevation")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         gcore.del_temp_region()
         gcore.del_temp_region()
 
 
     def test_profile_default(self):
     def test_profile_default(self):
-        rprofile = SimpleModule('r.profile', input='elevation',
-                                coordinates=[637656, 224222, 637766, 224289])
+        rprofile = SimpleModule(
+            "r.profile", input="elevation", coordinates=[637656, 224222, 637766, 224289]
+        )
         self.assertModule(rprofile)
         self.assertModule(rprofile)
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output1.strip())
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output1.strip())
-        self.assertIn('128.798292 [meters]', rprofile.outputs.stderr)  # distance
-        self.assertIn('10 [meters]', rprofile.outputs.stderr)  # resolution
+        self.assertIn("128.798292 [meters]", rprofile.outputs.stderr)  # distance
+        self.assertIn("10 [meters]", rprofile.outputs.stderr)  # resolution
 
 
     def test_profile_m(self):
     def test_profile_m(self):
-        rprofile = SimpleModule('r.profile', input='elevation', units='meters',
-                                coordinates=[637656, 224222, 637766, 224289])
+        rprofile = SimpleModule(
+            "r.profile",
+            input="elevation",
+            units="meters",
+            coordinates=[637656, 224222, 637766, 224289],
+        )
         self.assertModule(rprofile)
         self.assertModule(rprofile)
-        self.assertIn('128.798292 [meters]', rprofile.outputs.stderr)  # distance
-        self.assertIn('10 [meters]', rprofile.outputs.stderr)  # resolution
+        self.assertIn("128.798292 [meters]", rprofile.outputs.stderr)  # distance
+        self.assertIn("10 [meters]", rprofile.outputs.stderr)  # resolution
 
 
     def test_profile_resolution(self):
     def test_profile_resolution(self):
-        rprofile = SimpleModule('r.profile', input='elevation', resolution=25,
-                                coordinates=[637656, 224222, 637766, 224289])
+        rprofile = SimpleModule(
+            "r.profile",
+            input="elevation",
+            resolution=25,
+            coordinates=[637656, 224222, 637766, 224289],
+        )
         self.assertModule(rprofile)
         self.assertModule(rprofile)
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output4.strip())
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output4.strip())
-        self.assertIn('128.798292 [meters]', rprofile.outputs.stderr)  # distance
-        self.assertIn('25 [meters]', rprofile.outputs.stderr)  # resolution
+        self.assertIn("128.798292 [meters]", rprofile.outputs.stderr)  # distance
+        self.assertIn("25 [meters]", rprofile.outputs.stderr)  # resolution
 
 
     def test_profile_ne(self):
     def test_profile_ne(self):
-        rprofile = SimpleModule('r.profile', input='elevation', flags='g',
-                                coordinates=[637656, 224222, 637766, 224289])
+        rprofile = SimpleModule(
+            "r.profile",
+            input="elevation",
+            flags="g",
+            coordinates=[637656, 224222, 637766, 224289],
+        )
         self.assertModule(rprofile)
         self.assertModule(rprofile)
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output2.strip())
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output2.strip())
 
 
     def test_profile_region(self):
     def test_profile_region(self):
-        rprofile = SimpleModule('r.profile', input='elevation', null_value='nodata',
-                                coordinates=[644914, 224579, 644986,
-                                             224627, 645091, 224549])
+        rprofile = SimpleModule(
+            "r.profile",
+            input="elevation",
+            null_value="nodata",
+            coordinates=[644914, 224579, 644986, 224627, 645091, 224549],
+        )
         self.assertModule(rprofile)
         self.assertModule(rprofile)
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output3.strip())
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output3.strip())
-        self.assertIn("WARNING: Endpoint coordinates are outside of current region settings",
-                      rprofile.outputs.stderr)
+        self.assertIn(
+            "WARNING: Endpoint coordinates are outside of current region settings",
+            rprofile.outputs.stderr,
+        )
 
 
     def test_profile_directions(self):
     def test_profile_directions(self):
-        rprofile = SimpleModule('r.profile', input='elevation', flags='g',
-                                coordinates=[635747, 222664, 635673, 222717, 635563,
-                                             222634, 635641, 222543, 635747, 222664])
+        rprofile = SimpleModule(
+            "r.profile",
+            input="elevation",
+            flags="g",
+            coordinates=[
+                635747,
+                222664,
+                635673,
+                222717,
+                635563,
+                222634,
+                635641,
+                222543,
+                635747,
+                222664,
+            ],
+        )
         self.assertModule(rprofile)
         self.assertModule(rprofile)
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output5.strip())
         self.assertMultiLineEqual(rprofile.outputs.stdout.strip(), output5.strip())
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 34 - 18
raster/r.random.cells/testsuite/test_random_cells.py

@@ -17,7 +17,6 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 
 
 
 
-
 class TestCounts(TestCase):
 class TestCounts(TestCase):
 
 
     # TODO: replace by unified handing of maps
     # TODO: replace by unified handing of maps
@@ -31,47 +30,64 @@ class TestCounts(TestCase):
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
         # (20-10) / 2 * (60-40) / 2 = 50 cells
         # (20-10) / 2 * (60-40) / 2 = 50 cells
-        cls.runModule('g.region', n=20, s=10, e=60, w=40, res=2)
+        cls.runModule("g.region", n=20, s=10, e=60, w=40, res=2)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='raster',
-                          name=','.join(cls.to_remove), verbose=True)
+            cls.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(cls.to_remove),
+                verbose=True,
+            )
 
 
     def test_fill_all(self):
     def test_fill_all(self):
-        self.assertModule('r.random.cells', output=self.all_rast,
-                          distance=0.01, seed=100)
+        self.assertModule(
+            "r.random.cells", output=self.all_rast, distance=0.01, seed=100
+        )
         self.to_remove.append(self.all_rast)
         self.to_remove.append(self.all_rast)
         self.assertRasterFitsUnivar(
         self.assertRasterFitsUnivar(
             self.all_rast,
             self.all_rast,
-            reference=dict(cells=self.n_cells, n=self.n_cells, null_cells=0,
-                           min=1, max=self.n_cells))
+            reference=dict(
+                cells=self.n_cells,
+                n=self.n_cells,
+                null_cells=0,
+                min=1,
+                max=self.n_cells,
+            ),
+        )
 
 
     def test_fill_some(self):
     def test_fill_some(self):
-        self.assertModule('r.random.cells', output=self.some_rast,
-                          distance=2, seed=100)
+        self.assertModule("r.random.cells", output=self.some_rast, distance=2, seed=100)
         self.to_remove.append(self.some_rast)
         self.to_remove.append(self.some_rast)
         self.assertRasterFitsUnivar(
         self.assertRasterFitsUnivar(
-            self.some_rast,
-            reference=dict(cells=self.n_cells, min=1))
+            self.some_rast, reference=dict(cells=self.n_cells, min=1)
+        )
         # it is hard to say how much but it will be less than half
         # it is hard to say how much but it will be less than half
         self.assertRasterMinMax(self.some_rast, 1, self.n_cells / 2)
         self.assertRasterMinMax(self.some_rast, 1, self.n_cells / 2)
 
 
     def test_fill_count(self):
     def test_fill_count(self):
         count = 12
         count = 12
-        self.assertModule('r.random.cells', output=self.count_rast,
-                          distance=2, seed=100, ncells=count)
+        self.assertModule(
+            "r.random.cells", output=self.count_rast, distance=2, seed=100, ncells=count
+        )
         self.to_remove.append(self.count_rast)
         self.to_remove.append(self.count_rast)
         self.assertRasterFitsUnivar(
         self.assertRasterFitsUnivar(
             self.count_rast,
             self.count_rast,
-            reference=dict(cells=self.n_cells, n=count,
-                           null_cells=self.n_cells - count,
-                           min=1, max=count))
+            reference=dict(
+                cells=self.n_cells,
+                n=count,
+                null_cells=self.n_cells - count,
+                min=1,
+                max=count,
+            ),
+        )
         # it is hard to say how much but it will be less than half
         # it is hard to say how much but it will be less than half
         self.assertRasterMinMax(self.count_rast, 1, count)
         self.assertRasterMinMax(self.count_rast, 1, count)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 209 - 117
raster/r.random/testsuite/test_r_random.py

@@ -1,117 +1,209 @@
-"""
-Name:        r.random test
-Purpose:    Tests r.random module and some of its options.
-
-Author:     Shubham Sharma, Google Code-in 2018
-Copyright:  (C) 2018 by Shubham Sharma and the GRASS Development Team
-Licence:    This program is free software under the GNU General Public
-            License (>=v2). Read the file COPYING that comes with GRASS
-            for details.
-"""
-
-from grass.gunittest.case import TestCase
-from grass.gunittest.main import test
-
-
-class TestRasterTile(TestCase):
-    input = 'landcover_1m'
-    npoints = '20'
-    raster = 'landcover_1m_raster_random'
-    vector = "landcover_1m_vector_random"
-
-    @classmethod
-    def setUpClass(cls):
-        cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input)
-
-    @classmethod
-    def tearDownClass(cls):
-        cls.del_temp_region()
-
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.raster)
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.raster + '_null')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.raster + '_without_topology')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.raster + '_3D')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.raster + '_cover_landcover_1m')
-
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.vector)
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.vector+'_null')
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.vector + '_without_topology')
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.vector + '_3D')
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.vector + '_cover_landcover_1m')
-
-    def test_random_raster(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random', input=self.input, npoints=self.npoints, raster=self.raster)
-        # check if random raster was created
-        self.assertRasterExists(self.raster, msg="landcover_1m_raster_random was not created")
-
-    def test_random_vector(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random', input=self.input, npoints=self.npoints, vector=self.vector)
-        # check if random vector was created
-        self.assertVectorExists(self.vector, msg="landcover_1m_vector_random was not created")
-        topology = dict(points=20,primitives=20)
-        self.assertVectorFitsTopoInfo(vector=self.vector, reference=topology)
-
-    def test_random_raster_flag_z(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random', flags='z', input=self.input, npoints=self.npoints, raster=self.raster+'_null')
-        # check if random raster ( with NULL values )  was created
-        self.assertRasterExists(self.raster, msg="landcover_1m_raster_random_null was not created")
-
-
-    def test_vector_random_flag_z(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random', flags='z', input=self.input, npoints=self.npoints, vector=self.vector+'_null')
-        # check if random vector ( with NULL values ) was created
-        self.assertVectorExists(self.vector+'_null', msg="landcover_1m_vector_random_null was not created")
-        topology = dict(points=20,primitives=20)
-        self.assertVectorFitsTopoInfo(vector=self.vector+'_null', reference=topology)
-
-    def test_random_raster_flag_b(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random', flags='b', input=self.input, npoints=self.npoints, raster=self.raster+'_without_topology')
-        # check if random raster ( without topology )  was created
-        self.assertRasterExists(self.raster, msg="landcover_1m_raster_random_without_topologywas not created")
-
-    def test_vector_random_flag_b(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random', flags='b', input=self.input, npoints=self.npoints, vector=self.vector+'_without_topology')
-        # check if random vector ( without topology ) was created
-        self.assertVectorExists(self.vector+'_without_topology', msg="landcover_1m_vector_random_without_topology was not created")
-        topology = dict(points=20,primitives=20)
-        self.assertVectorFitsTopoInfo(vector=self.vector+'_without_topology', reference=topology)
-
-    def test_random_raster_flag_d(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random', flags='d', input=self.input, npoints=self.npoints, raster=self.raster+'_3D')
-        # check if random raster ( 3D points )  was created
-        self.assertRasterExists(self.raster, msg="landcover_1m_raster_random_3D not created")
-
-    def test_vector_random_flag_d(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random', flags='d', input=self.input, npoints=self.npoints, vector=self.vector+'_3D')
-        # check if random vector ( 3D points ) was created
-        self.assertVectorExists(self.vector+'_3D', msg="landcover_1m_vector_random_3D was not created")
-        topology = dict(points=20,primitives=20)
-        self.assertVectorFitsTopoInfo(vector=self.vector+'_3D', reference=topology)
-
-
-    def test_random_raster_cover(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random',input='landuse96_28m', npoints=self.npoints, cover='landcover_1m', raster=self.raster+'_cover_landcover_1m')
-        # check if random raster ( 3D points )  was created
-        self.assertRasterExists(self.raster+'_cover_landcover_1m', msg="landcover_1m_raster_random_cover_landcover_1m was not created")
-
-    def test_vector_random_flag_d(self):
-        """Testing r.random  runs successfully"""
-        self.assertModule('r.random',input='landuse96_28m', npoints=self.npoints, cover='landcover_1m', vector=self.vector+'_cover_landcover_1m')
-        # check if random vector ( 3D points ) was created
-        self.assertVectorExists(self.vector+'_cover_landcover_1m', msg="landcover_1m_vector_cover_landcover_1m was not created")
-        topology = dict(points=20, primitives=20)
-        self.assertVectorFitsTopoInfo(vector=self.vector+'_cover_landcover_1m', reference=topology)
-
-
-if __name__ == '__main__':
-    test()
+"""
+Name:        r.random test
+Purpose:    Tests r.random module and some of its options.
+
+Author:     Shubham Sharma, Google Code-in 2018
+Copyright:  (C) 2018 by Shubham Sharma and the GRASS Development Team
+Licence:    This program is free software under the GNU General Public
+            License (>=v2). Read the file COPYING that comes with GRASS
+            for details.
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+
+
+class TestRasterTile(TestCase):
+    input = "landcover_1m"
+    npoints = "20"
+    raster = "landcover_1m_raster_random"
+    vector = "landcover_1m_vector_random"
+
+    @classmethod
+    def setUpClass(cls):
+        cls.use_temp_region()
+        cls.runModule("g.region", raster=cls.input)
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.del_temp_region()
+
+        cls.runModule("g.remove", type="raster", flags="f", name=cls.raster)
+        cls.runModule("g.remove", type="raster", flags="f", name=cls.raster + "_null")
+        cls.runModule(
+            "g.remove", type="raster", flags="f", name=cls.raster + "_without_topology"
+        )
+        cls.runModule("g.remove", type="raster", flags="f", name=cls.raster + "_3D")
+        cls.runModule(
+            "g.remove",
+            type="raster",
+            flags="f",
+            name=cls.raster + "_cover_landcover_1m",
+        )
+
+        cls.runModule("g.remove", type="vector", flags="f", name=cls.vector)
+        cls.runModule("g.remove", type="vector", flags="f", name=cls.vector + "_null")
+        cls.runModule(
+            "g.remove", type="vector", flags="f", name=cls.vector + "_without_topology"
+        )
+        cls.runModule("g.remove", type="vector", flags="f", name=cls.vector + "_3D")
+        cls.runModule(
+            "g.remove",
+            type="vector",
+            flags="f",
+            name=cls.vector + "_cover_landcover_1m",
+        )
+
+    def test_random_raster(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random", input=self.input, npoints=self.npoints, raster=self.raster
+        )
+        # check if random raster was created
+        self.assertRasterExists(
+            self.raster, msg="landcover_1m_raster_random was not created"
+        )
+
+    def test_random_vector(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random", input=self.input, npoints=self.npoints, vector=self.vector
+        )
+        # check if random vector was created
+        self.assertVectorExists(
+            self.vector, msg="landcover_1m_vector_random was not created"
+        )
+        topology = dict(points=20, primitives=20)
+        self.assertVectorFitsTopoInfo(vector=self.vector, reference=topology)
+
+    def test_random_raster_flag_z(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random",
+            flags="z",
+            input=self.input,
+            npoints=self.npoints,
+            raster=self.raster + "_null",
+        )
+        # check if random raster ( with NULL values )  was created
+        self.assertRasterExists(
+            self.raster, msg="landcover_1m_raster_random_null was not created"
+        )
+
+    def test_vector_random_flag_z(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random",
+            flags="z",
+            input=self.input,
+            npoints=self.npoints,
+            vector=self.vector + "_null",
+        )
+        # check if random vector ( with NULL values ) was created
+        self.assertVectorExists(
+            self.vector + "_null", msg="landcover_1m_vector_random_null was not created"
+        )
+        topology = dict(points=20, primitives=20)
+        self.assertVectorFitsTopoInfo(vector=self.vector + "_null", reference=topology)
+
+    def test_random_raster_flag_b(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random",
+            flags="b",
+            input=self.input,
+            npoints=self.npoints,
+            raster=self.raster + "_without_topology",
+        )
+        # check if random raster ( without topology )  was created
+        self.assertRasterExists(
+            self.raster,
+            msg="landcover_1m_raster_random_without_topologywas not created",
+        )
+
+    def test_vector_random_flag_b(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random",
+            flags="b",
+            input=self.input,
+            npoints=self.npoints,
+            vector=self.vector + "_without_topology",
+        )
+        # check if random vector ( without topology ) was created
+        self.assertVectorExists(
+            self.vector + "_without_topology",
+            msg="landcover_1m_vector_random_without_topology was not created",
+        )
+        topology = dict(points=20, primitives=20)
+        self.assertVectorFitsTopoInfo(
+            vector=self.vector + "_without_topology", reference=topology
+        )
+
+    def test_random_raster_flag_d(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random",
+            flags="d",
+            input=self.input,
+            npoints=self.npoints,
+            raster=self.raster + "_3D",
+        )
+        # check if random raster ( 3D points )  was created
+        self.assertRasterExists(
+            self.raster, msg="landcover_1m_raster_random_3D not created"
+        )
+
+    def test_vector_random_flag_d(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random",
+            flags="d",
+            input=self.input,
+            npoints=self.npoints,
+            vector=self.vector + "_3D",
+        )
+        # check if random vector ( 3D points ) was created
+        self.assertVectorExists(
+            self.vector + "_3D", msg="landcover_1m_vector_random_3D was not created"
+        )
+        topology = dict(points=20, primitives=20)
+        self.assertVectorFitsTopoInfo(vector=self.vector + "_3D", reference=topology)
+
+    def test_random_raster_cover(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random",
+            input="landuse96_28m",
+            npoints=self.npoints,
+            cover="landcover_1m",
+            raster=self.raster + "_cover_landcover_1m",
+        )
+        # check if random raster ( 3D points )  was created
+        self.assertRasterExists(
+            self.raster + "_cover_landcover_1m",
+            msg="landcover_1m_raster_random_cover_landcover_1m was not created",
+        )
+
+    def test_vector_random_flag_d(self):
+        """Testing r.random  runs successfully"""
+        self.assertModule(
+            "r.random",
+            input="landuse96_28m",
+            npoints=self.npoints,
+            cover="landcover_1m",
+            vector=self.vector + "_cover_landcover_1m",
+        )
+        # check if random vector ( 3D points ) was created
+        self.assertVectorExists(
+            self.vector + "_cover_landcover_1m",
+            msg="landcover_1m_vector_cover_landcover_1m was not created",
+        )
+        topology = dict(points=20, primitives=20)
+        self.assertVectorFitsTopoInfo(
+            vector=self.vector + "_cover_landcover_1m", reference=topology
+        )
+
+
+if __name__ == "__main__":
+    test()

+ 42 - 19
raster/r.random/testsuite/testrandom.py

@@ -12,17 +12,18 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
+
 class Testrr(TestCase):
 class Testrr(TestCase):
 
 
-    input='lakes'
-    cover="elevation"
-    raster="routfile"
-    vector="voutfile"
+    input = "lakes"
+    cover = "elevation"
+    raster = "routfile"
+    vector = "voutfile"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input)
+        cls.runModule("g.region", raster=cls.input)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
@@ -31,12 +32,12 @@ class Testrr(TestCase):
     def tearDown(self):
     def tearDown(self):
         """Remove the vector map after each test method"""
         """Remove the vector map after each test method"""
 
 
-        self.runModule('g.remove', flags='f', type='vector', name=self.vector)
-        self.runModule('g.remove', flags='f', type='raster', name=self.raster)
+        self.runModule("g.remove", flags="f", type="vector", name=self.vector)
+        self.runModule("g.remove", flags="f", type="raster", name=self.raster)
 
 
     def test_flag_z(self):
     def test_flag_z(self):
         """Testing flag z"""
         """Testing flag z"""
-        string="""area_cat|count|sum
+        string = """area_cat|count|sum
         1|0|null
         1|0|null
         2|0|null
         2|0|null
         3|0|null
         3|0|null
@@ -48,32 +49,54 @@ class Testrr(TestCase):
         9|1|7
         9|1|7
         10|0|null
         10|0|null
         """
         """
-        r_random = SimpleModule('r.random', input=self.input, cover=self.cover, npoints=100, vector=self.vector, flags='z')
-        r_random.outputs.stdout= string
+        r_random = SimpleModule(
+            "r.random",
+            input=self.input,
+            cover=self.cover,
+            npoints=100,
+            vector=self.vector,
+            flags="z",
+        )
+        r_random.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=r_random.outputs.stdout)
         self.assertLooksLike(reference=string, actual=r_random.outputs.stdout)
 
 
     def test_flag_i(self):
     def test_flag_i(self):
         """Testing flag i"""
         """Testing flag i"""
-        self.assertModule('r.random', input=self.input, cover=self.cover, npoints=100, flags='i')
+        self.assertModule(
+            "r.random", input=self.input, cover=self.cover, npoints=100, flags="i"
+        )
 
 
     def test_flag_d(self):
     def test_flag_d(self):
         """Testing flag d"""
         """Testing flag d"""
-        self.assertModule('r.random', input=self.input, cover=self.cover, npoints=100, vector=self.vector, flags='d')
-        self.assertModule('v.info', map=self.vector, flags='t')
+        self.assertModule(
+            "r.random",
+            input=self.input,
+            cover=self.cover,
+            npoints=100,
+            vector=self.vector,
+            flags="d",
+        )
+        self.assertModule("v.info", map=self.vector, flags="t")
         topology = dict(points=100, lines=0, areas=0, map3d=1)
         topology = dict(points=100, lines=0, areas=0, map3d=1)
         self.assertVectorFitsTopoInfo(self.vector, topology)
         self.assertVectorFitsTopoInfo(self.vector, topology)
 
 
     def test_flag_b(self):
     def test_flag_b(self):
         """Testing flag b"""
         """Testing flag b"""
-        self.assertModule('r.random', input=self.input, cover=self.cover,
-                          npoints=36011, vector=self.vector, flags='b',
-                          overwrite=True)
-        self.assertModule('v.info', map=self.vector, flags='t')
+        self.assertModule(
+            "r.random",
+            input=self.input,
+            cover=self.cover,
+            npoints=36011,
+            vector=self.vector,
+            flags="b",
+            overwrite=True,
+        )
+        self.assertModule("v.info", map=self.vector, flags="t")
         topology = dict(points=36011, lines=0, areas=0)
         topology = dict(points=36011, lines=0, areas=0)
         self.assertVectorFitsTopoInfo(self.vector, topology)
         self.assertVectorFitsTopoInfo(self.vector, topology)
 
 
 
 
-
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 29 - 23
raster/r.reclass/testsuite/test_r_reclass.py

@@ -17,69 +17,75 @@ rules1 = """
 4 5     = 2    poor quality
 4 5     = 2    poor quality
 """
 """
 
 
-rules2="""
+rules2 = """
 1 3 5   = 1    poor quality
 1 3 5   = 1    poor quality
 2 4 6   = 2    good quality
 2 4 6   = 2    good quality
 *       = NULL
 *       = NULL
 """
 """
 
 
-rules3="""
+rules3 = """
 1 thru 10	= 1
 1 thru 10	= 1
 11 thru 20	= 2
 11 thru 20	= 2
 21 thru 30	= 3
 21 thru 30	= 3
 30 thru 40      = NULL
 30 thru 40      = NULL
 """
 """
 
 
+
 class Testrr(TestCase):
 class Testrr(TestCase):
-    output='reclass'
-    input='elevation_shade'
+    output = "reclass"
+    input = "elevation_shade"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input)
+        cls.runModule("g.region", raster=cls.input)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(self):
     def tearDown(self):
-        self.runModule('g.remove', type='raster', flags='f', name=self.output)
+        self.runModule("g.remove", type="raster", flags="f", name=self.output)
 
 
     def test_rules1(self):
     def test_rules1(self):
         """Testing rules 1 """
         """Testing rules 1 """
-        reclass = SimpleModule('r.reclass', input=self.input, output=self.output,
-                              rules='-')
+        reclass = SimpleModule(
+            "r.reclass", input=self.input, output=self.output, rules="-"
+        )
         reclass.inputs.stdin = rules1
         reclass.inputs.stdin = rules1
         self.assertModule(reclass)
         self.assertModule(reclass)
-        info = 'min=1\nmax=2\ndatatype=CELL'
-        self.assertRasterFitsInfo(raster='reclass', reference=info)
+        info = "min=1\nmax=2\ndatatype=CELL"
+        self.assertRasterFitsInfo(raster="reclass", reference=info)
 
 
     def test_rules2(self):
     def test_rules2(self):
         """Testing Rules2"""
         """Testing Rules2"""
-        reclass = SimpleModule('r.reclass', input=self.input, output=self.output,
-                              rules='-')
+        reclass = SimpleModule(
+            "r.reclass", input=self.input, output=self.output, rules="-"
+        )
         reclass.inputs.stdin = rules2
         reclass.inputs.stdin = rules2
         self.assertModule(reclass)
         self.assertModule(reclass)
-        info = 'min=1\nmax=2\ndatatype=CELL'
-        self.assertRasterFitsInfo(raster='reclass', reference=info)
+        info = "min=1\nmax=2\ndatatype=CELL"
+        self.assertRasterFitsInfo(raster="reclass", reference=info)
 
 
     def test_rules3(self):
     def test_rules3(self):
         """Testing rules3"""
         """Testing rules3"""
-        reclass = SimpleModule('r.reclass', input=self.input, output=self.output,
-                              rules='-')
+        reclass = SimpleModule(
+            "r.reclass", input=self.input, output=self.output, rules="-"
+        )
         reclass.inputs.stdin = rules3
         reclass.inputs.stdin = rules3
         self.assertModule(reclass)
         self.assertModule(reclass)
-        info = 'min=1\nmax=3\ndatatype=CELL'
-        self.assertRasterFitsInfo(raster='reclass', reference=info)
+        info = "min=1\nmax=3\ndatatype=CELL"
+        self.assertRasterFitsInfo(raster="reclass", reference=info)
 
 
     def test_rules4(self):
     def test_rules4(self):
         """Testing rules with external file"""
         """Testing rules with external file"""
-        reclass = SimpleModule('r.reclass', input=self.input, output=self.output,
-                              rules='data/rules.txt')
+        reclass = SimpleModule(
+            "r.reclass", input=self.input, output=self.output, rules="data/rules.txt"
+        )
         self.assertModule(reclass)
         self.assertModule(reclass)
-        info = 'min=1\nmax=3\ndatatype=CELL'
-        self.assertRasterFitsInfo(raster='reclass', reference=info)
+        info = "min=1\nmax=3\ndatatype=CELL"
+        self.assertRasterFitsInfo(raster="reclass", reference=info)
+
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 46 - 29
raster/r.recode/testsuite/test_rrecode_ncspm.py

@@ -37,61 +37,78 @@ rules4 = """
 
 
 
 
 class TestNCMaps(TestCase):
 class TestNCMaps(TestCase):
-
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster='elevation@PERMANENT')
-        cls.runModule('r.mapcalc', expression="random01 = rand(0, 1.)", seed=1, overwrite=True)
+        cls.runModule("g.region", raster="elevation@PERMANENT")
+        cls.runModule(
+            "r.mapcalc", expression="random01 = rand(0, 1.)", seed=1, overwrite=True
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', type='raster', name=['random01', 'recoded'], flags='f')
+        cls.runModule(
+            "g.remove", type="raster", name=["random01", "recoded"], flags="f"
+        )
 
 
     def test_formats_elevation(self):
     def test_formats_elevation(self):
-        recode = SimpleModule('r.recode', input='elevation@PERMANENT', output='recoded',
-                              rules='-', overwrite=True)
+        recode = SimpleModule(
+            "r.recode",
+            input="elevation@PERMANENT",
+            output="recoded",
+            rules="-",
+            overwrite=True,
+        )
         recode.inputs.stdin = rules1
         recode.inputs.stdin = rules1
         self.assertModule(recode)
         self.assertModule(recode)
-        info = 'min=1\nmax=11\ndatatype=CELL'
-        self.assertRasterFitsInfo(raster='recoded', reference=info)
+        info = "min=1\nmax=11\ndatatype=CELL"
+        self.assertRasterFitsInfo(raster="recoded", reference=info)
 
 
-        recode.flags['d'].value = True
+        recode.flags["d"].value = True
         self.assertModule(recode)
         self.assertModule(recode)
-        info = 'min=1\nmax=11\ndatatype=DCELL'
-        self.assertRasterFitsInfo(raster='recoded', reference=info)
-        recode.flags['d'].value = False
+        info = "min=1\nmax=11\ndatatype=DCELL"
+        self.assertRasterFitsInfo(raster="recoded", reference=info)
+        recode.flags["d"].value = False
 
 
         recode.inputs.stdin = rules2
         recode.inputs.stdin = rules2
         self.assertModule(recode)
         self.assertModule(recode)
-        info = 'min=-0.5\nmax=0.5\ndatatype=FCELL'
-        self.assertRasterFitsInfo(raster='recoded', reference=info, precision=1e-3)
+        info = "min=-0.5\nmax=0.5\ndatatype=FCELL"
+        self.assertRasterFitsInfo(raster="recoded", reference=info, precision=1e-3)
 
 
-        recode.flags['d'].value = True
+        recode.flags["d"].value = True
         self.assertModule(recode)
         self.assertModule(recode)
-        info = 'min=-0.5\nmax=0.5\ndatatype=DCELL'
-        self.assertRasterFitsInfo(raster='recoded', reference=info, precision=1e-3)
-        recode.flags['d'].value = False
+        info = "min=-0.5\nmax=0.5\ndatatype=DCELL"
+        self.assertRasterFitsInfo(raster="recoded", reference=info, precision=1e-3)
+        recode.flags["d"].value = False
 
 
     def test_formats_random(self):
     def test_formats_random(self):
-        recode = SimpleModule('r.recode', input='random01', output='recoded',
-                              rules='-', overwrite=True)
+        recode = SimpleModule(
+            "r.recode", input="random01", output="recoded", rules="-", overwrite=True
+        )
         recode.inputs.stdin = rules3
         recode.inputs.stdin = rules3
         self.assertModule(recode)
         self.assertModule(recode)
-        category = read_command('r.category', map='recoded')
-        n_cats = len(category.strip().split('\n'))
+        category = read_command("r.category", map="recoded")
+        n_cats = len(category.strip().split("\n"))
         if n_cats <= 2:
         if n_cats <= 2:
-            self.fail(msg="Number of categories is <= 2 "
-                          "which suggests input map values were read as integers.")
+            self.fail(
+                msg="Number of categories is <= 2 "
+                "which suggests input map values were read as integers."
+            )
 
 
     def test_formats_landcover(self):
     def test_formats_landcover(self):
-        recode = SimpleModule('r.recode', input='landuse@PERMANENT',
-                              output='recoded', rules='-', overwrite=True)
+        recode = SimpleModule(
+            "r.recode",
+            input="landuse@PERMANENT",
+            output="recoded",
+            rules="-",
+            overwrite=True,
+        )
         recode.inputs.stdin = rules4
         recode.inputs.stdin = rules4
         self.assertModule(recode)
         self.assertModule(recode)
-        info = 'min=1\nmax=3\ndatatype=CELL'
-        self.assertRasterFitsInfo(raster='recoded', reference=info)
+        info = "min=1\nmax=3\ndatatype=CELL"
+        self.assertRasterFitsInfo(raster="recoded", reference=info)
+
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 12 - 21
raster/r.report/testsuite/test_r_report.py

@@ -14,61 +14,52 @@ from grass.gunittest.case import TestCase
 
 
 
 
 class TestRasterreport(TestCase):
 class TestRasterreport(TestCase):
-    outfile = 'test_out.csv'
-
+    outfile = "test_out.csv"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster='elevation')
-
+        cls.runModule("g.region", raster="elevation")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        """!Remove the temporary region
-        """
+        """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
         if os.path.isfile(cls.outfile):
         if os.path.isfile(cls.outfile):
             os.remove(cls.outfile)
             os.remove(cls.outfile)
 
 
-
     def test_flage(self):
     def test_flage(self):
         """Testing flag 'e' with map elevation"""
         """Testing flag 'e' with map elevation"""
-        self.assertModule('r.report', map='elevation', flags='e')
-
+        self.assertModule("r.report", map="elevation", flags="e")
 
 
     def test_flagc(self):
     def test_flagc(self):
         """Testing flag 'c' with map elevation"""
         """Testing flag 'c' with map elevation"""
-        self.assertModule('r.report', map='elevation', flags='c')
-
+        self.assertModule("r.report", map="elevation", flags="c")
 
 
     def test_flagf(self):
     def test_flagf(self):
         """Testing flag 'f' with map lakes"""
         """Testing flag 'f' with map lakes"""
-        self.assertModule('r.report', map='lakes', flags='f')
-
+        self.assertModule("r.report", map="lakes", flags="f")
 
 
     def test_flagh(self):
     def test_flagh(self):
         """Testing flag 'h' with map lakes"""
         """Testing flag 'h' with map lakes"""
-        self.assertModule('r.report', map='lakes', flags='h')
-
+        self.assertModule("r.report", map="lakes", flags="h")
 
 
     def test_flagn(self):
     def test_flagn(self):
         """Testing flag 'n' with map elevation"""
         """Testing flag 'n' with map elevation"""
-        self.assertModule('r.report', map='elevation', flags='n')
-
+        self.assertModule("r.report", map="elevation", flags="n")
 
 
     def test_flaga(self):
     def test_flaga(self):
         """Testing flag 'a' with map lakes"""
         """Testing flag 'a' with map lakes"""
-        self.assertModule('r.report', map='lakes', flags='a')
-
+        self.assertModule("r.report", map="lakes", flags="a")
 
 
     def test_output(self):
     def test_output(self):
         """Checking file existence"""
         """Checking file existence"""
-        self.assertModule('r.report', map='lakes', output=self.outfile)
+        self.assertModule("r.report", map="lakes", output=self.outfile)
         self.assertFileExists(self.outfile)
         self.assertFileExists(self.outfile)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 73 - 28
raster/r.series.interp/testsuite/interp_test.py

@@ -3,8 +3,8 @@
 """
 """
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 
 
-class InterpolationTest(TestCase):
 
 
+class InterpolationTest(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
@@ -14,13 +14,11 @@ class InterpolationTest(TestCase):
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        """!Remove the temporary region
-        """
+        """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def setUp(self):
     def setUp(self):
-        """Generate interpolation data
-        """
+        """Generate interpolation data"""
         self.runModule("r.mapcalc", expression="prec_1 = 100")
         self.runModule("r.mapcalc", expression="prec_1 = 100")
         self.runModule("r.mapcalc", expression="prec_5 = 500")
         self.runModule("r.mapcalc", expression="prec_5 = 500")
         self.runModule("r.mapcalc", expression="map_10 = 10")
         self.runModule("r.mapcalc", expression="map_10 = 10")
@@ -29,24 +27,39 @@ class InterpolationTest(TestCase):
         self.runModule("r.mapcalc", expression="map_40 = 40")
         self.runModule("r.mapcalc", expression="map_40 = 40")
 
 
     def test_commandline(self):
     def test_commandline(self):
-        self.assertModule("r.series.interp", input="prec_1,prec_5", datapos=(0.0,1.0),
-            output="prec_2,prec_3,prec_4", samplingpos=(0.25,0.5,0.75), method="linear")
+        self.assertModule(
+            "r.series.interp",
+            input="prec_1,prec_5",
+            datapos=(0.0, 1.0),
+            output="prec_2,prec_3,prec_4",
+            samplingpos=(0.25, 0.5, 0.75),
+            method="linear",
+        )
 
 
         self.assertRasterMinMax(map="prec_2", refmin=200, refmax=200)
         self.assertRasterMinMax(map="prec_2", refmin=200, refmax=200)
         self.assertRasterMinMax(map="prec_3", refmin=300, refmax=300)
         self.assertRasterMinMax(map="prec_3", refmin=300, refmax=300)
         self.assertRasterMinMax(map="prec_4", refmin=400, refmax=400)
         self.assertRasterMinMax(map="prec_4", refmin=400, refmax=400)
 
 
     def test_infile(self):
     def test_infile(self):
-        self.assertModule("r.series.interp", input="prec_1,prec_5", datapos=(0.0,1.0),
-            outfile="data/outfile_1.txt", method="linear")
+        self.assertModule(
+            "r.series.interp",
+            input="prec_1,prec_5",
+            datapos=(0.0, 1.0),
+            outfile="data/outfile_1.txt",
+            method="linear",
+        )
 
 
         self.assertRasterMinMax(map="prec_2", refmin=200, refmax=200)
         self.assertRasterMinMax(map="prec_2", refmin=200, refmax=200)
         self.assertRasterMinMax(map="prec_3", refmin=300, refmax=300)
         self.assertRasterMinMax(map="prec_3", refmin=300, refmax=300)
         self.assertRasterMinMax(map="prec_4", refmin=400, refmax=400)
         self.assertRasterMinMax(map="prec_4", refmin=400, refmax=400)
 
 
     def test_inoutfiles(self):
     def test_inoutfiles(self):
-        self.assertModule("r.series.interp", infile="data/infile_2.txt",
-            outfile="data/outfile_2.txt", method="linear")
+        self.assertModule(
+            "r.series.interp",
+            infile="data/infile_2.txt",
+            outfile="data/outfile_2.txt",
+            method="linear",
+        )
 
 
         self.assertRasterMinMax(map="map_12", refmin=12, refmax=12)
         self.assertRasterMinMax(map="map_12", refmin=12, refmax=12)
         self.assertRasterMinMax(map="map_14", refmin=14, refmax=14)
         self.assertRasterMinMax(map="map_14", refmin=14, refmax=14)
@@ -55,31 +68,63 @@ class InterpolationTest(TestCase):
         self.assertRasterMinMax(map="map_25", refmin=25, refmax=25)
         self.assertRasterMinMax(map="map_25", refmin=25, refmax=25)
         self.assertRasterMinMax(map="map_35", refmin=35, refmax=35)
         self.assertRasterMinMax(map="map_35", refmin=35, refmax=35)
 
 
-
     def test_module_failure(self):
     def test_module_failure(self):
-        """ We need tests to check the failure handling, as outputs, file and
-             sampling points  are not handled by the grass parser"""
+        """We need tests to check the failure handling, as outputs, file and
+        sampling points  are not handled by the grass parser"""
 
 
         # No outputs
         # No outputs
-        self.assertModuleFail("r.series.interp", input="prec_1,prec_5", datapos=(0.0,1.0),
-             samplingpos=(0.25,0.5,0.75), method="linear")
+        self.assertModuleFail(
+            "r.series.interp",
+            input="prec_1,prec_5",
+            datapos=(0.0, 1.0),
+            samplingpos=(0.25, 0.5, 0.75),
+            method="linear",
+        )
         # No sampling points
         # No sampling points
-        self.assertModuleFail("r.series.interp", input="prec_1,prec_5",
-            datapos=(0.0,1.0), output="prec_2,prec_3,prec_4")
+        self.assertModuleFail(
+            "r.series.interp",
+            input="prec_1,prec_5",
+            datapos=(0.0, 1.0),
+            output="prec_2,prec_3,prec_4",
+        )
         # Output and file at once
         # Output and file at once
-        self.assertModuleFail("r.series.interp", input="prec_1,prec_5", datapos=(0.0,1.0),
-            outfile="outfile_1.txt", output="prec_2,prec_3,prec_4", samplingpos=(0.25,0.5,0.75),
-            method="linear")
+        self.assertModuleFail(
+            "r.series.interp",
+            input="prec_1,prec_5",
+            datapos=(0.0, 1.0),
+            outfile="outfile_1.txt",
+            output="prec_2,prec_3,prec_4",
+            samplingpos=(0.25, 0.5, 0.75),
+            method="linear",
+        )
         # Sampling points and file at once
         # Sampling points and file at once
-        self.assertModuleFail("r.series.interp", input="prec_1,prec_5", datapos=(0.0,1.0),
-            outfile="outfile_1.txt", samplingpos=(0.25,0.5,0.75), method="linear")
+        self.assertModuleFail(
+            "r.series.interp",
+            input="prec_1,prec_5",
+            datapos=(0.0, 1.0),
+            outfile="outfile_1.txt",
+            samplingpos=(0.25, 0.5, 0.75),
+            method="linear",
+        )
         # Wrong input file
         # Wrong input file
-        self.assertModuleFail("r.series.interp", input="prec_1,prec_5", datapos=(0.0,1.0),
-            outfile="mo_such_file", method="linear")
+        self.assertModuleFail(
+            "r.series.interp",
+            input="prec_1,prec_5",
+            datapos=(0.0, 1.0),
+            outfile="mo_such_file",
+            method="linear",
+        )
         # Wrong input file
         # Wrong input file
-        self.assertModuleFail("r.series.interp", input="prec_1,prec_5", datapos=(0.0,1.0),
-            outfile="outfile_corrupt.txt", method="linear")
+        self.assertModuleFail(
+            "r.series.interp",
+            input="prec_1,prec_5",
+            datapos=(0.0, 1.0),
+            outfile="outfile_corrupt.txt",
+            method="linear",
+        )
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 150 - 80
raster/r.slope.aspect/testsuite/test_r_slope_aspect.py

@@ -17,36 +17,63 @@ cols:    5
 100.0 150.0 150.0 100.0 100.0
 100.0 150.0 150.0 100.0 100.0
 """
 """
 
 
+
 class TestSlopeAspect(TestCase):
 class TestSlopeAspect(TestCase):
 
 
-    slope = 'limits_slope'
-    aspect = 'limits_aspect'
+    slope = "limits_slope"
+    aspect = "limits_aspect"
 
 
     def setUp(self):
     def setUp(self):
         self.use_temp_region()
         self.use_temp_region()
-        call_module('g.region', raster='elevation')
+        call_module("g.region", raster="elevation")
 
 
     def tearDown(self):
     def tearDown(self):
         self.del_temp_region()
         self.del_temp_region()
-        call_module('g.remove', flags='f', type_='raster',
-                    name=[self.slope, self.aspect])
+        call_module(
+            "g.remove", flags="f", type_="raster", name=[self.slope, self.aspect]
+        )
 
 
     def test_limits(self):
     def test_limits(self):
-        self.assertModule('r.slope.aspect', elevation='elevation',
-                          slope=self.slope, aspect=self.aspect)
-        self.assertRasterMinMax(map=self.slope, refmin=0, refmax=90,
-                                msg="Slope in degrees must be between 0 and 90")
-        self.assertRasterMinMax(map=self.aspect, refmin=0, refmax=360,
-                                msg="Aspect in degrees must be between 0 and 360")
+        self.assertModule(
+            "r.slope.aspect",
+            elevation="elevation",
+            slope=self.slope,
+            aspect=self.aspect,
+        )
+        self.assertRasterMinMax(
+            map=self.slope,
+            refmin=0,
+            refmax=90,
+            msg="Slope in degrees must be between 0 and 90",
+        )
+        self.assertRasterMinMax(
+            map=self.aspect,
+            refmin=0,
+            refmax=360,
+            msg="Aspect in degrees must be between 0 and 360",
+        )
 
 
     def test_limits_precent(self):
     def test_limits_precent(self):
         """Assumes NC elevation and allows slope up to 100% (45deg)"""
         """Assumes NC elevation and allows slope up to 100% (45deg)"""
-        self.assertModule('r.slope.aspect', elevation='elevation',
-                          slope=self.slope, aspect=self.aspect, format='percent')
-        self.assertRasterMinMax(map=self.slope, refmin=0, refmax=100,
-                                msg="Slope in percent must be between 0 and 100")
-        self.assertRasterMinMax(map=self.aspect, refmin=0, refmax=360,
-                                msg="Aspect in degrees must be between 0 and 360")
+        self.assertModule(
+            "r.slope.aspect",
+            elevation="elevation",
+            slope=self.slope,
+            aspect=self.aspect,
+            format="percent",
+        )
+        self.assertRasterMinMax(
+            map=self.slope,
+            refmin=0,
+            refmax=100,
+            msg="Slope in percent must be between 0 and 100",
+        )
+        self.assertRasterMinMax(
+            map=self.aspect,
+            refmin=0,
+            refmax=360,
+            msg="Aspect in degrees must be between 0 and 360",
+        )
 
 
 
 
 class TestSlopeAspectAgainstReference(TestCase):
 class TestSlopeAspectAgainstReference(TestCase):
@@ -66,113 +93,156 @@ class TestSlopeAspectAgainstReference(TestCase):
 
 
     # precision for comparisons
     # precision for comparisons
     precision = 0.0001
     precision = 0.0001
-    ref_aspect = 'reference_aspect'
-    aspect = 'fractal_aspect'
-    ref_slope = 'reference_slope'
-    slope = 'fractal_slope'
+    ref_aspect = "reference_aspect"
+    aspect = "fractal_aspect"
+    ref_slope = "reference_slope"
+    slope = "fractal_slope"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        call_module('g.region', n=20, s=10, e=25, w=15, res=1)
-        cls.elevation = 'fractal_surf'
-        cls.runModule('r.in.ascii', input='data/fractal_surf.ascii',
-                      output=cls.elevation)
+        call_module("g.region", n=20, s=10, e=25, w=15, res=1)
+        cls.elevation = "fractal_surf"
+        cls.runModule(
+            "r.in.ascii", input="data/fractal_surf.ascii", output=cls.elevation
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', flags='f', type='raster',
-                      name=[cls.elevation, cls.slope, cls.aspect, cls.ref_aspect, cls.ref_slope])
+        cls.runModule(
+            "g.remove",
+            flags="f",
+            type="raster",
+            name=[cls.elevation, cls.slope, cls.aspect, cls.ref_aspect, cls.ref_slope],
+        )
 
 
     def test_slope(self):
     def test_slope(self):
         # TODO: using gdal instead of ascii because of cannot seek error
         # TODO: using gdal instead of ascii because of cannot seek error
-        self.runModule('r.in.gdal', flags='o',
-                       input='data/gdal_slope.grd', output=self.ref_slope)
-        self.assertModule('r.slope.aspect', elevation=self.elevation,
-                          slope=self.slope)
+        self.runModule(
+            "r.in.gdal", flags="o", input="data/gdal_slope.grd", output=self.ref_slope
+        )
+        self.assertModule("r.slope.aspect", elevation=self.elevation, slope=self.slope)
         # check we have expected values
         # check we have expected values
-        self.assertRasterMinMax(map=self.slope, refmin=0, refmax=90,
-                                msg="Slope in degrees must be between 0 and 90")
+        self.assertRasterMinMax(
+            map=self.slope,
+            refmin=0,
+            refmax=90,
+            msg="Slope in degrees must be between 0 and 90",
+        )
         # check against reference data
         # check against reference data
-        self.assertRastersNoDifference(actual=self.slope, reference=self.ref_slope,
-                                       precision=self.precision)
+        self.assertRastersNoDifference(
+            actual=self.slope, reference=self.ref_slope, precision=self.precision
+        )
 
 
     def test_aspect(self):
     def test_aspect(self):
         # TODO: using gdal instead of ascii because of cannot seek error
         # TODO: using gdal instead of ascii because of cannot seek error
-        self.runModule('r.in.gdal', flags='o',
-                       input='data/gdal_aspect.grd', output=self.ref_aspect)
-        self.assertModule('r.slope.aspect', elevation=self.elevation,
-                          aspect=self.aspect)
+        self.runModule(
+            "r.in.gdal", flags="o", input="data/gdal_aspect.grd", output=self.ref_aspect
+        )
+        self.assertModule(
+            "r.slope.aspect", elevation=self.elevation, aspect=self.aspect
+        )
         # check we have expected values
         # check we have expected values
-        self.assertRasterMinMax(map=self.aspect, refmin=0, refmax=360,
-                                msg="Aspect in degrees must be between 0 and 360")
+        self.assertRasterMinMax(
+            map=self.aspect,
+            refmin=0,
+            refmax=360,
+            msg="Aspect in degrees must be between 0 and 360",
+        )
         # check against reference data
         # check against reference data
-        self.assertRastersNoDifference(actual=self.aspect, reference=self.ref_aspect,
-                                       precision=self.precision)
+        self.assertRastersNoDifference(
+            actual=self.aspect, reference=self.ref_aspect, precision=self.precision
+        )
 
 
 
 
 class TestSlopeAspectAgainstItself(TestCase):
 class TestSlopeAspectAgainstItself(TestCase):
 
 
     precision = 0.0000001
     precision = 0.0000001
-    elevation = 'elevation'
-    t_aspect = 'sa_together_aspect'
-    t_slope = 'sa_together_slope'
-    s_aspect = 'sa_separately_aspect'
-    s_slope = 'sa_separately_slope'
+    elevation = "elevation"
+    t_aspect = "sa_together_aspect"
+    t_slope = "sa_together_slope"
+    s_aspect = "sa_separately_aspect"
+    s_slope = "sa_separately_slope"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        call_module('g.region', raster='elevation')
+        call_module("g.region", raster="elevation")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        call_module('g.remove', flags='f', type_='raster',
-                    name=[cls.t_aspect, cls.t_slope, cls.s_slope, cls.s_aspect])
+        call_module(
+            "g.remove",
+            flags="f",
+            type_="raster",
+            name=[cls.t_aspect, cls.t_slope, cls.s_slope, cls.s_aspect],
+        )
 
 
     def test_slope_aspect_together(self):
     def test_slope_aspect_together(self):
-        """Slope and aspect computed separately and together should be the same
-        """
-        self.assertModule('r.slope.aspect', elevation=self.elevation,
-                          aspect=self.s_aspect)
-        self.assertModule('r.slope.aspect', elevation=self.elevation,
-                          slope=self.s_slope)
-        self.assertModule('r.slope.aspect', elevation=self.elevation,
-                          slope=self.t_slope, aspect=self.t_aspect)
-        self.assertRastersNoDifference(actual=self.t_aspect, reference=self.s_aspect,
-                                       precision=self.precision)
-        self.assertRastersNoDifference(actual=self.t_slope, reference=self.s_slope,
-                                       precision=self.precision)
+        """Slope and aspect computed separately and together should be the same"""
+        self.assertModule(
+            "r.slope.aspect", elevation=self.elevation, aspect=self.s_aspect
+        )
+        self.assertModule(
+            "r.slope.aspect", elevation=self.elevation, slope=self.s_slope
+        )
+        self.assertModule(
+            "r.slope.aspect",
+            elevation=self.elevation,
+            slope=self.t_slope,
+            aspect=self.t_aspect,
+        )
+        self.assertRastersNoDifference(
+            actual=self.t_aspect, reference=self.s_aspect, precision=self.precision
+        )
+        self.assertRastersNoDifference(
+            actual=self.t_slope, reference=self.s_slope, precision=self.precision
+        )
 
 
 
 
 # TODO: implement this class
 # TODO: implement this class
 class TestExtremes(TestCase):
 class TestExtremes(TestCase):
 
 
-    slope = 'small_slope'
-    aspect = 'small_aspect'
-    elevation = 'small_elevation'
+    slope = "small_slope"
+    aspect = "small_aspect"
+    elevation = "small_elevation"
 
 
     def setUp(self):
     def setUp(self):
         self.use_temp_region()
         self.use_temp_region()
 
 
     def tearDown(self):
     def tearDown(self):
         self.del_temp_region()
         self.del_temp_region()
-        call_module('g.remove', flags='f', type_='raster',
-                    name=[self.slope, self.aspect, self.elevation])
+        call_module(
+            "g.remove",
+            flags="f",
+            type_="raster",
+            name=[self.slope, self.aspect, self.elevation],
+        )
 
 
     def test_small(self):
     def test_small(self):
-        self.runModule('r.in.ascii', input='-', output=self.elevation,
-                       stdin_=SMALL_MAP)
-        call_module('g.region', raster=self.elevation)
-        self.assertModule('r.slope.aspect', elevation=self.elevation,
-                          slope=self.slope, aspect=self.aspect)
-        self.assertRasterMinMax(map=self.slope, refmin=0, refmax=90,
-                                msg="Slope in degrees must be between 0 and 90")
-        self.assertRasterMinMax(map=self.aspect, refmin=0, refmax=360,
-                                msg="Aspect in degrees must be between 0 and 360")
-
-
-if __name__ == '__main__':
+        self.runModule("r.in.ascii", input="-", output=self.elevation, stdin_=SMALL_MAP)
+        call_module("g.region", raster=self.elevation)
+        self.assertModule(
+            "r.slope.aspect",
+            elevation=self.elevation,
+            slope=self.slope,
+            aspect=self.aspect,
+        )
+        self.assertRasterMinMax(
+            map=self.slope,
+            refmin=0,
+            refmax=90,
+            msg="Slope in degrees must be between 0 and 90",
+        )
+        self.assertRasterMinMax(
+            map=self.aspect,
+            refmin=0,
+            refmax=360,
+            msg="Aspect in degrees must be between 0 and 360",
+        )
+
+
+if __name__ == "__main__":
     test()
     test()

+ 64 - 12
raster/r.solute.transport/example.py

@@ -15,7 +15,10 @@ gs.run_command("g.region", res=1, res3=1, t=10, b=0, n=100, s=0, w=0, e=200)
 gs.run_command("r.mapcalc", expression="phead=if(col() == 1 , 50, 40)")
 gs.run_command("r.mapcalc", expression="phead=if(col() == 1 , 50, 40)")
 gs.run_command("r.mapcalc", expression="phead=if(col() ==200  , 45 + row()/40, phead)")
 gs.run_command("r.mapcalc", expression="phead=if(col() ==200  , 45 + row()/40, phead)")
 gs.run_command("r.mapcalc", expression="status=if(col() == 1 || col() == 200 , 2, 1)")
 gs.run_command("r.mapcalc", expression="status=if(col() == 1 || col() == 200 , 2, 1)")
-gs.run_command("r.mapcalc", expression="well=if((row() == 50 && col() == 175) || (row() == 10 && col() == 135) , -0.001, 0)")
+gs.run_command(
+    "r.mapcalc",
+    expression="well=if((row() == 50 && col() == 175) || (row() == 10 && col() == 135) , -0.001, 0)",
+)
 gs.run_command("r.mapcalc", expression="hydcond=0.00005")
 gs.run_command("r.mapcalc", expression="hydcond=0.00005")
 gs.run_command("r.mapcalc", expression="recharge=0")
 gs.run_command("r.mapcalc", expression="recharge=0")
 gs.run_command("r.mapcalc", expression="top_conf=20")
 gs.run_command("r.mapcalc", expression="top_conf=20")
@@ -26,9 +29,22 @@ gs.run_command("r.mapcalc", expression="null=0.0")
 #
 #
 gs.message(_("Compute a steady state groundwater flow"))
 gs.message(_("Compute a steady state groundwater flow"))
 
 
-gs.run_command("r.gwflow", solver="cg", top="top_conf", bottom="bottom", phead="phead",
-  status="status", hc_x="hydcond", hc_y="hydcond", q="well", s="syield",
-  recharge="recharge", output="gwresult_conf", dt=8640000000000, type="confined")
+gs.run_command(
+    "r.gwflow",
+    solver="cg",
+    top="top_conf",
+    bottom="bottom",
+    phead="phead",
+    status="status",
+    hc_x="hydcond",
+    hc_y="hydcond",
+    q="well",
+    s="syield",
+    recharge="recharge",
+    output="gwresult_conf",
+    dt=8640000000000,
+    type="confined",
+)
 
 
 gs.message(_("generate the transport data"))
 gs.message(_("generate the transport data"))
 gs.run_command("r.mapcalc", expression="c=if(col() == 15 && row() == 75 , 500.0, 0.0)")
 gs.run_command("r.mapcalc", expression="c=if(col() == 15 && row() == 75 , 500.0, 0.0)")
@@ -38,14 +54,50 @@ gs.run_command("r.mapcalc", expression="diff=0.0000001")
 gs.run_command("r.mapcalc", expression="R=1.0")
 gs.run_command("r.mapcalc", expression="R=1.0")
 
 
 # Compute the initial state
 # Compute the initial state
-gs.run_command("r.solute.transport", solver="bicgstab", top="top_conf",
-  bottom="bottom", phead="gwresult_conf", status="tstatus", hc_x="hydcond", hc_y="hydcond",
-  rd="R", cs="cs", q="well", nf="poros", output="stresult_conf_0", dt=3600, diff_x="diff",
-  diff_y="diff", c="c", al=0.1, at=0.01)
+gs.run_command(
+    "r.solute.transport",
+    solver="bicgstab",
+    top="top_conf",
+    bottom="bottom",
+    phead="gwresult_conf",
+    status="tstatus",
+    hc_x="hydcond",
+    hc_y="hydcond",
+    rd="R",
+    cs="cs",
+    q="well",
+    nf="poros",
+    output="stresult_conf_0",
+    dt=3600,
+    diff_x="diff",
+    diff_y="diff",
+    c="c",
+    al=0.1,
+    at=0.01,
+)
 
 
 # Compute the solute transport for 300 days in 10 day steps
 # Compute the solute transport for 300 days in 10 day steps
 for dt in range(30):
 for dt in range(30):
-    gs.run_command("r.solute.transport", solver="bicgstab", top="top_conf",
-    bottom="bottom", phead="gwresult_conf", status="tstatus", hc_x="hydcond", hc_y="hydcond",
-    rd="R", cs="cs", q="well", nf="poros", output="stresult_conf_" + str(dt + 1), dt=864000, diff_x="diff",
-    diff_y="diff", c="stresult_conf_" + str(dt), al=0.1, at=0.01, vx="vx", vy="vy")
+    gs.run_command(
+        "r.solute.transport",
+        solver="bicgstab",
+        top="top_conf",
+        bottom="bottom",
+        phead="gwresult_conf",
+        status="tstatus",
+        hc_x="hydcond",
+        hc_y="hydcond",
+        rd="R",
+        cs="cs",
+        q="well",
+        nf="poros",
+        output="stresult_conf_" + str(dt + 1),
+        dt=864000,
+        diff_x="diff",
+        diff_y="diff",
+        c="stresult_conf_" + str(dt),
+        al=0.1,
+        at=0.01,
+        vx="vx",
+        vy="vy",
+    )

+ 119 - 31
raster/r.solute.transport/seguin_verify.py

@@ -1,12 +1,12 @@
 #!/usr/bin/env python3
 #!/usr/bin/env python3
 # Shellscript to verify r.solute.transport calculation, this calculation is based on
 # Shellscript to verify r.solute.transport calculation, this calculation is based on
 # the example 1.1 and 1.2 at page 175 of the following book:
 # the example 1.1 and 1.2 at page 175 of the following book:
-#	title = "Str{\"o}mungs und Transportmodellierung",
-#	author = "Lege, T. and Kolditz, O. and Zielke W.",
-#	publisher = "Springer (Berlin; Heidelberg; New York; Barcelona; Hongkong; London; Mailand; Paris; Singapur; Tokio)",
-#	edition = "2. Auflage",
-#	year = "1996",
-#	series = "Handbuch zur Erkundung des Untergrundes von Deponien und Altlasten"
+# 	title = "Str{\"o}mungs und Transportmodellierung",
+# 	author = "Lege, T. and Kolditz, O. and Zielke W.",
+# 	publisher = "Springer (Berlin; Heidelberg; New York; Barcelona; Hongkong; London; Mailand; Paris; Singapur; Tokio)",
+# 	edition = "2. Auflage",
+# 	year = "1996",
+# 	series = "Handbuch zur Erkundung des Untergrundes von Deponien und Altlasten"
 #
 #
 
 
 import grass.script as grass
 import grass.script as grass
@@ -25,7 +25,9 @@ grass.message(_("Create all the input maps needed for groundwater flow computati
 # over a distance of 2000m
 # over a distance of 2000m
 grass.run_command("r.mapcalc", expression="phead_1=if(col() == 1 , 275, 50)")
 grass.run_command("r.mapcalc", expression="phead_1=if(col() == 1 , 275, 50)")
 # Set the active cells and the dirichlet boundary condition, the first and the last cells a dirichlet
 # Set the active cells and the dirichlet boundary condition, the first and the last cells a dirichlet
-grass.run_command("r.mapcalc", expression="status_1=if(col() == 1 || col() == 40 , 2, 1)")
+grass.run_command(
+    "r.mapcalc", expression="status_1=if(col() == 1 || col() == 40 , 2, 1)"
+)
 # We have a no wells
 # We have a no wells
 grass.run_command("r.mapcalc", expression="well_1=0")
 grass.run_command("r.mapcalc", expression="well_1=0")
 # The hydraulic conductivity is 0.0001 m/s
 # The hydraulic conductivity is 0.0001 m/s
@@ -42,46 +44,99 @@ grass.run_command("r.mapcalc", expression="poros_1=0.17")
 grass.run_command("r.mapcalc", expression="syield_1=0.0001")
 grass.run_command("r.mapcalc", expression="syield_1=0.0001")
 grass.run_command("r.mapcalc", expression="null_1=0.0")
 grass.run_command("r.mapcalc", expression="null_1=0.0")
 
 
-grass.message("First compute a steady state groundwater flow with a mean velocity of 5.88 m/d or 6.8*10^5m/s")
+grass.message(
+    "First compute a steady state groundwater flow with a mean velocity of 5.88 m/d or 6.8*10^5m/s"
+)
 
 
 # Compute the steady state groundwater flow
 # Compute the steady state groundwater flow
-grass.run_command("r.gwflow", solver="cg", top="top_conf_1", bottom="bottom_1", phead="phead_1",
- status="status_1", hc_x="hydcond_1", hc_y="hydcond_1",
- q="well_1", s="syield_1", recharge="recharge_1", output="gwresult_conf_1",
- dt=8640000000000, type="confined")
+grass.run_command(
+    "r.gwflow",
+    solver="cg",
+    top="top_conf_1",
+    bottom="bottom_1",
+    phead="phead_1",
+    status="status_1",
+    hc_x="hydcond_1",
+    hc_y="hydcond_1",
+    q="well_1",
+    s="syield_1",
+    recharge="recharge_1",
+    output="gwresult_conf_1",
+    dt=8640000000000,
+    type="confined",
+)
 
 
 
 
 grass.message(_("generate the transport data"))
 grass.message(_("generate the transport data"))
 
 
 # The initial concentration is zero
 # The initial concentration is zero
-grass.run_command("r.mapcalc", expression="c_1=if(col() == 10 && row() == 10 , 0.0, 0.0)")
+grass.run_command(
+    "r.mapcalc", expression="c_1=if(col() == 10 && row() == 10 , 0.0, 0.0)"
+)
 # One inner sources (result of chemical reaction)
 # One inner sources (result of chemical reaction)
-grass.run_command("r.mapcalc", expression="cs_1=if(col() == 10 && row() == 10 , 0.0013888, 0.0)")
+grass.run_command(
+    "r.mapcalc", expression="cs_1=if(col() == 10 && row() == 10 , 0.0013888, 0.0)"
+)
 # No pollution by well
 # No pollution by well
 grass.run_command("r.mapcalc", expression="cin_1=0.0")
 grass.run_command("r.mapcalc", expression="cin_1=0.0")
 # We have a transfer boundary condition
 # We have a transfer boundary condition
-grass.run_command("r.mapcalc", expression="tstatus_1=if(col() == 1 || col() == 40 , 3, 1)")
+grass.run_command(
+    "r.mapcalc", expression="tstatus_1=if(col() == 1 || col() == 40 , 3, 1)"
+)
 # No diffusion coefficient known for the solution
 # No diffusion coefficient known for the solution
 grass.run_command("r.mapcalc", expression="diff_1=0.0")
 grass.run_command("r.mapcalc", expression="diff_1=0.0")
 # Normal retardation
 # Normal retardation
 grass.run_command("r.mapcalc", expression="R_1=1.0")
 grass.run_command("r.mapcalc", expression="R_1=1.0")
 
 
 # Longitudinal and transversal dispersivity length al = 100m, at = 10m
 # Longitudinal and transversal dispersivity length al = 100m, at = 10m
-AL=100
-AT=10
+AL = 100
+AT = 10
 
 
 # Compute the solute transport using the above defined dispersivity coefficients for a timestep of 1000d
 # Compute the solute transport using the above defined dispersivity coefficients for a timestep of 1000d
-grass.run_command("r.solute.transport", "c", error=0.000000000000001, maxit=1000, solver="bicgstab",
-  top="top_conf_1", bottom="bottom_1", phead="gwresult_conf_1", status="tstatus_1", hc_x="hydcond_1",
-  hc_y="hydcond_1", rd="R_1", cs="cs_1", q="well_1", nf="poros_1", output="stresult_conf_1", dt=86400000,
-  diff_x="diff_1", diff_y="diff_1", cin="cin_1", c="c_1", al=AL, at=AT, vx="stresult_conf_vel_1_x", vy="stresult_conf_vel_1_y")
+grass.run_command(
+    "r.solute.transport",
+    "c",
+    error=0.000000000000001,
+    maxit=1000,
+    solver="bicgstab",
+    top="top_conf_1",
+    bottom="bottom_1",
+    phead="gwresult_conf_1",
+    status="tstatus_1",
+    hc_x="hydcond_1",
+    hc_y="hydcond_1",
+    rd="R_1",
+    cs="cs_1",
+    q="well_1",
+    nf="poros_1",
+    output="stresult_conf_1",
+    dt=86400000,
+    diff_x="diff_1",
+    diff_y="diff_1",
+    cin="cin_1",
+    c="c_1",
+    al=AL,
+    at=AT,
+    vx="stresult_conf_vel_1_x",
+    vy="stresult_conf_vel_1_y",
+)
 
 
 # Get the maximum concentration
 # Get the maximum concentration
 range = grass.parse_command("r.info", "r", map="stresult_conf_1")
 range = grass.parse_command("r.info", "r", map="stresult_conf_1")
 # Normalize the result
 # Normalize the result
-grass.run_command("r.mapcalc", expression="stresult_conf_1_norm = stresult_conf_1/" + str(range["max"]))
-#Create contour lines range from 0.7 to 0.1 in 0.1 steps
-grass.run_command("r.contour", input="stresult_conf_1_norm", output="stresult_conf_1_norm", minlevel=0.1, maxlevel=0.7, step=0.1)
+grass.run_command(
+    "r.mapcalc",
+    expression="stresult_conf_1_norm = stresult_conf_1/" + str(range["max"]),
+)
+# Create contour lines range from 0.7 to 0.1 in 0.1 steps
+grass.run_command(
+    "r.contour",
+    input="stresult_conf_1_norm",
+    output="stresult_conf_1_norm",
+    minlevel=0.1,
+    maxlevel=0.7,
+    step=0.1,
+)
 
 
 # The second computation uses different porosity for higher groundwater velocity
 # The second computation uses different porosity for higher groundwater velocity
 
 
@@ -89,14 +144,47 @@ grass.run_command("r.contour", input="stresult_conf_1_norm", output="stresult_co
 grass.run_command("r.mapcalc", expression="poros_2=1")
 grass.run_command("r.mapcalc", expression="poros_2=1")
 
 
 # Compute the solute transport using the above defined dispersivity coefficients for a timestep of 1000d
 # Compute the solute transport using the above defined dispersivity coefficients for a timestep of 1000d
-grass.run_command("r.solute.transport", "c", error=0.000000000000001, maxit=1000, solver="bicgstab",
-  top="top_conf_1", bottom="bottom_1", phead="gwresult_conf_1", status="tstatus_1", hc_x="hydcond_1",
-  hc_y="hydcond_1", rd="R_1", cs="cs_1", q="well_1", nf="poros_2", output="stresult_conf_2", dt=86400000,
-  diff_x="diff_1", diff_y="diff_1", cin="cin_1", c="c_1", al=AL, at=AT, vx="stresult_conf_vel_2_x", vy="stresult_conf_vel_2_y")
+grass.run_command(
+    "r.solute.transport",
+    "c",
+    error=0.000000000000001,
+    maxit=1000,
+    solver="bicgstab",
+    top="top_conf_1",
+    bottom="bottom_1",
+    phead="gwresult_conf_1",
+    status="tstatus_1",
+    hc_x="hydcond_1",
+    hc_y="hydcond_1",
+    rd="R_1",
+    cs="cs_1",
+    q="well_1",
+    nf="poros_2",
+    output="stresult_conf_2",
+    dt=86400000,
+    diff_x="diff_1",
+    diff_y="diff_1",
+    cin="cin_1",
+    c="c_1",
+    al=AL,
+    at=AT,
+    vx="stresult_conf_vel_2_x",
+    vy="stresult_conf_vel_2_y",
+)
 
 
 # Get the maximum concentration
 # Get the maximum concentration
 range = grass.parse_command("r.info", "r", map="stresult_conf_2")
 range = grass.parse_command("r.info", "r", map="stresult_conf_2")
 # Normalize the result
 # Normalize the result
-grass.run_command("r.mapcalc", expression="stresult_conf_2_norm = stresult_conf_2/" + str(range["max"]))
-#Create contour lines range from 0.7 to 0.1 in 0.1 steps
-grass.run_command("r.contour", input="stresult_conf_2_norm", output="stresult_conf_2_norm", minlevel=0.1, maxlevel=0.7, step=0.1)
+grass.run_command(
+    "r.mapcalc",
+    expression="stresult_conf_2_norm = stresult_conf_2/" + str(range["max"]),
+)
+# Create contour lines range from 0.7 to 0.1 in 0.1 steps
+grass.run_command(
+    "r.contour",
+    input="stresult_conf_2_norm",
+    output="stresult_conf_2_norm",
+    minlevel=0.1,
+    maxlevel=0.7,
+    step=0.1,
+)

+ 118 - 33
raster/r.solute.transport/seguin_verify_well.py

@@ -1,12 +1,12 @@
 #!/usr/bin/env python3
 #!/usr/bin/env python3
 # Shellscript to verify r.solute.transport calculation, this calculation is based on
 # Shellscript to verify r.solute.transport calculation, this calculation is based on
 # the example 2.1 and 2.2 at page 181 of the following book:
 # the example 2.1 and 2.2 at page 181 of the following book:
-#	title = "Str{\"o}mungs und Transportmodellierung",
-#	author = "Lege, T. and Kolditz, O. and Zielke W.",
-#	publisher = "Springer (Berlin; Heidelberg; New York; Barcelona; Hongkong; London; Mailand; Paris; Singapur; Tokio)",
-#	edition = "2. Auflage",
-#	year = "1996",
-#	series = "Handbuch zur Erkundung des Untergrundes von Deponien und Altlasten"
+# 	title = "Str{\"o}mungs und Transportmodellierung",
+# 	author = "Lege, T. and Kolditz, O. and Zielke W.",
+# 	publisher = "Springer (Berlin; Heidelberg; New York; Barcelona; Hongkong; London; Mailand; Paris; Singapur; Tokio)",
+# 	edition = "2. Auflage",
+# 	year = "1996",
+# 	series = "Handbuch zur Erkundung des Untergrundes von Deponien und Altlasten"
 #
 #
 
 
 import grass.script as grass
 import grass.script as grass
@@ -25,9 +25,13 @@ grass.message(_("Create all the input maps needed for groundwater flow computati
 # over a distance of 2000m
 # over a distance of 2000m
 grass.run_command("r.mapcalc", expression="phead_1=if(col() == 1 , 275, 50)")
 grass.run_command("r.mapcalc", expression="phead_1=if(col() == 1 , 275, 50)")
 # Set the active cells and the dirichlet boundary condition
 # Set the active cells and the dirichlet boundary condition
-grass.run_command("r.mapcalc", expression="status_1=if(col() == 1 || col() == 40 , 2, 1)")
+grass.run_command(
+    "r.mapcalc", expression="status_1=if(col() == 1 || col() == 40 , 2, 1)"
+)
 # We have a single well with a small influent pumping rate
 # We have a single well with a small influent pumping rate
-grass.run_command("r.mapcalc", expression="well_1=if((row() == 10 && col() == 10), 0.000002818287, 0)")
+grass.run_command(
+    "r.mapcalc", expression="well_1=if((row() == 10 && col() == 10), 0.000002818287, 0)"
+)
 # The hydraulic conductivity
 # The hydraulic conductivity
 grass.run_command("r.mapcalc", expression="hydcond_1=0.0001")
 grass.run_command("r.mapcalc", expression="hydcond_1=0.0001")
 # The recharge, well we have no recharge at all
 # The recharge, well we have no recharge at all
@@ -45,57 +49,138 @@ grass.run_command("r.mapcalc", expression="null_1=0.0")
 grass.message("First compute a steady state groundwater flow")
 grass.message("First compute a steady state groundwater flow")
 
 
 # Compute the steady state groundwater flow
 # Compute the steady state groundwater flow
-grass.run_command("r.gwflow", solver="cg", top="top_conf_1", bottom="bottom_1", phead="phead_1",
- status="status_1", hc_x="hydcond_1", hc_y="hydcond_1",
- q="well_1", s="syield_1", recharge="recharge_1", output="gwresult_conf_1",
- dt=8640000000000, type="confined")
+grass.run_command(
+    "r.gwflow",
+    solver="cg",
+    top="top_conf_1",
+    bottom="bottom_1",
+    phead="phead_1",
+    status="status_1",
+    hc_x="hydcond_1",
+    hc_y="hydcond_1",
+    q="well_1",
+    s="syield_1",
+    recharge="recharge_1",
+    output="gwresult_conf_1",
+    dt=8640000000000,
+    type="confined",
+)
 
 
 grass.message(_("generate the transport data"))
 grass.message(_("generate the transport data"))
 
 
 # The initial concentration is zero
 # The initial concentration is zero
-grass.run_command("r.mapcalc", expression="c_1=if(col() == 10 && row() == 10 , 0.0, 0.0)")
+grass.run_command(
+    "r.mapcalc", expression="c_1=if(col() == 10 && row() == 10 , 0.0, 0.0)"
+)
 # No inner sources or sinks (result of chemical reaction)
 # No inner sources or sinks (result of chemical reaction)
 grass.run_command("r.mapcalc", expression="cs_1=0.0")
 grass.run_command("r.mapcalc", expression="cs_1=0.0")
 # The pollution is inserted by a well
 # The pollution is inserted by a well
-grass.run_command("r.mapcalc", expression="cin_1=if(col() == 10 && row() == 10 ," + str(0.2/86400) + ", 0.0)")
+grass.run_command(
+    "r.mapcalc",
+    expression="cin_1=if(col() == 10 && row() == 10 ," + str(0.2 / 86400) + ", 0.0)",
+)
 # We have a transfer boundary condition
 # We have a transfer boundary condition
-grass.run_command("r.mapcalc", expression="tstatus_1=if(col() == 1 || col() == 40 , 3, 1)")
+grass.run_command(
+    "r.mapcalc", expression="tstatus_1=if(col() == 1 || col() == 40 , 3, 1)"
+)
 # No diffusion coefficient known for the solution
 # No diffusion coefficient known for the solution
 grass.run_command("r.mapcalc", expression="diff_1=0.0")
 grass.run_command("r.mapcalc", expression="diff_1=0.0")
 # Normal retardation
 # Normal retardation
 grass.run_command("r.mapcalc", expression="R_1=1.0")
 grass.run_command("r.mapcalc", expression="R_1=1.0")
 
 
 # Longitudinal and transversal dispersivity length
 # Longitudinal and transversal dispersivity length
-AL=50
-AT=5
+AL = 50
+AT = 5
 
 
 # Compute the solute transport using the above defined dispersivity coefficients for a timestep of 250d
 # Compute the solute transport using the above defined dispersivity coefficients for a timestep of 250d
-grass.run_command("r.solute.transport", "c", error=0.000000000000001, maxit=1000, solver="bicgstab",
-  top="top_conf_1", bottom="bottom_1", phead="gwresult_conf_1", status="tstatus_1", hc_x="hydcond_1",
-  hc_y="hydcond_1", rd="R_1", cs="cs_1", q="well_1", nf="poros_1", output="stresult_conf_1", dt=21600000,
-  diff_x="diff_1", diff_y="diff_1", cin="cin_1", c="c_1", al=AL, at=AT)
+grass.run_command(
+    "r.solute.transport",
+    "c",
+    error=0.000000000000001,
+    maxit=1000,
+    solver="bicgstab",
+    top="top_conf_1",
+    bottom="bottom_1",
+    phead="gwresult_conf_1",
+    status="tstatus_1",
+    hc_x="hydcond_1",
+    hc_y="hydcond_1",
+    rd="R_1",
+    cs="cs_1",
+    q="well_1",
+    nf="poros_1",
+    output="stresult_conf_1",
+    dt=21600000,
+    diff_x="diff_1",
+    diff_y="diff_1",
+    cin="cin_1",
+    c="c_1",
+    al=AL,
+    at=AT,
+)
 
 
 # Get the maximum concentration
 # Get the maximum concentration
 range = grass.parse_command("r.info", "r", map="stresult_conf_1")
 range = grass.parse_command("r.info", "r", map="stresult_conf_1")
 # Normalize the result
 # Normalize the result
-grass.run_command("r.mapcalc", expression="stresult_conf_1_norm = stresult_conf_1/" + str(range["max"]))
-#Create contour lines range from 0.7 to 0.1 in 0.1 steps
-grass.run_command("r.contour", input="stresult_conf_1_norm", output="stresult_conf_1_norm", minlevel=0.1, maxlevel=0.7, step=0.1)
+grass.run_command(
+    "r.mapcalc",
+    expression="stresult_conf_1_norm = stresult_conf_1/" + str(range["max"]),
+)
+# Create contour lines range from 0.7 to 0.1 in 0.1 steps
+grass.run_command(
+    "r.contour",
+    input="stresult_conf_1_norm",
+    output="stresult_conf_1_norm",
+    minlevel=0.1,
+    maxlevel=0.7,
+    step=0.1,
+)
 
 
 # The second computation uses different dispersivity lengths
 # The second computation uses different dispersivity lengths
-AL=10
-AT=1
+AL = 10
+AT = 1
 
 
 # Compute the solute transport using the above defined dispersivity coefficients for a timestep of 250d
 # Compute the solute transport using the above defined dispersivity coefficients for a timestep of 250d
-grass.run_command("r.solute.transport", "c", error=0.000000000000001, maxit=1000, solver="bicgstab",
-  top="top_conf_1", bottom="bottom_1", phead="gwresult_conf_1", status="tstatus_1", hc_x="hydcond_1",
-  hc_y="hydcond_1", rd="R_1", cs="cs_1", q="well_1", nf="poros_1", output="stresult_conf_2", dt=21600000,
-  diff_x="diff_1", diff_y="diff_1", cin="cin_1", c="c_1", al=AL, at=AT)
+grass.run_command(
+    "r.solute.transport",
+    "c",
+    error=0.000000000000001,
+    maxit=1000,
+    solver="bicgstab",
+    top="top_conf_1",
+    bottom="bottom_1",
+    phead="gwresult_conf_1",
+    status="tstatus_1",
+    hc_x="hydcond_1",
+    hc_y="hydcond_1",
+    rd="R_1",
+    cs="cs_1",
+    q="well_1",
+    nf="poros_1",
+    output="stresult_conf_2",
+    dt=21600000,
+    diff_x="diff_1",
+    diff_y="diff_1",
+    cin="cin_1",
+    c="c_1",
+    al=AL,
+    at=AT,
+)
 
 
 
 
 # Get the maximum concentration
 # Get the maximum concentration
 range = grass.parse_command("r.info", "r", map="stresult_conf_2")
 range = grass.parse_command("r.info", "r", map="stresult_conf_2")
 # Normalize the result
 # Normalize the result
-grass.run_command("r.mapcalc", expression="stresult_conf_2_norm = stresult_conf_2/" + str(range["max"]))
-#Create contour lines range from 0.7 to 0.1 in 0.1 steps
-grass.run_command("r.contour", input="stresult_conf_2_norm", output="stresult_conf_2_norm", minlevel=0.1, maxlevel=0.7, step=0.1)
+grass.run_command(
+    "r.mapcalc",
+    expression="stresult_conf_2_norm = stresult_conf_2/" + str(range["max"]),
+)
+# Create contour lines range from 0.7 to 0.1 in 0.1 steps
+grass.run_command(
+    "r.contour",
+    input="stresult_conf_2_norm",
+    output="stresult_conf_2_norm",
+    minlevel=0.1,
+    maxlevel=0.7,
+    step=0.1,
+)

+ 115 - 49
raster/r.sun/testsuite/test_rsun.py

@@ -5,40 +5,66 @@ from grass.gunittest.gmodules import SimpleModule
 
 
 
 
 class TestRSunMode2(TestCase):
 class TestRSunMode2(TestCase):
-    elevation = 'elevation'
-    elevation_attrib = 'elevation_attrib'
-    elevation_threads = 'elevation_threads'
-    slope = 'rsun_slope'
-    aspect = 'rsun_aspect'
-    beam_rad = 'beam_rad'
-    glob_rad = 'glob_rad'
-    insol_time = 'insol_time'
-    glob_rad_threads = 'glob_rad_threads'
+    elevation = "elevation"
+    elevation_attrib = "elevation_attrib"
+    elevation_threads = "elevation_threads"
+    slope = "rsun_slope"
+    aspect = "rsun_aspect"
+    beam_rad = "beam_rad"
+    glob_rad = "glob_rad"
+    insol_time = "insol_time"
+    glob_rad_threads = "glob_rad_threads"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=223500, s=220000, e=640000, w=635000, res=10)
-        cls.runModule('r.slope.aspect', elevation=cls.elevation, slope=cls.slope, aspect=cls.aspect)
+        cls.runModule("g.region", n=223500, s=220000, e=640000, w=635000, res=10)
+        cls.runModule(
+            "r.slope.aspect",
+            elevation=cls.elevation,
+            slope=cls.slope,
+            aspect=cls.aspect,
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', type=['raster'],
-                      name=[cls.slope, cls.aspect, cls.insol_time, cls.beam_rad, cls.glob_rad, cls.glob_rad_threads], flags='f')
+        cls.runModule(
+            "g.remove",
+            type=["raster"],
+            name=[
+                cls.slope,
+                cls.aspect,
+                cls.insol_time,
+                cls.beam_rad,
+                cls.glob_rad,
+                cls.glob_rad_threads,
+            ],
+            flags="f",
+        )
 
 
     def setUp(self):
     def setUp(self):
-        self.rsun = SimpleModule('r.sun', elevation=self.elevation, slope=self.slope, aspect=self.aspect,
-                                 day=172, beam_rad=self.beam_rad, glob_rad=self.glob_rad, insol_time=self.insol_time,
-                                 overwrite=True)
+        self.rsun = SimpleModule(
+            "r.sun",
+            elevation=self.elevation,
+            slope=self.slope,
+            aspect=self.aspect,
+            day=172,
+            beam_rad=self.beam_rad,
+            glob_rad=self.glob_rad,
+            insol_time=self.insol_time,
+            overwrite=True,
+        )
 
 
     def test_more_threads(self):
     def test_more_threads(self):
         self.assertModule(self.rsun)
         self.assertModule(self.rsun)
         try:
         try:
-            self.rsun.inputs['nprocs'].value = 4
+            self.rsun.inputs["nprocs"].value = 4
             self.rsun.outputs.glob_rad = self.glob_rad_threads
             self.rsun.outputs.glob_rad = self.glob_rad_threads
             self.assertModule(self.rsun)
             self.assertModule(self.rsun)
-            self.assertRastersNoDifference(self.glob_rad, self.glob_rad_threads, precision=1e-8)
+            self.assertRastersNoDifference(
+                self.glob_rad, self.glob_rad_threads, precision=1e-8
+            )
         except KeyError:
         except KeyError:
             # original version of r.sun without parallel processing
             # original version of r.sun without parallel processing
             return
             return
@@ -49,51 +75,84 @@ class TestRSunMode2(TestCase):
         self.assertRasterExists(name=self.glob_rad)
         self.assertRasterExists(name=self.glob_rad)
         self.assertRasterExists(name=self.insol_time)
         self.assertRasterExists(name=self.insol_time)
         # beam_rad
         # beam_rad
-        values = 'min=6561.3505859375\nmax=7680.93505859375\nmean=7638.91454059886'
-        self.assertRasterFitsUnivar(raster=self.beam_rad, reference=values, precision=1e-8)
+        values = "min=6561.3505859375\nmax=7680.93505859375\nmean=7638.91454059886"
+        self.assertRasterFitsUnivar(
+            raster=self.beam_rad, reference=values, precision=1e-8
+        )
         # glob_rad
         # glob_rad
-        values = 'min=7829.4921875\nmax=8889.4765625\nmean=8851.4872842213'
-        self.assertRasterFitsUnivar(raster=self.glob_rad, reference=values, precision=1e-8)
+        values = "min=7829.4921875\nmax=8889.4765625\nmean=8851.4872842213"
+        self.assertRasterFitsUnivar(
+            raster=self.glob_rad, reference=values, precision=1e-8
+        )
         # insol_time
         # insol_time
-        values = 'min=11.5\nmax=14\nmean=13.8521038175691'
-        self.assertRasterFitsUnivar(raster=self.insol_time, reference=values, precision=1e-8)
+        values = "min=11.5\nmax=14\nmean=13.8521038175691"
+        self.assertRasterFitsUnivar(
+            raster=self.insol_time, reference=values, precision=1e-8
+        )
 
 
 
 
 class TestRSunMode1(TestCase):
 class TestRSunMode1(TestCase):
-    elevation = 'elevation'
-    elevation_attrib = 'elevation_attrib'
-    elevation_threads = 'elevation_threads'
-    slope = 'rsun_slope'
-    aspect = 'rsun_aspect'
-    beam_rad = 'beam_rad'
-    glob_rad = 'glob_rad'
-    incidout = 'incidout'
-    glob_rad_threads = 'glob_rad_threads'
+    elevation = "elevation"
+    elevation_attrib = "elevation_attrib"
+    elevation_threads = "elevation_threads"
+    slope = "rsun_slope"
+    aspect = "rsun_aspect"
+    beam_rad = "beam_rad"
+    glob_rad = "glob_rad"
+    incidout = "incidout"
+    glob_rad_threads = "glob_rad_threads"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=223500, s=220000, e=640000, w=635000, res=10)
-        cls.runModule('r.slope.aspect', elevation=cls.elevation, slope=cls.slope, aspect=cls.aspect)
+        cls.runModule("g.region", n=223500, s=220000, e=640000, w=635000, res=10)
+        cls.runModule(
+            "r.slope.aspect",
+            elevation=cls.elevation,
+            slope=cls.slope,
+            aspect=cls.aspect,
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', type=['raster'],
-                      name=[cls.slope, cls.aspect, cls.incidout, cls.beam_rad, cls.glob_rad, cls.glob_rad_threads], flags='f')
+        cls.runModule(
+            "g.remove",
+            type=["raster"],
+            name=[
+                cls.slope,
+                cls.aspect,
+                cls.incidout,
+                cls.beam_rad,
+                cls.glob_rad,
+                cls.glob_rad_threads,
+            ],
+            flags="f",
+        )
 
 
     def setUp(self):
     def setUp(self):
-        self.rsun = SimpleModule('r.sun', elevation=self.elevation, slope=self.slope, aspect=self.aspect,
-                                 day=172, time=18, beam_rad=self.beam_rad, glob_rad=self.glob_rad, incidout=self.incidout,
-                                 overwrite=True)
+        self.rsun = SimpleModule(
+            "r.sun",
+            elevation=self.elevation,
+            slope=self.slope,
+            aspect=self.aspect,
+            day=172,
+            time=18,
+            beam_rad=self.beam_rad,
+            glob_rad=self.glob_rad,
+            incidout=self.incidout,
+            overwrite=True,
+        )
 
 
     def test_more_threads(self):
     def test_more_threads(self):
         self.assertModule(self.rsun)
         self.assertModule(self.rsun)
         try:
         try:
-            self.rsun.inputs['nprocs'].value = 4
+            self.rsun.inputs["nprocs"].value = 4
             self.rsun.outputs.glob_rad = self.glob_rad_threads
             self.rsun.outputs.glob_rad = self.glob_rad_threads
             self.assertModule(self.rsun)
             self.assertModule(self.rsun)
-            self.assertRastersNoDifference(self.glob_rad, self.glob_rad_threads, precision=1e-8)
+            self.assertRastersNoDifference(
+                self.glob_rad, self.glob_rad_threads, precision=1e-8
+            )
         except KeyError:
         except KeyError:
             # original version of r.sun without parallel processing
             # original version of r.sun without parallel processing
             return
             return
@@ -104,14 +163,21 @@ class TestRSunMode1(TestCase):
         self.assertRasterExists(name=self.glob_rad)
         self.assertRasterExists(name=self.glob_rad)
         self.assertRasterExists(name=self.incidout)
         self.assertRasterExists(name=self.incidout)
         # beam_rad
         # beam_rad
-        values = 'min=0\nmax=355.780944824219\nmean=124.615522080923'
-        self.assertRasterFitsUnivar(raster=self.beam_rad, reference=values, precision=1e-8)
+        values = "min=0\nmax=355.780944824219\nmean=124.615522080923"
+        self.assertRasterFitsUnivar(
+            raster=self.beam_rad, reference=values, precision=1e-8
+        )
         # glob_rad
         # glob_rad
-        values = 'min=32.1095008850098\nmax=451.527923583984\nmean=178.057346498427'
-        self.assertRasterFitsUnivar(raster=self.glob_rad, reference=values, precision=1e-8)
+        values = "min=32.1095008850098\nmax=451.527923583984\nmean=178.057346498427"
+        self.assertRasterFitsUnivar(
+            raster=self.glob_rad, reference=values, precision=1e-8
+        )
         # incidout
         # incidout
-        values = 'min=0.0100772567093372\nmax=40.5435371398926\nmean=13.2855086254291'
-        self.assertRasterFitsUnivar(raster=self.incidout, reference=values, precision=1e-8)
+        values = "min=0.0100772567093372\nmax=40.5435371398926\nmean=13.2855086254291"
+        self.assertRasterFitsUnivar(
+            raster=self.incidout, reference=values, precision=1e-8
+        )
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 41 - 24
raster/r.terraflow/testsuite/test_r_terraflow.py

@@ -6,11 +6,12 @@ import os
 import tempfile
 import tempfile
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 
 
+
 class TestTerraflow(TestCase):
 class TestTerraflow(TestCase):
 
 
-    elevation = 'elevation'
-    testdir = os.path.join(tempfile.gettempdir(), 'terraflow_test')
-    teststats = os.path.join(tempfile.gettempdir(), 'terraflow_test_stats.txt')
+    elevation = "elevation"
+    testdir = os.path.join(tempfile.gettempdir(), "terraflow_test")
+    teststats = os.path.join(tempfile.gettempdir(), "terraflow_test_stats.txt")
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
@@ -20,26 +21,32 @@ class TestTerraflow(TestCase):
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        """!Remove the temporary region
-        """
+        """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def setUp(cls):
     def setUp(cls):
-        """Create input data for steady state groundwater flow computation
-        """
+        """Create input data for steady state groundwater flow computation"""
         if not os.path.exists(cls.testdir):
         if not os.path.exists(cls.testdir):
             os.mkdir(cls.testdir)
             os.mkdir(cls.testdir)
 
 
     def test_univar_mfd(cls):
     def test_univar_mfd(cls):
-        #compute a steady state groundwater flow
-        cls.assertModule("r.terraflow", overwrite=True, verbose=True,
-        elevation=cls.elevation, filled='terra_flooded',
-        direction='terra_flowdir', swatershed='terra_sink',
-        accumulation='terra_flowaccum', tci='terra_tci',
-        directory=cls.testdir, stats=cls.teststats)
+        # compute a steady state groundwater flow
+        cls.assertModule(
+            "r.terraflow",
+            overwrite=True,
+            verbose=True,
+            elevation=cls.elevation,
+            filled="terra_flooded",
+            direction="terra_flowdir",
+            swatershed="terra_sink",
+            accumulation="terra_flowaccum",
+            tci="terra_tci",
+            directory=cls.testdir,
+            stats=cls.teststats,
+        )
 
 
         # Output of r.univar -g
         # Output of r.univar -g
-        terra_flooded_univar="""n=2025000
+        terra_flooded_univar = """n=2025000
 null_cells=0
 null_cells=0
 cells=2025000
 cells=2025000
 min=55.5787925720215
 min=55.5787925720215
@@ -52,7 +59,7 @@ variance=410.339616685993
 coeff_var=18.3374758755462
 coeff_var=18.3374758755462
 sum=223695473.535042"""
 sum=223695473.535042"""
 
 
-        terra_flowdir_univar="""n=2025000
+        terra_flowdir_univar = """n=2025000
 null_cells=0
 null_cells=0
 cells=2025000
 cells=2025000
 min=0
 min=0
@@ -65,7 +72,7 @@ variance=7213.17366195336
 coeff_var=74.344179186649
 coeff_var=74.344179186649
 sum=231334950"""
 sum=231334950"""
 
 
-        terra_sink_univar="""n=2025000
+        terra_sink_univar = """n=2025000
 null_cells=0
 null_cells=0
 cells=2025000
 cells=2025000
 min=0
 min=0
@@ -78,7 +85,7 @@ variance=5535582.67198542
 coeff_var=63.2980628790363
 coeff_var=63.2980628790363
 sum=7526902297"""
 sum=7526902297"""
 
 
-        terra_flowaccum_univar="""n=2025000
+        terra_flowaccum_univar = """n=2025000
 null_cells=0
 null_cells=0
 cells=2025000
 cells=2025000
 min=1
 min=1
@@ -91,7 +98,7 @@ variance=112702574.858836
 coeff_var=1646.67618536449
 coeff_var=1646.67618536449
 sum=1305520639.08371"""
 sum=1305520639.08371"""
 
 
-        terra_tci_univar="""n=2025000
+        terra_tci_univar = """n=2025000
 null_cells=0
 null_cells=0
 cells=2025000
 cells=2025000
 min=1.07463788986206
 min=1.07463788986206
@@ -104,12 +111,22 @@ variance=3.88643128378274
 coeff_var=47.8572213922083
 coeff_var=47.8572213922083
 sum=8341670.75914752"""
 sum=8341670.75914752"""
 
 
-        #cls.assertRasterFitsUnivar(raster="terra_flooded",  reference=terra_flooded_univar,  precision=3)
-        cls.assertRasterFitsUnivar(raster="terra_flowdir", reference=terra_flowdir_univar, precision=3)
-        cls.assertRasterFitsUnivar(raster="terra_sink", reference=terra_sink_univar, precision=3)
-        cls.assertRasterFitsUnivar(raster="terra_flowaccum", reference=terra_flowaccum_univar, precision=3)
-        cls.assertRasterFitsUnivar(raster="terra_tci", reference=terra_tci_univar, precision=3)
+        # cls.assertRasterFitsUnivar(raster="terra_flooded",  reference=terra_flooded_univar,  precision=3)
+        cls.assertRasterFitsUnivar(
+            raster="terra_flowdir", reference=terra_flowdir_univar, precision=3
+        )
+        cls.assertRasterFitsUnivar(
+            raster="terra_sink", reference=terra_sink_univar, precision=3
+        )
+        cls.assertRasterFitsUnivar(
+            raster="terra_flowaccum", reference=terra_flowaccum_univar, precision=3
+        )
+        cls.assertRasterFitsUnivar(
+            raster="terra_tci", reference=terra_tci_univar, precision=3
+        )
+
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 38 - 29
raster/r.texture/testsuite/test_texture.py

@@ -9,6 +9,8 @@ Licence:    This program is free software under the GNU General Public
 	            for details.
 	            for details.
 """
 """
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
+
+
 class TestRasterreport(TestCase):
 class TestRasterreport(TestCase):
     input = "lsat7_2002_80"
     input = "lsat7_2002_80"
 
 
@@ -20,56 +22,63 @@ class TestRasterreport(TestCase):
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', flags='f', type='raster', name="asm_ASM")
-        cls.runModule('g.remove', flags='f', type='raster', name='corr_Corr')
-        cls.runModule('g.remove', flags='f', type='raster', name='sa_SA')
-        cls.runModule('g.remove', flags='f', type='raster', name='var_Var')
-        cls.runModule('g.remove', flags='f', type='raster', name='idm_IDM')
+        cls.runModule("g.remove", flags="f", type="raster", name="asm_ASM")
+        cls.runModule("g.remove", flags="f", type="raster", name="corr_Corr")
+        cls.runModule("g.remove", flags="f", type="raster", name="sa_SA")
+        cls.runModule("g.remove", flags="f", type="raster", name="var_Var")
+        cls.runModule("g.remove", flags="f", type="raster", name="idm_IDM")
 
 
     def test_asm(self):
     def test_asm(self):
         """Testing method asm"""
         """Testing method asm"""
-        asm_ASM='asm_ASM'
-        string="""min=1
+        asm_ASM = "asm_ASM"
+        string = """min=1
         max=1
         max=1
         cells=1000246"""
         cells=1000246"""
-        self.assertModule('r.texture', input=self.input, output='asm', method='asm')
-        self.assertRasterFitsUnivar(asm_ASM,
-                                    reference=string, precision=2)
+        self.assertModule("r.texture", input=self.input, output="asm", method="asm")
+        self.assertRasterFitsUnivar(asm_ASM, reference=string, precision=2)
 
 
     def test_corr(self):
     def test_corr(self):
         """Testing method corr"""
         """Testing method corr"""
-        corr_output='corr_Corr'
-        string="""min=1
+        corr_output = "corr_Corr"
+        string = """min=1
         max=1
         max=1
         cells=1000246"""
         cells=1000246"""
-        self.assertModule('r.texture', input=self.input, output='corr', method='corr')
-        self.assertRasterFitsUnivar(corr_output,
-                                    reference=string, precision=2)
+        self.assertModule("r.texture", input=self.input, output="corr", method="corr")
+        self.assertRasterFitsUnivar(corr_output, reference=string, precision=2)
 
 
     def test_sa(self):
     def test_sa(self):
         """Testing method sa"""
         """Testing method sa"""
-        sa_SA='sa_SA'
-        string="""min=95.95
+        sa_SA = "sa_SA"
+        string = """min=95.95
         max=2942.79
         max=2942.79
         cells=1000246"""
         cells=1000246"""
-        self.assertModule('r.texture', input=self.input, output='sa', method='sa')
-        self.assertRasterFitsUnivar(sa_SA,
-                                    reference=string, precision=2)
+        self.assertModule("r.texture", input=self.input, output="sa", method="sa")
+        self.assertRasterFitsUnivar(sa_SA, reference=string, precision=2)
 
 
     def test_var(self):
     def test_var(self):
         """Testing method var"""
         """Testing method var"""
-        var_output='var_Var'
-        self.assertModule('r.texture', input=self.input, output='var', method='var')
-        self.assertRasterMinMax(map=var_output, refmin=0, refmax=9843.07,
-                                msg="var_Var in degrees must be between 0.74 and 9843.07")
+        var_output = "var_Var"
+        self.assertModule("r.texture", input=self.input, output="var", method="var")
+        self.assertRasterMinMax(
+            map=var_output,
+            refmin=0,
+            refmax=9843.07,
+            msg="var_Var in degrees must be between 0.74 and 9843.07",
+        )
 
 
     def test_idm(self):
     def test_idm(self):
         """Testing method idm"""
         """Testing method idm"""
-        idm_IDM='idm_IDM'
-        self.assertModule('r.texture', input=self.input, output='idm', method='idm')
-        self.assertRasterMinMax(map=idm_IDM, refmin=0, refmax=9843.07,
-                                msg="idm_IDM_IDM in degrees must be between 0.74 and 9843.07")
+        idm_IDM = "idm_IDM"
+        self.assertModule("r.texture", input=self.input, output="idm", method="idm")
+        self.assertRasterMinMax(
+            map=idm_IDM,
+            refmin=0,
+            refmax=9843.07,
+            msg="idm_IDM_IDM in degrees must be between 0.74 and 9843.07",
+        )
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 124 - 65
raster/r.tile/testsuite/test_r_tile.py

@@ -1,65 +1,124 @@
-"""
-Name:        r.tile test
-Purpose:    Tests r.tile module and the number of created tiles.
-
-Author:     Shubham Sharma, Google Code-in 2018
-Copyright:  (C) 2018 by Shubham Sharma and the GRASS Development Team
-Licence:    This program is free software under the GNU General Public
-            License (>=v2). Read the file COPYING that comes with GRASS
-            for details.
-"""
-
-from grass.gunittest.case import TestCase
-from grass.gunittest.main import test
-
-
-class TestRasterTile(TestCase):
-    input = 'lakes'
-    output_prefix = 'lakes_tile'
-    width = '1000'
-    height = '1000'
-    overlap = '10'
-
-    @classmethod
-    def setUpClass(cls):
-        cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input)
-
-    @classmethod
-    def tearDownClass(cls):
-        cls.del_temp_region()
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.output_prefix + '-000-000')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.output_prefix + '-000-001')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.output_prefix + '-001-000')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.output_prefix + '-001-001')
-
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.output_prefix + 'overlap' + '-000-000')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.output_prefix + 'overlap' + '-000-001')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.output_prefix + 'overlap' + '-001-000')
-        cls.runModule('g.remove', type='raster', flags='f', name=cls.output_prefix + 'overlap' + '-001-001')
-
-    def test_raster_tile(self):
-        """Testing r.tile runs successfully"""
-        self.assertModule('r.tile', input=self.input, output=self.output_prefix, width=self.width, height=self.height)
-        # If the above statement executed successful then
-        # 4 rasters tiles with following details should exits
-        self.assertRasterExists(self.output_prefix+'-000-000', msg="lakes_tile-000-000 does not exits")
-        self.assertRasterExists(self.output_prefix+'-000-001', msg="lakes_tile-000-001 does not exits")
-        self.assertRasterExists(self.output_prefix+'-001-000', msg="lakes_tile-001-000 does not exits")
-        self.assertRasterExists(self.output_prefix+'-001-001', msg="lakes_tile-001-001 does not exits")
-
-    def test_raster_tile_overlap(self):
-        """Testing r.tile runs successfully with overlap option"""
-        self.assertModule('r.tile', input=self.input, output=self.output_prefix+'overlap', width=self.width, height=self.height, overlap=self.overlap)
-        # If the above statement executed successful then
-        # 4 rasters tiles with following details should exits
-        self.assertRasterExists(self.output_prefix+'overlap'+'-000-000', msg="lakes_tile-000-000 does not exits")
-        self.assertRasterExists(self.output_prefix+'overlap'+'-000-001', msg="lakes_tile-000-001 does not exits")
-        self.assertRasterExists(self.output_prefix+'overlap'+'-001-000', msg="lakes_tile-001-000 does not exits")
-        self.assertRasterExists(self.output_prefix+'overlap'+'-001-001', msg="lakes_tile-001-001 does not exits")
-
-
-
-
-if __name__ == '__main__':
-    test()
+"""
+Name:        r.tile test
+Purpose:    Tests r.tile module and the number of created tiles.
+
+Author:     Shubham Sharma, Google Code-in 2018
+Copyright:  (C) 2018 by Shubham Sharma and the GRASS Development Team
+Licence:    This program is free software under the GNU General Public
+            License (>=v2). Read the file COPYING that comes with GRASS
+            for details.
+"""
+
+from grass.gunittest.case import TestCase
+from grass.gunittest.main import test
+
+
+class TestRasterTile(TestCase):
+    input = "lakes"
+    output_prefix = "lakes_tile"
+    width = "1000"
+    height = "1000"
+    overlap = "10"
+
+    @classmethod
+    def setUpClass(cls):
+        cls.use_temp_region()
+        cls.runModule("g.region", raster=cls.input)
+
+    @classmethod
+    def tearDownClass(cls):
+        cls.del_temp_region()
+        cls.runModule(
+            "g.remove", type="raster", flags="f", name=cls.output_prefix + "-000-000"
+        )
+        cls.runModule(
+            "g.remove", type="raster", flags="f", name=cls.output_prefix + "-000-001"
+        )
+        cls.runModule(
+            "g.remove", type="raster", flags="f", name=cls.output_prefix + "-001-000"
+        )
+        cls.runModule(
+            "g.remove", type="raster", flags="f", name=cls.output_prefix + "-001-001"
+        )
+
+        cls.runModule(
+            "g.remove",
+            type="raster",
+            flags="f",
+            name=cls.output_prefix + "overlap" + "-000-000",
+        )
+        cls.runModule(
+            "g.remove",
+            type="raster",
+            flags="f",
+            name=cls.output_prefix + "overlap" + "-000-001",
+        )
+        cls.runModule(
+            "g.remove",
+            type="raster",
+            flags="f",
+            name=cls.output_prefix + "overlap" + "-001-000",
+        )
+        cls.runModule(
+            "g.remove",
+            type="raster",
+            flags="f",
+            name=cls.output_prefix + "overlap" + "-001-001",
+        )
+
+    def test_raster_tile(self):
+        """Testing r.tile runs successfully"""
+        self.assertModule(
+            "r.tile",
+            input=self.input,
+            output=self.output_prefix,
+            width=self.width,
+            height=self.height,
+        )
+        # If the above statement executed successful then
+        # 4 rasters tiles with following details should exits
+        self.assertRasterExists(
+            self.output_prefix + "-000-000", msg="lakes_tile-000-000 does not exits"
+        )
+        self.assertRasterExists(
+            self.output_prefix + "-000-001", msg="lakes_tile-000-001 does not exits"
+        )
+        self.assertRasterExists(
+            self.output_prefix + "-001-000", msg="lakes_tile-001-000 does not exits"
+        )
+        self.assertRasterExists(
+            self.output_prefix + "-001-001", msg="lakes_tile-001-001 does not exits"
+        )
+
+    def test_raster_tile_overlap(self):
+        """Testing r.tile runs successfully with overlap option"""
+        self.assertModule(
+            "r.tile",
+            input=self.input,
+            output=self.output_prefix + "overlap",
+            width=self.width,
+            height=self.height,
+            overlap=self.overlap,
+        )
+        # If the above statement executed successful then
+        # 4 rasters tiles with following details should exits
+        self.assertRasterExists(
+            self.output_prefix + "overlap" + "-000-000",
+            msg="lakes_tile-000-000 does not exits",
+        )
+        self.assertRasterExists(
+            self.output_prefix + "overlap" + "-000-001",
+            msg="lakes_tile-000-001 does not exits",
+        )
+        self.assertRasterExists(
+            self.output_prefix + "overlap" + "-001-000",
+            msg="lakes_tile-001-000 does not exits",
+        )
+        self.assertRasterExists(
+            self.output_prefix + "overlap" + "-001-001",
+            msg="lakes_tile-001-001 does not exits",
+        )
+
+
+if __name__ == "__main__":
+    test()

+ 52 - 18
raster/r.tile/testsuite/testrt.py

@@ -11,47 +11,81 @@ Licence:    This program is free software under the GNU General Public
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 
 
+
 class Testrr(TestCase):
 class Testrr(TestCase):
-    input='elevation'
-    output='tile'
+    input = "elevation"
+    output = "tile"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input)
+        cls.runModule("g.region", raster=cls.input)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
-
     def test_basic(self):
     def test_basic(self):
         """Running a basic test"""
         """Running a basic test"""
-        self.assertModule('r.tile', input=self.input, output=self.output, width=1500/2, height=1350/2)
+        self.assertModule(
+            "r.tile",
+            input=self.input,
+            output=self.output,
+            width=1500 / 2,
+            height=1350 / 2,
+        )
 
 
     def test_univar(self):
     def test_univar(self):
         """Testing the output map tile-001-002"""
         """Testing the output map tile-001-002"""
-        string="""min=55.5787925720215
+        string = """min=55.5787925720215
         n=506250
         n=506250
         max=144.267288208008"""
         max=144.267288208008"""
-        self.assertModule('r.tile', input=self.input, output=self.output, width=1500/2, height=1350/2)
-        self.assertRasterFitsUnivar('tile-000-001',
-                                    reference=string, precision=2)
+        self.assertModule(
+            "r.tile",
+            input=self.input,
+            output=self.output,
+            width=1500 / 2,
+            height=1350 / 2,
+        )
+        self.assertRasterFitsUnivar("tile-000-001", reference=string, precision=2)
 
 
     def test_overlap(self):
     def test_overlap(self):
         """Testing overlap parameter with output map tile-000-000"""
         """Testing overlap parameter with output map tile-000-000"""
-        tile="tile-000-000"
-        self.assertModule('r.tile', input=self.input, output=self.output, width=1500/2, height=1350/2, overlap=250)
-        self.assertRasterMinMax(map=tile, refmin=74.75374, refmax=156.3299,
-                                msg="tile-000-000 in degrees must be between 74.75374 and 156.3299")
+        tile = "tile-000-000"
+        self.assertModule(
+            "r.tile",
+            input=self.input,
+            output=self.output,
+            width=1500 / 2,
+            height=1350 / 2,
+            overlap=250,
+        )
+        self.assertRasterMinMax(
+            map=tile,
+            refmin=74.75374,
+            refmax=156.3299,
+            msg="tile-000-000 in degrees must be between 74.75374 and 156.3299",
+        )
 
 
     def test_minmax(self):
     def test_minmax(self):
         """Testing output map tile-000-001"""
         """Testing output map tile-000-001"""
-        tile1="tile-000-001"
-        self.assertModule('r.tile', input=self.input, output=self.output, width=1500/2, height=1350/2)
-        self.assertRasterMinMax(map=tile1, refmin=55.57879, refmax=144.2673,
-                                msg="tile-000-001 in degrees must be between 55.57879 and 144.2673")
+        tile1 = "tile-000-001"
+        self.assertModule(
+            "r.tile",
+            input=self.input,
+            output=self.output,
+            width=1500 / 2,
+            height=1350 / 2,
+        )
+        self.assertRasterMinMax(
+            map=tile1,
+            refmin=55.57879,
+            refmax=144.2673,
+            msg="tile-000-001 in degrees must be between 55.57879 and 144.2673",
+        )
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 27 - 10
raster/r.to.vect/testsuite/test_r_to_vect.py

@@ -13,48 +13,65 @@ from grass.gunittest.main import test
 
 
 
 
 class Testrr(TestCase):
 class Testrr(TestCase):
-    input = 'lakes'
-    output = 'testrtovect'
-    point = 'point'
+    input = "lakes"
+    output = "testrtovect"
+    point = "point"
     area = "area"
     area = "area"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input)
+        cls.runModule("g.region", raster=cls.input)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(cls):
     def tearDown(cls):
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.output)
+        cls.runModule("g.remove", type="vector", flags="f", name=cls.output)
 
 
     def test_flags(self):
     def test_flags(self):
         """Testing flag s"""
         """Testing flag s"""
-        self.assertModule('r.to.vect', input=self.input, output=self.output, type=self.point, flags='s')
+        self.assertModule(
+            "r.to.vect",
+            input=self.input,
+            output=self.output,
+            type=self.point,
+            flags="s",
+        )
         topology = dict(points=36011, lines=0, areas=0)
         topology = dict(points=36011, lines=0, areas=0)
         self.assertVectorFitsTopoInfo(self.output, topology)
         self.assertVectorFitsTopoInfo(self.output, topology)
 
 
     def test_flagz(self):
     def test_flagz(self):
         """Testing flag z"""
         """Testing flag z"""
-        self.assertModule('r.to.vect', input=self.input, output=self.output, type=self.point, flags='z')
+        self.assertModule(
+            "r.to.vect",
+            input=self.input,
+            output=self.output,
+            type=self.point,
+            flags="z",
+        )
         topology = dict(points=36011, lines=0, areas=0)
         topology = dict(points=36011, lines=0, areas=0)
         self.assertVectorFitsTopoInfo(self.output, topology)
         self.assertVectorFitsTopoInfo(self.output, topology)
 
 
     def test_flagb(self):
     def test_flagb(self):
         """Testing flag b"""
         """Testing flag b"""
-        self.assertModule('r.to.vect', input=self.input, output=self.output, type=self.area, flags='b')
+        self.assertModule(
+            "r.to.vect", input=self.input, output=self.output, type=self.area, flags="b"
+        )
         topology = dict(points=0, lines=0, areas=0)
         topology = dict(points=0, lines=0, areas=0)
         self.assertVectorFitsTopoInfo(self.output, topology)
         self.assertVectorFitsTopoInfo(self.output, topology)
 
 
     def test_flagt(self):
     def test_flagt(self):
         """Testing flag t"""
         """Testing flag t"""
-        self.assertModule('r.to.vect', input=self.input, output=self.output, type=self.area, flags='t')
+        self.assertModule(
+            "r.to.vect", input=self.input, output=self.output, type=self.area, flags="t"
+        )
         topology = dict(points=0, lines=0, areas=33)
         topology = dict(points=0, lines=0, areas=33)
         self.assertVectorFitsTopoInfo(self.output, topology)
         self.assertVectorFitsTopoInfo(self.output, topology)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 73 - 41
raster/r.univar/testsuite/test_r_univar.py

@@ -4,8 +4,8 @@
 """
 """
 from grass.gunittest.case import TestCase
 from grass.gunittest.case import TestCase
 
 
-class TestRasterUnivar(TestCase):
 
 
+class TestRasterUnivar(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
@@ -13,29 +13,30 @@ class TestRasterUnivar(TestCase):
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        """!Remove the temporary region
-        """
+        """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(self):
     def tearDown(self):
-        self.runModule("g.remove", flags='f', type="raster", name="map_a")
-        self.runModule("g.remove", flags='f', type="raster", name="map_b")
-        self.runModule("g.remove", flags='f', type="raster", name="zone_map")
+        self.runModule("g.remove", flags="f", type="raster", name="map_a")
+        self.runModule("g.remove", flags="f", type="raster", name="map_b")
+        self.runModule("g.remove", flags="f", type="raster", name="zone_map")
 
 
     def setUp(self):
     def setUp(self):
-        """Create input data
-        """
+        """Create input data"""
         self.runModule("g.region", res=1, n=90, s=0, w=0, e=90)
         self.runModule("g.region", res=1, n=90, s=0, w=0, e=90)
-        self.runModule("r.mapcalc", expression="map_a = 100 + row() + col()",
-                       overwrite=True)
-        self.runModule("r.mapcalc", expression="map_b = 200 + row() + col()",
-                       overwrite=True)
-        self.runModule("r.mapcalc", expression="zone_map = if(row() < 20, 1,2)",
-                       overwrite=True)
+        self.runModule(
+            "r.mapcalc", expression="map_a = 100 + row() + col()", overwrite=True
+        )
+        self.runModule(
+            "r.mapcalc", expression="map_b = 200 + row() + col()", overwrite=True
+        )
+        self.runModule(
+            "r.mapcalc", expression="zone_map = if(row() < 20, 1,2)", overwrite=True
+        )
 
 
     def test_1(self):
     def test_1(self):
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=8100
+        univar_string = """n=8100
         null_cells=0
         null_cells=0
         cells=8100
         cells=8100
         min=102
         min=102
@@ -45,12 +46,13 @@ class TestRasterUnivar(TestCase):
         mean_of_abs=191
         mean_of_abs=191
         sum=1547100"""
         sum=1547100"""
 
 
-        self.assertRasterFitsUnivar(raster="map_a", reference=univar_string,
-                                    precision=3)
+        self.assertRasterFitsUnivar(
+            raster="map_a", reference=univar_string, precision=3
+        )
 
 
     def test_2(self):
     def test_2(self):
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=81
+        univar_string = """n=81
         null_cells=0
         null_cells=0
         cells=81
         cells=81
         min=112
         min=112
@@ -61,9 +63,9 @@ class TestRasterUnivar(TestCase):
         sum=15552"""
         sum=15552"""
 
 
         self.runModule("g.region", res=10)
         self.runModule("g.region", res=10)
-        self.assertRasterFitsUnivar(raster="map_a", reference=univar_string,
-                                    precision=3)
-
+        self.assertRasterFitsUnivar(
+            raster="map_a", reference=univar_string, precision=3
+        )
 
 
     def test_3(self):
     def test_3(self):
         """
         """
@@ -71,7 +73,7 @@ class TestRasterUnivar(TestCase):
         :return:
         :return:
         """
         """
 
 
-        univar_string="""n=8100
+        univar_string = """n=8100
         null_cells=0
         null_cells=0
         cells=8100
         cells=8100
         min=102
         min=102
@@ -82,12 +84,18 @@ class TestRasterUnivar(TestCase):
         sum=1547100"""
         sum=1547100"""
 
 
         self.runModule("g.region", res=10)
         self.runModule("g.region", res=10)
-        self.assertModuleKeyValue(module="r.univar", map="map_a", flags="rg",
-                                  reference=univar_string, precision=3, sep='=')
+        self.assertModuleKeyValue(
+            module="r.univar",
+            map="map_a",
+            flags="rg",
+            reference=univar_string,
+            precision=3,
+            sep="=",
+        )
 
 
     def test_multiple_1(self):
     def test_multiple_1(self):
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=16200
+        univar_string = """n=16200
         null_cells=0
         null_cells=0
         cells=16200
         cells=16200
         min=102
         min=102
@@ -97,12 +105,18 @@ class TestRasterUnivar(TestCase):
         mean_of_abs=241
         mean_of_abs=241
         sum=3904200"""
         sum=3904200"""
 
 
-        self.assertModuleKeyValue(module="r.univar", map=["map_a","map_b"], flags="rg",
-                                  reference=univar_string, precision=3, sep='=')
+        self.assertModuleKeyValue(
+            module="r.univar",
+            map=["map_a", "map_b"],
+            flags="rg",
+            reference=univar_string,
+            precision=3,
+            sep="=",
+        )
 
 
     def test_multiple_2(self):
     def test_multiple_2(self):
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=162
+        univar_string = """n=162
         null_cells=0
         null_cells=0
         cells=162
         cells=162
         min=112
         min=112
@@ -113,9 +127,14 @@ class TestRasterUnivar(TestCase):
         sum=39204"""
         sum=39204"""
 
 
         self.runModule("g.region", res=10)
         self.runModule("g.region", res=10)
-        self.assertModuleKeyValue(module="r.univar", map=["map_a","map_b"], flags="g",
-                                  reference=univar_string, precision=3, sep='=')
-
+        self.assertModuleKeyValue(
+            module="r.univar",
+            map=["map_a", "map_b"],
+            flags="g",
+            reference=univar_string,
+            precision=3,
+            sep="=",
+        )
 
 
     def test_multiple_3(self):
     def test_multiple_3(self):
         """
         """
@@ -124,7 +143,7 @@ class TestRasterUnivar(TestCase):
         """
         """
 
 
         # Output of r.univar
         # Output of r.univar
-        univar_string="""n=16200
+        univar_string = """n=16200
         null_cells=0
         null_cells=0
         cells=16200
         cells=16200
         min=102
         min=102
@@ -135,9 +154,14 @@ class TestRasterUnivar(TestCase):
         sum=3904200"""
         sum=3904200"""
 
 
         self.runModule("g.region", res=10)
         self.runModule("g.region", res=10)
-        self.assertModuleKeyValue(module="r.univar", map=["map_a","map_b"], flags="rg",
-                                  reference=univar_string, precision=3, sep='=')
-
+        self.assertModuleKeyValue(
+            module="r.univar",
+            map=["map_a", "map_b"],
+            flags="rg",
+            reference=univar_string,
+            precision=3,
+            sep="=",
+        )
 
 
     def test_1_zone(self):
     def test_1_zone(self):
         """
         """
@@ -146,7 +170,7 @@ class TestRasterUnivar(TestCase):
         """
         """
 
 
         # Output of r.univar
         # Output of r.univar
-        univar_string="""zone=1;
+        univar_string = """zone=1;
                         n=1710
                         n=1710
                         null_cells=0
                         null_cells=0
                         cells=1710
                         cells=1710
@@ -168,16 +192,24 @@ class TestRasterUnivar(TestCase):
                         sum=1281195"""
                         sum=1281195"""
 
 
         self.runModule("g.region", res=1)
         self.runModule("g.region", res=1)
-        self.assertModuleKeyValue(module="r.univar", map=["map_a"],
-                                  zones="zone_map",flags="g",
-                                  reference=univar_string, precision=3, sep='=')
+        self.assertModuleKeyValue(
+            module="r.univar",
+            map=["map_a"],
+            zones="zone_map",
+            flags="g",
+            reference=univar_string,
+            precision=3,
+            sep="=",
+        )
 
 
-class TestAccumulateFails(TestCase):
 
 
+class TestAccumulateFails(TestCase):
     def test_error_handling(self):
     def test_error_handling(self):
         # No vector map, no strds, no coordinates
         # No vector map, no strds, no coordinates
         self.assertModuleFail("r.univar", flags="r", map="map_a", zones="map_b")
         self.assertModuleFail("r.univar", flags="r", map="map_a", zones="map_b")
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 103 - 56
raster/r.viewshed/testsuite/test_r_viewshed.py

@@ -5,12 +5,12 @@ from grass.gunittest.gmodules import call_module
 
 
 class TestViewshed(TestCase):
 class TestViewshed(TestCase):
 
 
-    viewshed = 'test_viewshed_from_elevation'
+    viewshed = "test_viewshed_from_elevation"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster='elevation')
+        cls.runModule("g.region", raster="elevation")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
@@ -19,33 +19,56 @@ class TestViewshed(TestCase):
     def tearDown(cls):
     def tearDown(cls):
         """Remove viewshed map after each test method"""
         """Remove viewshed map after each test method"""
         # TODO: eventually, removing maps should be handled through testing framework fucntions
         # TODO: eventually, removing maps should be handled through testing framework fucntions
-        cls.runModule('g.remove', flags='f', type='raster',
-                      name=cls.viewshed)
+        cls.runModule("g.remove", flags="f", type="raster", name=cls.viewshed)
 
 
     def test_limits(self):
     def test_limits(self):
         """Test if results is in expected limits"""
         """Test if results is in expected limits"""
-        obs_elev = '1.72'
-        self.assertModule('r.viewshed', input='elevation',
-            coordinates=(634720,216180), output=self.viewshed,
-            observer_elevation=obs_elev)
-        self.assertRasterMinMax(map=self.viewshed, refmin=0, refmax=180,
-                                msg="Viewing angle above the ground must be between 0 and 180 deg")
+        obs_elev = "1.72"
+        self.assertModule(
+            "r.viewshed",
+            input="elevation",
+            coordinates=(634720, 216180),
+            output=self.viewshed,
+            observer_elevation=obs_elev,
+        )
+        self.assertRasterMinMax(
+            map=self.viewshed,
+            refmin=0,
+            refmax=180,
+            msg="Viewing angle above the ground must be between 0 and 180 deg",
+        )
 
 
     def test_limits_flags(self):
     def test_limits_flags(self):
-        obs_elev = '1.72'
+        obs_elev = "1.72"
         # test e flag
         # test e flag
-        self.assertModule('r.viewshed', input='elevation', flags='e',
-                          coordinates=(634720, 216180), output=self.viewshed,
-                          observer_elevation=obs_elev)
-        minmax = 'null_cells=1963758\nmin=-24.98421\nmax=43.15356'
-        self.assertRasterFitsUnivar(raster=self.viewshed, reference=minmax, precision=1e-5)
+        self.assertModule(
+            "r.viewshed",
+            input="elevation",
+            flags="e",
+            coordinates=(634720, 216180),
+            output=self.viewshed,
+            observer_elevation=obs_elev,
+        )
+        minmax = "null_cells=1963758\nmin=-24.98421\nmax=43.15356"
+        self.assertRasterFitsUnivar(
+            raster=self.viewshed, reference=minmax, precision=1e-5
+        )
         # test b flag (#1788)
         # test b flag (#1788)
-        self.assertModule('r.viewshed', input='elevation', flags='b',
-                          coordinates=(634720, 216180), output=self.viewshed,
-                          observer_elevation=obs_elev, overwrite=True)
-        minmax = 'min=0\nmax=1\ndatatype=CELL'
-        self.assertRasterFitsInfo(raster=self.viewshed, reference=minmax,
-                                  msg="Values of binary output must be 0 or 1")
+        self.assertModule(
+            "r.viewshed",
+            input="elevation",
+            flags="b",
+            coordinates=(634720, 216180),
+            output=self.viewshed,
+            observer_elevation=obs_elev,
+            overwrite=True,
+        )
+        minmax = "min=0\nmax=1\ndatatype=CELL"
+        self.assertRasterFitsInfo(
+            raster=self.viewshed,
+            reference=minmax,
+            msg="Values of binary output must be 0 or 1",
+        )
 
 
     def test_limits_extreme_value(self):
     def test_limits_extreme_value(self):
         """Test extremely high observer elevation
         """Test extremely high observer elevation
@@ -53,22 +76,36 @@ class TestViewshed(TestCase):
         Unfortunatelly, this takes very long time to compute
         Unfortunatelly, this takes very long time to compute
         (something like ten times more).
         (something like ten times more).
         """
         """
-        obs_elev = '500000'
-        self.assertModule('r.viewshed', input='elevation',
-            coordinates=(634720,216180), output=self.viewshed,
-            observer_elevation=obs_elev)
-        self.assertRasterMinMax(map=self.viewshed, refmin=0, refmax=180,
-            msg="Viewing angle above the ground must be between 0 and 180 deg")
+        obs_elev = "500000"
+        self.assertModule(
+            "r.viewshed",
+            input="elevation",
+            coordinates=(634720, 216180),
+            output=self.viewshed,
+            observer_elevation=obs_elev,
+        )
+        self.assertRasterMinMax(
+            map=self.viewshed,
+            refmin=0,
+            refmax=180,
+            msg="Viewing angle above the ground must be between 0 and 180 deg",
+        )
 
 
     def test_direction(self):
     def test_direction(self):
-        """Test direction range
-        """
-        obs_elev = '1.75'
-        self.assertModule('r.viewshed', input='elevation',
-            coordinates=(634720,216180), output=self.viewshed,
-            observer_elevation=obs_elev, direction_range=[270, 90])
-        minmax = 'null_cells=1998900\nmin=74.90344\nmax=180'
-        self.assertRasterFitsUnivar(raster=self.viewshed, reference=minmax, precision=1e-5)
+        """Test direction range"""
+        obs_elev = "1.75"
+        self.assertModule(
+            "r.viewshed",
+            input="elevation",
+            coordinates=(634720, 216180),
+            output=self.viewshed,
+            observer_elevation=obs_elev,
+            direction_range=[270, 90],
+        )
+        minmax = "null_cells=1998900\nmin=74.90344\nmax=180"
+        self.assertRasterFitsUnivar(
+            raster=self.viewshed, reference=minmax, precision=1e-5
+        )
 
 
 
 
 class TestViewshedAgainstReference(TestCase):
 class TestViewshedAgainstReference(TestCase):
@@ -94,41 +131,51 @@ class TestViewshedAgainstReference(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=216990, s=215520, e=635950, w=633730, res=10)
-        cls.elevation = 'ref_elevation'
-        cls.runModule('r.in.ascii', input='data/elevation.ascii',
-                       output=cls.elevation)
+        cls.runModule("g.region", n=216990, s=215520, e=635950, w=633730, res=10)
+        cls.elevation = "ref_elevation"
+        cls.runModule("r.in.ascii", input="data/elevation.ascii", output=cls.elevation)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', flags='f', type='raster',
-                      name=cls.elevation)
+        cls.runModule("g.remove", flags="f", type="raster", name=cls.elevation)
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='raster',
-                          name=','.join(cls.to_remove))
+            cls.runModule(
+                "g.remove", flags="f", type="raster", name=",".join(cls.to_remove)
+            )
 
 
     def test_viewshed(self):
     def test_viewshed(self):
-        ref_viewshed = 'reference_viewshed'
-        viewshed = 'actual_viewshed'
-        obs_elev = '1.72'
+        ref_viewshed = "reference_viewshed"
+        viewshed = "actual_viewshed"
+        obs_elev = "1.72"
 
 
-        self.runModule('r.in.ascii',
-                       input='data/lake_viewshed.ascii', output=ref_viewshed)
+        self.runModule(
+            "r.in.ascii", input="data/lake_viewshed.ascii", output=ref_viewshed
+        )
         self.to_remove.append(ref_viewshed)
         self.to_remove.append(ref_viewshed)
 
 
-        self.assertModule('r.viewshed', input=self.elevation,
-                          coordinates=(634720,216180), output=viewshed, observer_elevation=obs_elev)
+        self.assertModule(
+            "r.viewshed",
+            input=self.elevation,
+            coordinates=(634720, 216180),
+            output=viewshed,
+            observer_elevation=obs_elev,
+        )
         self.to_remove.append(viewshed)
         self.to_remove.append(viewshed)
 
 
         # check we have expected values
         # check we have expected values
-        self.assertRasterMinMax(map=viewshed, refmin=0, refmax=180,
-                                msg="Viewshed in degrees must be between 0 and 180")
+        self.assertRasterMinMax(
+            map=viewshed,
+            refmin=0,
+            refmax=180,
+            msg="Viewshed in degrees must be between 0 and 180",
+        )
         # check against reference data
         # check against reference data
-        self.assertRastersNoDifference(actual=viewshed, reference=ref_viewshed,
-                                       precision=self.precision)
+        self.assertRastersNoDifference(
+            actual=viewshed, reference=ref_viewshed, precision=self.precision
+        )
         # TODO: add self.assertRasterFitsUnivar()
         # TODO: add self.assertRasterFitsUnivar()
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 119 - 63
raster/r.watershed/testsuite/r_watershed_test.py

@@ -18,23 +18,23 @@ class TestWatershed(TestCase):
     """Test case for watershed module"""
     """Test case for watershed module"""
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    accumulation = 'test_accumulation'
-    drainage = 'test_drainage'
-    basin = 'test_basin'
-    stream = 'test_stream'
-    halfbasin = 'test_halfbasin'
-    slopelength = 'test_slopelength'
-    slopesteepness = 'test_slopesteepness'
-    elevation = 'elevation'
-    lengthslope_2 = 'test_lengthslope_2'
-    stream_2 = 'test_stream_2'
+    accumulation = "test_accumulation"
+    drainage = "test_drainage"
+    basin = "test_basin"
+    stream = "test_stream"
+    halfbasin = "test_halfbasin"
+    slopelength = "test_slopelength"
+    slopesteepness = "test_slopesteepness"
+    elevation = "elevation"
+    lengthslope_2 = "test_lengthslope_2"
+    stream_2 = "test_stream_2"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and setup"""
         """Ensures expected computational region and setup"""
         # Always use the computational region of the raster elevation
         # Always use the computational region of the raster elevation
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.elevation)
+        cls.runModule("g.region", raster=cls.elevation)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
@@ -46,42 +46,58 @@ class TestWatershed(TestCase):
 
 
         This is executed after each test run.
         This is executed after each test run.
         """
         """
-        self.runModule('g.remove', flags='f', type='raster',
-                       name=[self.accumulation, self.drainage,
-                             self.basin, self.stream,
-                             self.halfbasin, self.slopelength,
-                             self.slopesteepness, self.lengthslope_2,
-                             self.stream_2])
+        self.runModule(
+            "g.remove",
+            flags="f",
+            type="raster",
+            name=[
+                self.accumulation,
+                self.drainage,
+                self.basin,
+                self.stream,
+                self.halfbasin,
+                self.slopelength,
+                self.slopesteepness,
+                self.lengthslope_2,
+                self.stream_2,
+            ],
+        )
 
 
     def test_OutputCreated(self):
     def test_OutputCreated(self):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
         # run the watershed module
         # run the watershed module
-        self.assertModule('r.watershed', elevation=self.elevation,
-                          threshold='10000', accumulation=self.accumulation,
-                          drainage=self.drainage, basin=self.basin, stream=self.stream,
-                          half_basin=self.halfbasin, length_slope=self.slopelength,
-                          slope_steepness=self.slopesteepness)
+        self.assertModule(
+            "r.watershed",
+            elevation=self.elevation,
+            threshold="10000",
+            accumulation=self.accumulation,
+            drainage=self.drainage,
+            basin=self.basin,
+            stream=self.stream,
+            half_basin=self.halfbasin,
+            length_slope=self.slopelength,
+            slope_steepness=self.slopesteepness,
+        )
         # check to see if accumulation output is in mapset
         # check to see if accumulation output is in mapset
-        self.assertRasterExists(self.accumulation,
-                                msg='accumulation output was not created')
+        self.assertRasterExists(
+            self.accumulation, msg="accumulation output was not created"
+        )
         # check to see if drainage output is in mapset
         # check to see if drainage output is in mapset
-        self.assertRasterExists(self.drainage,
-                                msg='drainage output was not created')
+        self.assertRasterExists(self.drainage, msg="drainage output was not created")
         # check to see if basin output is in mapset
         # check to see if basin output is in mapset
-        self.assertRasterExists(self.basin,
-                                msg='basin output was not created')
+        self.assertRasterExists(self.basin, msg="basin output was not created")
         # check to see if stream output is in mapset
         # check to see if stream output is in mapset
-        self.assertRasterExists(self.stream,
-                                msg='stream output was not created')
+        self.assertRasterExists(self.stream, msg="stream output was not created")
         # check to see if half.basin output is in mapset
         # check to see if half.basin output is in mapset
-        self.assertRasterExists(self.halfbasin,
-                                msg='half.basin output was not created')
+        self.assertRasterExists(self.halfbasin, msg="half.basin output was not created")
         # check to see if length.slope output is in mapset
         # check to see if length.slope output is in mapset
-        self.assertRasterExists(self.slopelength,
-                                msg='length.slope output was not created')
+        self.assertRasterExists(
+            self.slopelength, msg="length.slope output was not created"
+        )
         # check to see if slope.steepness output is in mapset
         # check to see if slope.steepness output is in mapset
-        self.assertRasterExists(self.slopesteepness,
-                                msg='slope.steepness output was not created')
+        self.assertRasterExists(
+            self.slopesteepness, msg="slope.steepness output was not created"
+        )
 
 
     def test_fourFlag(self):
     def test_fourFlag(self):
         """Test the -4 flag and the stream and slope lengths
         """Test the -4 flag and the stream and slope lengths
@@ -91,64 +107,104 @@ class TestWatershed(TestCase):
         module run.
         module run.
         """
         """
         # Run module with default settings
         # Run module with default settings
-        self.assertModule('r.watershed', elevation=self.elevation,
-                          threshold='10000', stream=self.stream,
-                          length_slope=self.slopelength, overwrite=True)
+        self.assertModule(
+            "r.watershed",
+            elevation=self.elevation,
+            threshold="10000",
+            stream=self.stream,
+            length_slope=self.slopelength,
+            overwrite=True,
+        )
         # Run module with flag 4
         # Run module with flag 4
-        self.assertModule('r.watershed', flags='4', elevation='elevation',
-                          threshold='10000', stream=self.stream_2,
-                          length_slope=self.lengthslope_2)
+        self.assertModule(
+            "r.watershed",
+            flags="4",
+            elevation="elevation",
+            threshold="10000",
+            stream=self.stream_2,
+            length_slope=self.lengthslope_2,
+        )
         # Use the assertRastersNoDifference with precsion 100 to see if close
         # Use the assertRastersNoDifference with precsion 100 to see if close
         # Compare stream output
         # Compare stream output
         self.assertRastersNoDifference(self.stream_2, self.stream, 100)
         self.assertRastersNoDifference(self.stream_2, self.stream, 100)
         # Compare length_slope output
         # Compare length_slope output
-        self.assertRastersNoDifference(self.lengthslope_2,
-                                       self.slopelength, 10)
+        self.assertRastersNoDifference(self.lengthslope_2, self.slopelength, 10)
 
 
     def test_watershedThreadholdfail(self):
     def test_watershedThreadholdfail(self):
         """Test if threshold of 0 or a negative is accepted
         """Test if threshold of 0 or a negative is accepted
 
 
         The module should fail in this test, if it fails, test succeeds.
         The module should fail in this test, if it fails, test succeeds.
         """
         """
-        self.assertModuleFail('r.watershed', elevation=self.elevation,
-                              threshold='0', stream=self.stream, overwrite=True,
-                              msg='Threshold value of 0 considered valid.')
-        self.assertModuleFail('r.watershed', elevation=self.elevation,
-                              threshold='-1', stream=self.stream, overwrite=True,
-                              msg='Threshold value of 0 considered valid.')
+        self.assertModuleFail(
+            "r.watershed",
+            elevation=self.elevation,
+            threshold="0",
+            stream=self.stream,
+            overwrite=True,
+            msg="Threshold value of 0 considered valid.",
+        )
+        self.assertModuleFail(
+            "r.watershed",
+            elevation=self.elevation,
+            threshold="-1",
+            stream=self.stream,
+            overwrite=True,
+            msg="Threshold value of 0 considered valid.",
+        )
 
 
     def test_thresholdsize(self):
     def test_thresholdsize(self):
         """Test the expected range of basin output values"""
         """Test the expected range of basin output values"""
-        self.assertModule('r.watershed', elevation=self.elevation,
-                          threshold='100000', basin=self.basin, overwrite=True)
+        self.assertModule(
+            "r.watershed",
+            elevation=self.elevation,
+            threshold="100000",
+            basin=self.basin,
+            overwrite=True,
+        )
         # it is expected that 100k Threshold has a min=2 and max=12 for this
         # it is expected that 100k Threshold has a min=2 and max=12 for this
         # data
         # data
         self.assertRasterMinMax(self.basin, 2, 12)
         self.assertRasterMinMax(self.basin, 2, 12)
         # it is expected that 100k Threshold has a min=2 and max=256 for this
         # it is expected that 100k Threshold has a min=2 and max=256 for this
         # data
         # data
-        self.assertModule('r.watershed', elevation=self.elevation,
-                          threshold='10000', basin=self.basin, overwrite=True)
+        self.assertModule(
+            "r.watershed",
+            elevation=self.elevation,
+            threshold="10000",
+            basin=self.basin,
+            overwrite=True,
+        )
         self.assertRasterMinMax(self.basin, 2, 256)
         self.assertRasterMinMax(self.basin, 2, 256)
 
 
     def test_drainageDirection(self):
     def test_drainageDirection(self):
         """Test if the drainage direction is between -8 and 8."""
         """Test if the drainage direction is between -8 and 8."""
-        self.assertModule('r.watershed', elevation=self.elevation,
-                          threshold='100000', drainage=self.drainage)
+        self.assertModule(
+            "r.watershed",
+            elevation=self.elevation,
+            threshold="100000",
+            drainage=self.drainage,
+        )
         # Make sure the min/max is between -8 and 8
         # Make sure the min/max is between -8 and 8
-        self.assertRasterMinMax(self.drainage, -8, 8,
-                                msg='Direction must be between -8 and 8')
+        self.assertRasterMinMax(
+            self.drainage, -8, 8, msg="Direction must be between -8 and 8"
+        )
 
 
     def test_basinValue(self):
     def test_basinValue(self):
         """Check to see if the basin value is 0 or greater"""
         """Check to see if the basin value is 0 or greater"""
-        self.assertModule('r.watershed', elevation=self.elevation,
-                          threshold='10000', basin=self.basin)
+        self.assertModule(
+            "r.watershed", elevation=self.elevation, threshold="10000", basin=self.basin
+        )
         # Make sure the minimum value is 0 for basin value representing unique
         # Make sure the minimum value is 0 for basin value representing unique
         # positive integer.
         # positive integer.
         # TODO: test just min, max is theoretically unlimited
         # TODO: test just min, max is theoretically unlimited
         # or set a lower value according to what is expected with this data
         # or set a lower value according to what is expected with this data
         # TODO: add test which tests that 'max basin id' == 'num of basins'
         # TODO: add test which tests that 'max basin id' == 'num of basins'
-        self.assertRasterMinMax(self.basin, 0, 1000000,
-                                msg='A basin value is less than 0 or greater than 1000000')
+        self.assertRasterMinMax(
+            self.basin,
+            0,
+            1000000,
+            msg="A basin value is less than 0 or greater than 1000000",
+        )
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

File diff suppressed because it is too large
+ 548 - 516
raster/r.what/testsuite/test_r_what.py


+ 41 - 24
raster/r.what/testsuite/testrw.py

@@ -12,83 +12,100 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
+
 class Testrr(TestCase):
 class Testrr(TestCase):
-    input='elevation'
-    coordinates=(633614.08,224125.12,632972.36,225382.87)
-    points='comm_colleges'
+    input = "elevation"
+    coordinates = (633614.08, 224125.12, 632972.36, 225382.87)
+    points = "comm_colleges"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster=cls.input, flags='p')
+        cls.runModule("g.region", raster=cls.input, flags="p")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
-
     def test_flag_n(self):
     def test_flag_n(self):
         """Testing output with flag n"""
         """Testing output with flag n"""
-        string="""1|145096.8591495|154534.264883875||*
+        string = """1|145096.8591495|154534.264883875||*
         2|616341.4371495|146049.750883875||*
         2|616341.4371495|146049.750883875||*
         3|410595.7191495|174301.828883875||*
         3|410595.7191495|174301.828883875||*
         4|734153.6871495|169168.437883875||*
         4|734153.6871495|169168.437883875||*
         """
         """
-        r_what = SimpleModule('r.what', map=self.input, coordinates=self.coordinates, flags='n')
-        r_what.outputs.stdout= string
+        r_what = SimpleModule(
+            "r.what", map=self.input, coordinates=self.coordinates, flags="n"
+        )
+        r_what.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
 
 
     def test_flag_f(self):
     def test_flag_f(self):
         """Testing output with flag f"""
         """Testing output with flag f"""
-        string="""5|706338.2501495|54889.417883875||*
+        string = """5|706338.2501495|54889.417883875||*
         6|758009.7501495|112019.898883875||*
         6|758009.7501495|112019.898883875||*
         7|754002.7501495|200902.234883875||*
         7|754002.7501495|200902.234883875||*
         8|704771.7501495|183364.484883875||*"""
         8|704771.7501495|183364.484883875||*"""
-        r_what = SimpleModule('r.what', map=self.input, coordinates=self.coordinates, flags='f')
-        r_what.outputs.stdout= string
+        r_what = SimpleModule(
+            "r.what", map=self.input, coordinates=self.coordinates, flags="f"
+        )
+        r_what.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
 
 
     def test_flag_r(self):
     def test_flag_r(self):
         """Testing output with flag r"""
         """Testing output with flag r"""
-        string="""9|399187.0631495|220018.859883875||*
+        string = """9|399187.0631495|220018.859883875||*
         10|685098.9371495|33282.089883875||*
         10|685098.9371495|33282.089883875||*
         11|577750.8131495|257153.109883875||*
         11|577750.8131495|257153.109883875||*
         12|794095.5621495|199742.671883875||*"""
         12|794095.5621495|199742.671883875||*"""
-        r_what = SimpleModule('r.what', map=self.input, coordinates=self.coordinates, flags='r')
-        r_what.outputs.stdout= string
+        r_what = SimpleModule(
+            "r.what", map=self.input, coordinates=self.coordinates, flags="r"
+        )
+        r_what.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
 
 
     def test_flag_i(self):
     def test_flag_i(self):
         """Testing output with flag i"""
         """Testing output with flag i"""
-        string="""13|634688.2501495|100629.616883875||*
+        string = """13|634688.2501495|100629.616883875||*
         14|287638.7811495|207582.624883875||*
         14|287638.7811495|207582.624883875||*
         15|366218.5321495|222940.625883875||*
         15|366218.5321495|222940.625883875||*
         16|385212.4371495|236593.109883875||*"""
         16|385212.4371495|236593.109883875||*"""
-        r_what = SimpleModule('r.what', map=self.input, coordinates=self.coordinates, flags='i')
-        r_what.outputs.stdout= string
+        r_what = SimpleModule(
+            "r.what", map=self.input, coordinates=self.coordinates, flags="i"
+        )
+        r_what.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
 
 
     def test_flag_c(self):
     def test_flag_c(self):
         """Testing output with flag c"""
         """Testing output with flag c"""
-        string="""17|628137.4371495|63995.550883875||*
+        string = """17|628137.4371495|63995.550883875||*
         18|782600.5631495|152698.890883875||*
         18|782600.5631495|152698.890883875||*
         19|502813.9381495|235232.577883875||*
         19|502813.9381495|235232.577883875||*
         20|705922.6251495|136589.359883875||*"""
         20|705922.6251495|136589.359883875||*"""
-        r_what = SimpleModule('r.what', map=self.input, coordinates=self.coordinates, flags='c')
-        r_what.outputs.stdout= string
+        r_what = SimpleModule(
+            "r.what", map=self.input, coordinates=self.coordinates, flags="c"
+        )
+        r_what.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
 
 
     def test_flag_v(self):
     def test_flag_v(self):
         """Testing output with flag v"""
         """Testing output with flag v"""
-        string="""21|620397.8131495|246847.640883875||*
+        string = """21|620397.8131495|246847.640883875||*
         22|738465.3751495|237233.983883875||*
         22|738465.3751495|237233.983883875||*
         23|708944.7501495|247632.296883875||*
         23|708944.7501495|247632.296883875||*
         24|526666.6871495|249780.312883875||*"""
         24|526666.6871495|249780.312883875||*"""
-        r_what = SimpleModule('r.what', map=self.input, coordinates=self.coordinates, flags='v', points=self.points)
-        r_what.outputs.stdout= string
+        r_what = SimpleModule(
+            "r.what",
+            map=self.input,
+            coordinates=self.coordinates,
+            flags="v",
+            points=self.points,
+        )
+        r_what.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
         self.assertLooksLike(reference=string, actual=r_what.outputs.stdout)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 90 - 37
raster3d/r3.flow/testsuite/r3flow_test.py

@@ -36,8 +36,8 @@ coeff_var=177.119169754436
 sum=3064
 sum=3064
 """
 """
 
 
-class FlowlineTest(TestCase):
 
 
+class FlowlineTest(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
@@ -47,51 +47,104 @@ class FlowlineTest(TestCase):
         cls.runModule("r3.mapcalc", expression="map_2 = -20")
         cls.runModule("r3.mapcalc", expression="map_2 = -20")
         cls.runModule("r3.mapcalc", expression="map_3 = 0.01")
         cls.runModule("r3.mapcalc", expression="map_3 = 0.01")
         cls.runModule("r3.mapcalc", expression="map_4 = col() + row() + depth()")
         cls.runModule("r3.mapcalc", expression="map_4 = col() + row() + depth()")
-        cls.runModule("r3.mapcalc", expression="map_5 = col() * col() + row() * row() + depth() * depth()")
-        cls.runModule('v.in.ascii', input='-', output='test_seeds', z=3, flags='zt',
-                      stdin=seeds)
+        cls.runModule(
+            "r3.mapcalc",
+            expression="map_5 = col() * col() + row() * row() + depth() * depth()",
+        )
+        cls.runModule(
+            "v.in.ascii", input="-", output="test_seeds", z=3, flags="zt", stdin=seeds
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """!Remove the temporary region"""
         """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', flags='f', type='raster_3d', name=','.join(['map_1', 'map_2', 'map_3', 'map_4', 'map_5', 'test_flowaccum']))
-        cls.runModule('g.remove', flags='f', type='vector', name=','.join(['test_flowline', 'test_seeds']))
-        os.remove('./data/flowline_tmp.ascii')
+        cls.runModule(
+            "g.remove",
+            flags="f",
+            type="raster_3d",
+            name=",".join(
+                ["map_1", "map_2", "map_3", "map_4", "map_5", "test_flowaccum"]
+            ),
+        )
+        cls.runModule(
+            "g.remove",
+            flags="f",
+            type="vector",
+            name=",".join(["test_flowline", "test_seeds"]),
+        )
+        os.remove("./data/flowline_tmp.ascii")
 
 
     def test_interpolation(self):
     def test_interpolation(self):
-        self.assertModuleKeyValue('test.r3flow', test='interpolation',
-                                  coordinates=[100, 55, 11], input=['map_1', 'map_2', 'map_3'],
-                                  reference={'return': 0, 'values': [100, -20, 0.01]},
-                                  precision=1e-10, sep='=')
-        self.assertModuleKeyValue('test.r3flow', test='interpolation',
-                                  coordinates=[5, 5, 5], input=['map_1', 'map_2', 'map_3'],
-                                  reference={'return': 0, 'values': [100, -20, 0.01]},
-                                  precision=1e-10, sep='=')
-        self.assertModuleKeyValue('test.r3flow', test='interpolation',
-                                  coordinates=[10, 10, 60], input=['map_1', 'map_2', 'map_3'],
-                                  reference={'return': -1},
-                                  precision=1e-10, sep='=')
-        self.assertModuleKeyValue('test.r3flow', test='interpolation',
-                                  coordinates=[25, 69, 17], input=['map_4', 'map_4', 'map_4'],
-                                  reference={'return': 0, 'values': [7.8, 7.8, 7.8]},
-                                  precision=1e-10, sep='=')
-        self.assertModuleKeyValue('test.r3flow', test='interpolation',
-                                  coordinates=[81, 30, 25], input=['map_4', 'map_4', 'map_4'],
-                                  reference={'return': 0, 'values': [18.1, 18.1, 18.1]},
-                                  precision=1e-10, sep='=')
+        self.assertModuleKeyValue(
+            "test.r3flow",
+            test="interpolation",
+            coordinates=[100, 55, 11],
+            input=["map_1", "map_2", "map_3"],
+            reference={"return": 0, "values": [100, -20, 0.01]},
+            precision=1e-10,
+            sep="=",
+        )
+        self.assertModuleKeyValue(
+            "test.r3flow",
+            test="interpolation",
+            coordinates=[5, 5, 5],
+            input=["map_1", "map_2", "map_3"],
+            reference={"return": 0, "values": [100, -20, 0.01]},
+            precision=1e-10,
+            sep="=",
+        )
+        self.assertModuleKeyValue(
+            "test.r3flow",
+            test="interpolation",
+            coordinates=[10, 10, 60],
+            input=["map_1", "map_2", "map_3"],
+            reference={"return": -1},
+            precision=1e-10,
+            sep="=",
+        )
+        self.assertModuleKeyValue(
+            "test.r3flow",
+            test="interpolation",
+            coordinates=[25, 69, 17],
+            input=["map_4", "map_4", "map_4"],
+            reference={"return": 0, "values": [7.8, 7.8, 7.8]},
+            precision=1e-10,
+            sep="=",
+        )
+        self.assertModuleKeyValue(
+            "test.r3flow",
+            test="interpolation",
+            coordinates=[81, 30, 25],
+            input=["map_4", "map_4", "map_4"],
+            reference={"return": 0, "values": [18.1, 18.1, 18.1]},
+            precision=1e-10,
+            sep="=",
+        )
 
 
     def test_flowlines(self):
     def test_flowlines(self):
-        self.assertModule('r3.flow', input='map_5', flowline='test_flowline',
-                          seed_points='test_seeds', flowaccumulation='test_flowaccum',
-                          direction='down')
-        self.runModule('v.out.ascii', input='test_flowline',
-                       format='standard', output='./data/flowline_tmp.ascii',
-                       precision=6)
-        self.assertVectorAsciiEqualsVectorAscii(actual='./data/flowline_tmp.ascii',
-                                                reference='./data/flowline.ascii')
-        self.assertRaster3dFitsUnivar('test_flowaccum', reference=flowaccum, precision=1e-6)
+        self.assertModule(
+            "r3.flow",
+            input="map_5",
+            flowline="test_flowline",
+            seed_points="test_seeds",
+            flowaccumulation="test_flowaccum",
+            direction="down",
+        )
+        self.runModule(
+            "v.out.ascii",
+            input="test_flowline",
+            format="standard",
+            output="./data/flowline_tmp.ascii",
+            precision=6,
+        )
+        self.assertVectorAsciiEqualsVectorAscii(
+            actual="./data/flowline_tmp.ascii", reference="./data/flowline.ascii"
+        )
+        self.assertRaster3dFitsUnivar(
+            "test_flowaccum", reference=flowaccum, precision=1e-6
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 92 - 39
raster3d/r3.gradient/testsuite/r3gradient_test.py

@@ -101,60 +101,113 @@ sum=396
 
 
 
 
 class GradientTest(TestCase):
 class GradientTest(TestCase):
-
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Use temporary region settings"""
         """Use temporary region settings"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', res3=10, n=100, s=0, w=0, e=120, b=0, t=50)
-        cls.runModule('r3.in.ascii', input='data/test_map_1', output='test_map_1_ref')
-        cls.runModule('g.region', res3=1, n=5, s=0, w=0, e=5, b=0, t=5)
-        cls.runModule('r3.in.ascii', input='data/test_map_2', output='test_map_2_ref')
+        cls.runModule("g.region", res3=10, n=100, s=0, w=0, e=120, b=0, t=50)
+        cls.runModule("r3.in.ascii", input="data/test_map_1", output="test_map_1_ref")
+        cls.runModule("g.region", res3=1, n=5, s=0, w=0, e=5, b=0, t=5)
+        cls.runModule("r3.in.ascii", input="data/test_map_2", output="test_map_2_ref")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """!Remove the temporary region"""
         """!Remove the temporary region"""
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', flags='f', type='raster_3d',
-                      name=','.join(['test_map_1_ref', 'test_map_2_ref',
-                                        'test_grad_x', 'test_grad_y',
-                                        'test_grad_z', 'test_null_grad_x',
-                                        'test_null_grad_y', 'test_null_grad_z']))
+        cls.runModule(
+            "g.remove",
+            flags="f",
+            type="raster_3d",
+            name=",".join(
+                [
+                    "test_map_1_ref",
+                    "test_map_2_ref",
+                    "test_grad_x",
+                    "test_grad_y",
+                    "test_grad_z",
+                    "test_null_grad_x",
+                    "test_null_grad_y",
+                    "test_null_grad_z",
+                ]
+            ),
+        )
 
 
     def test_gradient_runs(self):
     def test_gradient_runs(self):
-        self.runModule('g.region', res3=10, n=100, s=0, w=0, e=120, b=0, t=50)
-        self.assertModuleFail('r3.gradient', input='test_map_1_ref',
-                              output=['test_grad_x', 'test_grad_y'], overwrite=True)
-        self.assertModule('r3.gradient', input='test_map_1_ref',
-                          output=['test_grad_x', 'test_grad_y', 'test_grad_z'], overwrite=True)
+        self.runModule("g.region", res3=10, n=100, s=0, w=0, e=120, b=0, t=50)
+        self.assertModuleFail(
+            "r3.gradient",
+            input="test_map_1_ref",
+            output=["test_grad_x", "test_grad_y"],
+            overwrite=True,
+        )
+        self.assertModule(
+            "r3.gradient",
+            input="test_map_1_ref",
+            output=["test_grad_x", "test_grad_y", "test_grad_z"],
+            overwrite=True,
+        )
 
 
     def test_gradient(self):
     def test_gradient(self):
-        self.runModule('g.region', res3=10, n=100, s=0, w=0, e=120, b=0, t=50)
-        self.runModule('r3.gradient', input='test_map_1_ref',
-                       output=['test_grad_x', 'test_grad_y', 'test_grad_z'], overwrite=True)
-        self.assertRaster3dFitsUnivar(raster='test_grad_x', reference=r3univar_test_grad_x, precision=1e-8)
-        self.assertRaster3dFitsUnivar(raster='test_grad_y', reference=r3univar_test_grad_y, precision=1e-8)
-        self.assertRaster3dFitsUnivar(raster='test_grad_z', reference=r3univar_test_grad_z, precision=1e-8)
+        self.runModule("g.region", res3=10, n=100, s=0, w=0, e=120, b=0, t=50)
+        self.runModule(
+            "r3.gradient",
+            input="test_map_1_ref",
+            output=["test_grad_x", "test_grad_y", "test_grad_z"],
+            overwrite=True,
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_grad_x", reference=r3univar_test_grad_x, precision=1e-8
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_grad_y", reference=r3univar_test_grad_y, precision=1e-8
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_grad_z", reference=r3univar_test_grad_z, precision=1e-8
+        )
 
 
     def test_gradient_block(self):
     def test_gradient_block(self):
-        self.runModule('g.region', res3=10, n=100, s=0, w=0, e=120, b=0, t=50)
-        self.assertModule('r3.gradient', input='test_map_1_ref', blocksize=[200, 2, 50],
-                          output=['test_grad_x', 'test_grad_y', 'test_grad_z'], overwrite=True)
-        self.assertRaster3dFitsUnivar(raster='test_grad_x', reference=r3univar_test_grad_x, precision=1e-8)
-        self.assertRaster3dFitsUnivar(raster='test_grad_y', reference=r3univar_test_grad_y, precision=1e-8)
-        self.assertRaster3dFitsUnivar(raster='test_grad_z', reference=r3univar_test_grad_z, precision=1e-8)
+        self.runModule("g.region", res3=10, n=100, s=0, w=0, e=120, b=0, t=50)
+        self.assertModule(
+            "r3.gradient",
+            input="test_map_1_ref",
+            blocksize=[200, 2, 50],
+            output=["test_grad_x", "test_grad_y", "test_grad_z"],
+            overwrite=True,
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_grad_x", reference=r3univar_test_grad_x, precision=1e-8
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_grad_y", reference=r3univar_test_grad_y, precision=1e-8
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_grad_z", reference=r3univar_test_grad_z, precision=1e-8
+        )
 
 
     def test_gradient_nulls(self):
     def test_gradient_nulls(self):
-        self.runModule('g.region', res3=1, n=5, s=0, w=0, e=5, b=0, t=5)
-        self.assertModule('r3.gradient', input='test_map_2_ref', blocksize=[200, 2, 50],
-                          output=['test_null_grad_x', 'test_null_grad_y', 'test_null_grad_z'])
-        self.assertRaster3dFitsUnivar(raster='test_null_grad_x',
-                                      reference=r3univar_test_nulls_grad_x, precision=1e-8)
-        self.assertRaster3dFitsUnivar(raster='test_null_grad_y',
-                                      reference=r3univar_test_nulls_grad_y, precision=1e-8)
-        self.assertRaster3dFitsUnivar(raster='test_null_grad_z',
-                                      reference=r3univar_test_nulls_grad_z, precision=1e-8)
-
-
-if __name__ == '__main__':
+        self.runModule("g.region", res3=1, n=5, s=0, w=0, e=5, b=0, t=5)
+        self.assertModule(
+            "r3.gradient",
+            input="test_map_2_ref",
+            blocksize=[200, 2, 50],
+            output=["test_null_grad_x", "test_null_grad_y", "test_null_grad_z"],
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_null_grad_x",
+            reference=r3univar_test_nulls_grad_x,
+            precision=1e-8,
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_null_grad_y",
+            reference=r3univar_test_nulls_grad_y,
+            precision=1e-8,
+        )
+        self.assertRaster3dFitsUnivar(
+            raster="test_null_grad_z",
+            reference=r3univar_test_nulls_grad_z,
+            precision=1e-8,
+        )
+
+
+if __name__ == "__main__":
     test()
     test()

+ 38 - 28
raster3d/r3.to.rast/testsuite/test_a_b_coeff.py

@@ -101,60 +101,70 @@ class TestR3ToRast(TestCase):
     # mixing class and object attributes
     # mixing class and object attributes
     to_remove_3d = []
     to_remove_3d = []
     to_remove_2d = []
     to_remove_2d = []
-    rast3d = 'r3_to_rast_test_a_b_coeff'
-    rast2d = 'r3_to_rast_test_a_b_coeff'
-    rast2d_ref = 'r3_to_rast_test_a_b_coeff_ref'
+    rast3d = "r3_to_rast_test_a_b_coeff"
+    rast2d = "r3_to_rast_test_a_b_coeff"
+    rast2d_ref = "r3_to_rast_test_a_b_coeff_ref"
     rast2d_refs = []
     rast2d_refs = []
 
 
     def setUp(self):
     def setUp(self):
         self.use_temp_region()
         self.use_temp_region()
-        self.runModule('r3.in.ascii', input='-', stdin_=INPUT,
-                       output=self.rast3d)
+        self.runModule("r3.in.ascii", input="-", stdin_=INPUT, output=self.rast3d)
         self.to_remove_3d.append(self.rast3d)
         self.to_remove_3d.append(self.rast3d)
-        self.runModule('g.region', raster_3d=self.rast3d)
+        self.runModule("g.region", raster_3d=self.rast3d)
 
 
         for i, data in enumerate(OUTPUTS):
         for i, data in enumerate(OUTPUTS):
             rast = "%s_%d" % (self.rast2d_ref, i)
             rast = "%s_%d" % (self.rast2d_ref, i)
-            self.runModule('r.in.ascii', input='-', stdin_=data,
-                           output=rast)
+            self.runModule("r.in.ascii", input="-", stdin_=data, output=rast)
             self.to_remove_2d.append(rast)
             self.to_remove_2d.append(rast)
             self.rast2d_refs.append(rast)
             self.rast2d_refs.append(rast)
 
 
     def tearDown(self):
     def tearDown(self):
         if self.to_remove_3d:
         if self.to_remove_3d:
-            self.runModule('g.remove', flags='f', type='raster_3d',
-                           name=','.join(self.to_remove_3d), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster_3d",
+                name=",".join(self.to_remove_3d),
+                verbose=True,
+            )
         if self.to_remove_2d:
         if self.to_remove_2d:
-            self.runModule('g.remove', flags='f', type='raster',
-                           name=','.join(self.to_remove_2d), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(self.to_remove_2d),
+                verbose=True,
+            )
         self.del_temp_region()
         self.del_temp_region()
 
 
     def test_a_b_coeff(self):
     def test_a_b_coeff(self):
-        self.assertModule('r3.to.rast', input=self.rast3d,
-                          output=self.rast2d, multiply=2, add=0.5)
-        rasts = list_strings('raster', mapset=".",
-                             pattern="%s_*" % self.rast2d,
-                             exclude="%s_*" % self.rast2d_ref)
-        self.assertEquals(len(rasts), 4,
-                          msg="Wrong number of 2D rasters present"
-                              " in the mapset")
+        self.assertModule(
+            "r3.to.rast", input=self.rast3d, output=self.rast2d, multiply=2, add=0.5
+        )
+        rasts = list_strings(
+            "raster",
+            mapset=".",
+            pattern="%s_*" % self.rast2d,
+            exclude="%s_*" % self.rast2d_ref,
+        )
+        self.assertEquals(
+            len(rasts), 4, msg="Wrong number of 2D rasters present" " in the mapset"
+        )
         ref_info = dict(cells=9)
         ref_info = dict(cells=9)
         ref_univar = dict(cells=9, null_cells=0)
         ref_univar = dict(cells=9, null_cells=0)
         for rast in rasts:
         for rast in rasts:
             self.assertRasterExists(rast)
             self.assertRasterExists(rast)
             # the following doesn't make much sense because we just listed them
             # the following doesn't make much sense because we just listed them
             self.to_remove_2d.append(rast)
             self.to_remove_2d.append(rast)
-            self.assertRasterFitsInfo(raster=rast, reference=ref_info,
-                                      precision=0)
-            self.assertRasterFitsUnivar(raster=rast, reference=ref_univar,
-                                        precision=0)
+            self.assertRasterFitsInfo(raster=rast, reference=ref_info, precision=0)
+            self.assertRasterFitsUnivar(raster=rast, reference=ref_univar, precision=0)
 
 
         # check the actual values
         # check the actual values
         for rast_ref, rast in zip(self.rast2d_refs, rasts):
         for rast_ref, rast in zip(self.rast2d_refs, rasts):
-            self.assertRastersNoDifference(actual=rast,
-                                           reference=rast_ref,
-                                           precision=0.1)
+            self.assertRastersNoDifference(
+                actual=rast, reference=rast_ref, precision=0.1
+            )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 40 - 28
raster3d/r3.to.rast/testsuite/test_integer_rounding.py

@@ -101,60 +101,72 @@ class TestR3ToRastIntegerRounding(TestCase):
     # mixing class and object attributes
     # mixing class and object attributes
     to_remove_3d = []
     to_remove_3d = []
     to_remove_2d = []
     to_remove_2d = []
-    rast3d = 'r3_to_rast_test_int_round'
-    rast2d = 'r3_to_rast_test_int_round'
-    rast2d_ref = 'r3_to_rast_test_int_round_ref'
+    rast3d = "r3_to_rast_test_int_round"
+    rast2d = "r3_to_rast_test_int_round"
+    rast2d_ref = "r3_to_rast_test_int_round_ref"
     rast2d_refs = []
     rast2d_refs = []
 
 
     def setUp(self):
     def setUp(self):
         self.use_temp_region()
         self.use_temp_region()
-        self.runModule('r3.in.ascii', input='-', stdin_=INPUT,
-                       output=self.rast3d)
+        self.runModule("r3.in.ascii", input="-", stdin_=INPUT, output=self.rast3d)
         self.to_remove_3d.append(self.rast3d)
         self.to_remove_3d.append(self.rast3d)
-        self.runModule('g.region', raster_3d=self.rast3d)
+        self.runModule("g.region", raster_3d=self.rast3d)
 
 
         for i, data in enumerate(OUTPUTS):
         for i, data in enumerate(OUTPUTS):
             rast = "%s_%d" % (self.rast2d_ref, i)
             rast = "%s_%d" % (self.rast2d_ref, i)
-            self.runModule('r.in.ascii', input='-', stdin_=data,
-                           output=rast, type='CELL')
+            self.runModule(
+                "r.in.ascii", input="-", stdin_=data, output=rast, type="CELL"
+            )
             self.to_remove_2d.append(rast)
             self.to_remove_2d.append(rast)
             self.rast2d_refs.append(rast)
             self.rast2d_refs.append(rast)
 
 
     def tearDown(self):
     def tearDown(self):
         if self.to_remove_3d:
         if self.to_remove_3d:
-            self.runModule('g.remove', flags='f', type='raster_3d',
-                           name=','.join(self.to_remove_3d), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster_3d",
+                name=",".join(self.to_remove_3d),
+                verbose=True,
+            )
         if self.to_remove_2d:
         if self.to_remove_2d:
-            self.runModule('g.remove', flags='f', type='raster',
-                           name=','.join(self.to_remove_2d), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(self.to_remove_2d),
+                verbose=True,
+            )
         self.del_temp_region()
         self.del_temp_region()
 
 
     def test_rounding(self):
     def test_rounding(self):
-        self.assertModule('r3.to.rast', input=self.rast3d,
-                          output=self.rast2d, type='CELL', add=0.5)
-        rasts = list_strings('raster', mapset=".",
-                             pattern="%s_*" % self.rast2d,
-                             exclude="%s_*" % self.rast2d_ref)
-        self.assertEquals(len(rasts), 4,
-                          msg="Wrong number of 2D rasters present"
-                              " in the mapset")
+        self.assertModule(
+            "r3.to.rast", input=self.rast3d, output=self.rast2d, type="CELL", add=0.5
+        )
+        rasts = list_strings(
+            "raster",
+            mapset=".",
+            pattern="%s_*" % self.rast2d,
+            exclude="%s_*" % self.rast2d_ref,
+        )
+        self.assertEquals(
+            len(rasts), 4, msg="Wrong number of 2D rasters present" " in the mapset"
+        )
         ref_info = dict(cells=9)
         ref_info = dict(cells=9)
         ref_univar = dict(cells=9, null_cells=0)
         ref_univar = dict(cells=9, null_cells=0)
         for rast in rasts:
         for rast in rasts:
             self.assertRasterExists(rast)
             self.assertRasterExists(rast)
             # the following doesn't make much sense because we just listed them
             # the following doesn't make much sense because we just listed them
             self.to_remove_2d.append(rast)
             self.to_remove_2d.append(rast)
-            self.assertRasterFitsInfo(raster=rast, reference=ref_info,
-                                      precision=0)
-            self.assertRasterFitsUnivar(raster=rast, reference=ref_univar,
-                                        precision=0)
+            self.assertRasterFitsInfo(raster=rast, reference=ref_info, precision=0)
+            self.assertRasterFitsUnivar(raster=rast, reference=ref_univar, precision=0)
 
 
         # check the actual values
         # check the actual values
         for rast_ref, rast in zip(self.rast2d_refs, rasts):
         for rast_ref, rast in zip(self.rast2d_refs, rasts):
-            self.assertRastersNoDifference(actual=rast,
-                                           reference=rast_ref,
-                                           precision=0.1)
+            self.assertRastersNoDifference(
+                actual=rast, reference=rast_ref, precision=0.1
+            )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 36 - 28
raster3d/r3.to.rast/testsuite/test_nulls.py

@@ -104,43 +104,53 @@ class TestR3ToRastNulls(TestCase):
     # mixing class and object attributes
     # mixing class and object attributes
     to_remove_3d = []
     to_remove_3d = []
     to_remove_2d = []
     to_remove_2d = []
-    rast3d = 'r3_to_rast_test_nulls'
-    rast2d = 'r3_to_rast_test_nulls'
-    rast2d_ref = 'r3_to_rast_test_nulls_ref'
+    rast3d = "r3_to_rast_test_nulls"
+    rast2d = "r3_to_rast_test_nulls"
+    rast2d_ref = "r3_to_rast_test_nulls_ref"
     rast2d_refs = []
     rast2d_refs = []
 
 
     def setUp(self):
     def setUp(self):
         self.use_temp_region()
         self.use_temp_region()
-        self.runModule('r3.in.ascii', input='-', stdin_=INPUT,
-                       output=self.rast3d)
+        self.runModule("r3.in.ascii", input="-", stdin_=INPUT, output=self.rast3d)
         self.to_remove_3d.append(self.rast3d)
         self.to_remove_3d.append(self.rast3d)
-        self.runModule('g.region', raster_3d=self.rast3d)
+        self.runModule("g.region", raster_3d=self.rast3d)
 
 
         for i, data in enumerate(OUTPUTS):
         for i, data in enumerate(OUTPUTS):
             rast = "%s_%d" % (self.rast2d_ref, i)
             rast = "%s_%d" % (self.rast2d_ref, i)
-            self.runModule('r.in.ascii', input='-', stdin_=data,
-                           output=rast)
+            self.runModule("r.in.ascii", input="-", stdin_=data, output=rast)
             self.to_remove_2d.append(rast)
             self.to_remove_2d.append(rast)
             self.rast2d_refs.append(rast)
             self.rast2d_refs.append(rast)
 
 
     def tearDown(self):
     def tearDown(self):
         if self.to_remove_3d:
         if self.to_remove_3d:
-            self.runModule('g.remove', flags='f', type='raster_3d',
-                           name=','.join(self.to_remove_3d), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster_3d",
+                name=",".join(self.to_remove_3d),
+                verbose=True,
+            )
         if self.to_remove_2d:
         if self.to_remove_2d:
-            self.runModule('g.remove', flags='f', type='raster',
-                           name=','.join(self.to_remove_2d), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(self.to_remove_2d),
+                verbose=True,
+            )
         self.del_temp_region()
         self.del_temp_region()
 
 
     def test_b(self):
     def test_b(self):
-        self.assertModule('r3.to.rast', input=self.rast3d,
-                          output=self.rast2d)
-        rasts = list_strings('raster', mapset=".",
-                             pattern="%s_*" % self.rast2d,
-                             exclude="%s_*" % self.rast2d_ref)
-        self.assertEquals(len(rasts), 4,
-                          msg="Wrong number of 2D rasters present"
-                              " in the mapset")
+        self.assertModule("r3.to.rast", input=self.rast3d, output=self.rast2d)
+        rasts = list_strings(
+            "raster",
+            mapset=".",
+            pattern="%s_*" % self.rast2d,
+            exclude="%s_*" % self.rast2d_ref,
+        )
+        self.assertEquals(
+            len(rasts), 4, msg="Wrong number of 2D rasters present" " in the mapset"
+        )
         ref_info = dict(cells=9)
         ref_info = dict(cells=9)
         # only this tests the presence of nulls
         # only this tests the presence of nulls
         ref_univar = dict(cells=9, null_cells=2)
         ref_univar = dict(cells=9, null_cells=2)
@@ -148,19 +158,17 @@ class TestR3ToRastNulls(TestCase):
             self.assertRasterExists(rast)
             self.assertRasterExists(rast)
             # the following doesn't make much sense because we just listed them
             # the following doesn't make much sense because we just listed them
             self.to_remove_2d.append(rast)
             self.to_remove_2d.append(rast)
-            self.assertRasterFitsInfo(raster=rast, reference=ref_info,
-                                      precision=0)
-            self.assertRasterFitsUnivar(raster=rast, reference=ref_univar,
-                                        precision=0)
+            self.assertRasterFitsInfo(raster=rast, reference=ref_info, precision=0)
+            self.assertRasterFitsUnivar(raster=rast, reference=ref_univar, precision=0)
 
 
         # check the actual values
         # check the actual values
         # TODO: this does not check the position of nulls
         # TODO: this does not check the position of nulls
         # (it ignores nulls)
         # (it ignores nulls)
         for rast_ref, rast in zip(self.rast2d_refs, rasts):
         for rast_ref, rast in zip(self.rast2d_refs, rasts):
-            self.assertRastersNoDifference(actual=rast,
-                                           reference=rast_ref,
-                                           precision=0.1)
+            self.assertRastersNoDifference(
+                actual=rast, reference=rast_ref, precision=0.1
+            )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 36 - 28
raster3d/r3.to.rast/testsuite/test_small_data.py

@@ -101,60 +101,68 @@ class TestR3ToRast(TestCase):
     # mixing class and object attributes
     # mixing class and object attributes
     to_remove_3d = []
     to_remove_3d = []
     to_remove_2d = []
     to_remove_2d = []
-    rast3d = 'r3_to_rast_test'
-    rast2d = 'r3_to_rast_test'
-    rast2d_ref = 'r3_to_rast_test_ref'
+    rast3d = "r3_to_rast_test"
+    rast2d = "r3_to_rast_test"
+    rast2d_ref = "r3_to_rast_test_ref"
     rast2d_refs = []
     rast2d_refs = []
 
 
     def setUp(self):
     def setUp(self):
         self.use_temp_region()
         self.use_temp_region()
-        self.runModule('r3.in.ascii', input='-', stdin_=INPUT_A,
-                       output=self.rast3d)
+        self.runModule("r3.in.ascii", input="-", stdin_=INPUT_A, output=self.rast3d)
         self.to_remove_3d.append(self.rast3d)
         self.to_remove_3d.append(self.rast3d)
-        self.runModule('g.region', raster_3d=self.rast3d)
+        self.runModule("g.region", raster_3d=self.rast3d)
 
 
         for i, data in enumerate(OUTPUTS_A):
         for i, data in enumerate(OUTPUTS_A):
             rast = "%s_%d" % (self.rast2d_ref, i)
             rast = "%s_%d" % (self.rast2d_ref, i)
-            self.runModule('r.in.ascii', input='-', stdin_=data,
-                           output=rast)
+            self.runModule("r.in.ascii", input="-", stdin_=data, output=rast)
             self.to_remove_2d.append(rast)
             self.to_remove_2d.append(rast)
             self.rast2d_refs.append(rast)
             self.rast2d_refs.append(rast)
 
 
     def tearDown(self):
     def tearDown(self):
         if self.to_remove_3d:
         if self.to_remove_3d:
-            self.runModule('g.remove', flags='f', type='raster_3d',
-                           name=','.join(self.to_remove_3d), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster_3d",
+                name=",".join(self.to_remove_3d),
+                verbose=True,
+            )
         if self.to_remove_2d:
         if self.to_remove_2d:
-            self.runModule('g.remove', flags='f', type='raster',
-                           name=','.join(self.to_remove_2d), verbose=True)
+            self.runModule(
+                "g.remove",
+                flags="f",
+                type="raster",
+                name=",".join(self.to_remove_2d),
+                verbose=True,
+            )
         self.del_temp_region()
         self.del_temp_region()
 
 
     def test_a(self):
     def test_a(self):
-        self.assertModule('r3.to.rast', input=self.rast3d,
-                          output=self.rast2d)
-        rasts = list_strings('raster', mapset=".",
-                             pattern="%s_*" % self.rast2d,
-                             exclude="%s_*" % self.rast2d_ref)
-        self.assertEquals(len(rasts), 4,
-                          msg="Wrong number of 2D rasters present"
-                              " in the mapset")
+        self.assertModule("r3.to.rast", input=self.rast3d, output=self.rast2d)
+        rasts = list_strings(
+            "raster",
+            mapset=".",
+            pattern="%s_*" % self.rast2d,
+            exclude="%s_*" % self.rast2d_ref,
+        )
+        self.assertEquals(
+            len(rasts), 4, msg="Wrong number of 2D rasters present" " in the mapset"
+        )
         ref_info = dict(cells=9)
         ref_info = dict(cells=9)
         ref_univar = dict(cells=9, null_cells=0)
         ref_univar = dict(cells=9, null_cells=0)
         for rast in rasts:
         for rast in rasts:
             self.assertRasterExists(rast)
             self.assertRasterExists(rast)
             # the following doesn't make much sense because we just listed them
             # the following doesn't make much sense because we just listed them
             self.to_remove_2d.append(rast)
             self.to_remove_2d.append(rast)
-            self.assertRasterFitsInfo(raster=rast, reference=ref_info,
-                                      precision=0)
-            self.assertRasterFitsUnivar(raster=rast, reference=ref_univar,
-                                        precision=0)
+            self.assertRasterFitsInfo(raster=rast, reference=ref_info, precision=0)
+            self.assertRasterFitsUnivar(raster=rast, reference=ref_univar, precision=0)
 
 
         # check the actual values
         # check the actual values
         for rast_ref, rast in zip(self.rast2d_refs, rasts):
         for rast_ref, rast in zip(self.rast2d_refs, rasts):
-            self.assertRastersNoDifference(actual=rast,
-                                           reference=rast_ref,
-                                           precision=0.1)
+            self.assertRastersNoDifference(
+                actual=rast, reference=rast_ref, precision=0.1
+            )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 43 - 26
vector/v.db.select/testsuite/test_v_db_select.py

@@ -14,7 +14,7 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
-out_group = u"""CZab
+out_group = """CZab
 CZam
 CZam
 CZba
 CZba
 CZbb
 CZbb
@@ -153,17 +153,17 @@ Zwe
 bz
 bz
 """
 """
 
 
-out_where = u"""1076|366545504|324050.96875|1077|1076|Zwe|366545512.376|324050.97237
+out_where = """1076|366545504|324050.96875|1077|1076|Zwe|366545512.376|324050.97237
 1123|1288.555298|254.393951|1124|1123|Zwe|1288.546525|254.393964
 1123|1288.555298|254.393951|1124|1123|Zwe|1288.546525|254.393964
 1290|63600420|109186.835938|1291|1290|Zwe|63600422.4739|109186.832069
 1290|63600420|109186.835938|1291|1290|Zwe|63600422.4739|109186.832069
 """
 """
 
 
-out_sep = u"""1076,366545504,324050.96875,1077,1076,Zwe,366545512.376,324050.97237
+out_sep = """1076,366545504,324050.96875,1077,1076,Zwe,366545512.376,324050.97237
 1123,1288.555298,254.393951,1124,1123,Zwe,1288.546525,254.393964
 1123,1288.555298,254.393951,1124,1123,Zwe,1288.546525,254.393964
 1290,63600420,109186.835938,1291,1290,Zwe,63600422.4739,109186.832069
 1290,63600420,109186.835938,1291,1290,Zwe,63600422.4739,109186.832069
 """
 """
 
 
-out_json = u"""[{"cat":1,"onemap_pro":963738.75,"PERIMETER":4083.97998,"GEOL250_":2,"GEOL250_ID":1,"GEO_NAME":"Zml","SHAPE_area":963738.608571,"SHAPE_len":4083.979839},
+out_json = """[{"cat":1,"onemap_pro":963738.75,"PERIMETER":4083.97998,"GEOL250_":2,"GEOL250_ID":1,"GEO_NAME":"Zml","SHAPE_area":963738.608571,"SHAPE_len":4083.979839},
 {"cat":2,"onemap_pro":22189124,"PERIMETER":26628.261719,"GEOL250_":3,"GEOL250_ID":2,"GEO_NAME":"Zmf","SHAPE_area":22189123.2296,"SHAPE_len":26628.261112},
 {"cat":2,"onemap_pro":22189124,"PERIMETER":26628.261719,"GEOL250_":3,"GEOL250_ID":2,"GEO_NAME":"Zmf","SHAPE_area":22189123.2296,"SHAPE_len":26628.261112},
 {"cat":3,"onemap_pro":579286.875,"PERIMETER":3335.55835,"GEOL250_":4,"GEOL250_ID":3,"GEO_NAME":"Zml","SHAPE_area":579286.829631,"SHAPE_len":3335.557182},
 {"cat":3,"onemap_pro":579286.875,"PERIMETER":3335.55835,"GEOL250_":4,"GEOL250_ID":3,"GEO_NAME":"Zml","SHAPE_area":579286.829631,"SHAPE_len":3335.557182},
 {"cat":4,"onemap_pro":20225526,"PERIMETER":33253,"GEOL250_":5,"GEOL250_ID":4,"GEO_NAME":"Zml","SHAPE_area":20225526.6368,"SHAPE_len":33253.000508},
 {"cat":4,"onemap_pro":20225526,"PERIMETER":33253,"GEOL250_":5,"GEOL250_ID":4,"GEO_NAME":"Zml","SHAPE_area":20225526.6368,"SHAPE_len":33253.000508},
@@ -174,61 +174,77 @@ out_json = u"""[{"cat":1,"onemap_pro":963738.75,"PERIMETER":4083.97998,"GEOL250_
 {"cat":9,"onemap_pro":3389078.25,"PERIMETER":16346.604492,"GEOL250_":10,"GEOL250_ID":9,"GEO_NAME":"Zml","SHAPE_area":3389077.17888,"SHAPE_len":16346.604884},
 {"cat":9,"onemap_pro":3389078.25,"PERIMETER":16346.604492,"GEOL250_":10,"GEOL250_ID":9,"GEO_NAME":"Zml","SHAPE_area":3389077.17888,"SHAPE_len":16346.604884},
 {"cat":10,"onemap_pro":906132.375,"PERIMETER":4319.162109,"GEOL250_":11,"GEOL250_ID":10,"GEO_NAME":"Zml","SHAPE_area":906132.945012,"SHAPE_len":4319.163379}]"""
 {"cat":10,"onemap_pro":906132.375,"PERIMETER":4319.162109,"GEOL250_":11,"GEOL250_ID":10,"GEO_NAME":"Zml","SHAPE_area":906132.945012,"SHAPE_len":4319.163379}]"""
 
 
+
 class SelectTest(TestCase):
 class SelectTest(TestCase):
     """Test case for v.db.select"""
     """Test case for v.db.select"""
 
 
-    outfile = 'select.csv'
-    invect = 'geology'
-    col = 'GEO_NAME'
-    val = 'Zwe'
+    outfile = "select.csv"
+    invect = "geology"
+    col = "GEO_NAME"
+    val = "Zwe"
     cat = 10
     cat = 10
 
 
     def testRun(self):
     def testRun(self):
         """Basic test of v.db.select"""
         """Basic test of v.db.select"""
-        self.assertModule('v.db.select', map=self.invect)
+        self.assertModule("v.db.select", map=self.invect)
 
 
     def testFileExists(self):
     def testFileExists(self):
         """This function checks if the output file is written correctly"""
         """This function checks if the output file is written correctly"""
-        self.runModule('v.db.select', map=self.invect, file=self.outfile)
+        self.runModule("v.db.select", map=self.invect, file=self.outfile)
         self.assertFileExists(self.outfile)
         self.assertFileExists(self.outfile)
         if os.path.isfile(self.outfile):
         if os.path.isfile(self.outfile):
             os.remove(self.outfile)
             os.remove(self.outfile)
 
 
     def testGroup(self):
     def testGroup(self):
         """Testing v.db.select with group option"""
         """Testing v.db.select with group option"""
-        sel = SimpleModule('v.db.select', flags='c', map=self.invect,
-                           columns=self.col, group=self.col)
+        sel = SimpleModule(
+            "v.db.select", flags="c", map=self.invect, columns=self.col, group=self.col
+        )
         sel.run()
         sel.run()
         self.assertLooksLike(reference=out_group, actual=sel.outputs.stdout)
         self.assertLooksLike(reference=out_group, actual=sel.outputs.stdout)
 
 
     def testWhere(self):
     def testWhere(self):
         """Testing v.db.select with where option"""
         """Testing v.db.select with where option"""
-        sel = SimpleModule('v.db.select', flags='c', map=self.invect,
-                           where="{col}='{val}'".format(col=self.col,
-                                                        val=self.val))
+        sel = SimpleModule(
+            "v.db.select",
+            flags="c",
+            map=self.invect,
+            where="{col}='{val}'".format(col=self.col, val=self.val),
+        )
         sel.run()
         sel.run()
         self.assertLooksLike(reference=out_where, actual=sel.outputs.stdout)
         self.assertLooksLike(reference=out_where, actual=sel.outputs.stdout)
 
 
     def testSeparator(self):
     def testSeparator(self):
-        sel = SimpleModule('v.db.select', flags='c', map=self.invect,
-                           where="{col}='{val}'".format(col=self.col,
-                                                        val=self.val),
-                           separator='comma')
+        sel = SimpleModule(
+            "v.db.select",
+            flags="c",
+            map=self.invect,
+            where="{col}='{val}'".format(col=self.col, val=self.val),
+            separator="comma",
+        )
         sel.run()
         sel.run()
         self.assertLooksLike(reference=out_sep, actual=sel.outputs.stdout)
         self.assertLooksLike(reference=out_sep, actual=sel.outputs.stdout)
 
 
     def testComma(self):
     def testComma(self):
-        sel = SimpleModule('v.db.select', flags='c', map=self.invect,
-                           where="{col}='{val}'".format(col=self.col,
-                                                        val=self.val),
-                           separator=',')
+        sel = SimpleModule(
+            "v.db.select",
+            flags="c",
+            map=self.invect,
+            where="{col}='{val}'".format(col=self.col, val=self.val),
+            separator=",",
+        )
         sel.run()
         sel.run()
         self.assertLooksLike(reference=out_sep, actual=sel.outputs.stdout)
         self.assertLooksLike(reference=out_sep, actual=sel.outputs.stdout)
 
 
     def testJSON(self):
     def testJSON(self):
         import json
         import json
-        sel = SimpleModule('v.db.select', flags='j', map=self.invect,
-                           where="cat<={cat}".format(cat=self.cat))
+
+        sel = SimpleModule(
+            "v.db.select",
+            flags="j",
+            map=self.invect,
+            where="cat<={cat}".format(cat=self.cat),
+        )
         sel.run()
         sel.run()
 
 
         try:
         try:
@@ -238,5 +254,6 @@ class SelectTest(TestCase):
 
 
         self.assertLooksLike(reference=out_json, actual=sel.outputs.stdout)
         self.assertLooksLike(reference=out_json, actual=sel.outputs.stdout)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 78 - 33
vector/v.distance/testsuite/test_areas_points.py

@@ -84,6 +84,7 @@ class TestPointsAndAreas(TestCase):
     Created for #2734 (3D point inside area is classified as outside)
     Created for #2734 (3D point inside area is classified as outside)
     https://trac.osgeo.org/grass/ticket/2734
     https://trac.osgeo.org/grass/ticket/2734
     """
     """
+
     # TODO: replace by unified handing of maps
     # TODO: replace by unified handing of maps
     to_remove = []
     to_remove = []
     areas = "test_vdistance_areas"
     areas = "test_vdistance_areas"
@@ -93,58 +94,102 @@ class TestPointsAndAreas(TestCase):
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Create vector maps (areas with attributes)"""
         """Create vector maps (areas with attributes)"""
-        cls.runModule('v.in.ascii', input='-', output=cls.areas,
-                      format='standard', stdin=areas)
+        cls.runModule(
+            "v.in.ascii", input="-", output=cls.areas, format="standard", stdin=areas
+        )
         cls.to_remove.append(cls.areas)
         cls.to_remove.append(cls.areas)
-        cls.runModule('v.db.addtable', map=cls.areas,
-                      columns="number INTEGER, label VARCHAR(250)")
+        cls.runModule(
+            "v.db.addtable", map=cls.areas, columns="number INTEGER, label VARCHAR(250)"
+        )
         # TODO: this should be done in more effective way
         # TODO: this should be done in more effective way
-        cls.runModule('v.db.update', map=cls.areas, column='label',
-                      value="South-west area", where="cat=1")
-        cls.runModule('v.db.update', map=cls.areas, column='label',
-                      value="North-east area", where="cat=2")
-
-        cls.runModule('v.in.ascii', input='-', output=cls.points,
-                      format='point', separator='pipe', flags='t',
-                      stdin=points)
+        cls.runModule(
+            "v.db.update",
+            map=cls.areas,
+            column="label",
+            value="South-west area",
+            where="cat=1",
+        )
+        cls.runModule(
+            "v.db.update",
+            map=cls.areas,
+            column="label",
+            value="North-east area",
+            where="cat=2",
+        )
+
+        cls.runModule(
+            "v.in.ascii",
+            input="-",
+            output=cls.points,
+            format="point",
+            separator="pipe",
+            flags="t",
+            stdin=points,
+        )
         cls.to_remove.append(cls.points)
         cls.to_remove.append(cls.points)
-        cls.runModule('v.db.addtable', map=cls.points,
-                      columns="area_label VARCHAR(250)")
-
-        cls.runModule('v.in.ascii', input='-', output=cls.points_3d,
-                      format='point', separator='pipe', flags='zt', z=3,
-                      stdin=points_3d)
+        cls.runModule(
+            "v.db.addtable", map=cls.points, columns="area_label VARCHAR(250)"
+        )
+
+        cls.runModule(
+            "v.in.ascii",
+            input="-",
+            output=cls.points_3d,
+            format="point",
+            separator="pipe",
+            flags="zt",
+            z=3,
+            stdin=points_3d,
+        )
         cls.to_remove.append(cls.points_3d)
         cls.to_remove.append(cls.points_3d)
-        cls.runModule('v.db.addtable', map=cls.points_3d,
-                      columns="area_label VARCHAR(250)")
+        cls.runModule(
+            "v.db.addtable", map=cls.points_3d, columns="area_label VARCHAR(250)"
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove vector maps"""
         """Remove vector maps"""
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='vector',
-                          name=','.join(cls.to_remove), verbose=True)
+            cls.runModule(
+                "g.remove",
+                flags="f",
+                type="vector",
+                name=",".join(cls.to_remove),
+                verbose=True,
+            )
 
 
     def test_area_attrs_to_2d_points(self):
     def test_area_attrs_to_2d_points(self):
         """Check that values are uploaded to 2D points in areas (dmax=0)"""
         """Check that values are uploaded to 2D points in areas (dmax=0)"""
         # using call_module because PyGRASS doen't accept form_
         # using call_module because PyGRASS doen't accept form_
-        call_module('v.distance', from_=self.points, to=self.areas,
-                    dmax=0, upload='to_attr',
-                    column='area_label', to_column='label')
+        call_module(
+            "v.distance",
+            from_=self.points,
+            to=self.areas,
+            dmax=0,
+            upload="to_attr",
+            column="area_label",
+            to_column="label",
+        )
         # using call_module because it is easier
         # using call_module because it is easier
-        table = call_module('v.db.select', map=self.points,
-                            separator='pipe', flags='c')
+        table = call_module("v.db.select", map=self.points, separator="pipe", flags="c")
         self.assertMultiLineEqual(table, table_ref)
         self.assertMultiLineEqual(table, table_ref)
 
 
     def test_area_attrs_to_3d_points(self):
     def test_area_attrs_to_3d_points(self):
         """Check that values are uploaded to 3D points in areas (dmax=0)"""
         """Check that values are uploaded to 3D points in areas (dmax=0)"""
-        call_module('v.distance', from_=self.points_3d, to=self.areas,
-                    dmax=0, upload='to_attr',
-                    column='area_label', to_column='label')
-        table = call_module('v.db.select', map=self.points_3d,
-                            separator='pipe', flags='c')
+        call_module(
+            "v.distance",
+            from_=self.points_3d,
+            to=self.areas,
+            dmax=0,
+            upload="to_attr",
+            column="area_label",
+            to_column="label",
+        )
+        table = call_module(
+            "v.db.select", map=self.points_3d, separator="pipe", flags="c"
+        )
         self.assertMultiLineEqual(table, table_ref)
         self.assertMultiLineEqual(table, table_ref)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 55 - 30
vector/v.extract/testsuite/test_v_extract.py

@@ -13,13 +13,13 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 from grass.script.core import read_command
 from grass.script.core import read_command
 
 
-TABLE_1="""cat|MAJORRDS_|ROAD_NAME|MULTILANE|PROPYEAR|OBJECTID|SHAPE_LEN
+TABLE_1 = """cat|MAJORRDS_|ROAD_NAME|MULTILANE|PROPYEAR|OBJECTID|SHAPE_LEN
 1|1|NC-50|no|0|1|4825.369405
 1|1|NC-50|no|0|1|4825.369405
 2|2|NC-50|no|0|2|14392.589058
 2|2|NC-50|no|0|2|14392.589058
 3|3|NC-98|no|0|3|3212.981242
 3|3|NC-98|no|0|3|3212.981242
 4|4|NC-50|no|0|4|13391.907552
 4|4|NC-50|no|0|4|13391.907552
 """
 """
-TABLE_2="""cat|onemap_pro|PERIMETER|GEOL250_|GEOL250_ID|GEO_NAME|SHAPE_area|SHAPE_len
+TABLE_2 = """cat|onemap_pro|PERIMETER|GEOL250_|GEOL250_ID|GEO_NAME|SHAPE_area|SHAPE_len
 1|963738.75|4083.97998|2|1|Zml|963738.608571|4083.979839
 1|963738.75|4083.97998|2|1|Zml|963738.608571|4083.979839
 2|22189124|26628.261719|3|2|Zmf|22189123.2296|26628.261112
 2|22189124|26628.261719|3|2|Zmf|22189123.2296|26628.261112
 3|579286.875|3335.55835|4|3|Zml|579286.829631|3335.557182
 3|579286.875|3335.55835|4|3|Zml|579286.829631|3335.557182
@@ -27,7 +27,7 @@ TABLE_2="""cat|onemap_pro|PERIMETER|GEOL250_|GEOL250_ID|GEO_NAME|SHAPE_area|SHAP
 5|450650720|181803.765625|6|5|Ybgg|450650731.029|181803.776199
 5|450650720|181803.765625|6|5|Ybgg|450650731.029|181803.776199
 """
 """
 
 
-TABLE_3="""cat|MAJORRDS_|ROAD_NAME|MULTILANE|PROPYEAR|OBJECTID|SHAPE_LEN
+TABLE_3 = """cat|MAJORRDS_|ROAD_NAME|MULTILANE|PROPYEAR|OBJECTID|SHAPE_LEN
 1|1|NC-50|no|0|1|4825.369405
 1|1|NC-50|no|0|1|4825.369405
 2|2|NC-50|no|0|2|14392.589058
 2|2|NC-50|no|0|2|14392.589058
 3|3|NC-98|no|0|3|3212.981242
 3|3|NC-98|no|0|3|3212.981242
@@ -38,10 +38,12 @@ TABLE_3="""cat|MAJORRDS_|ROAD_NAME|MULTILANE|PROPYEAR|OBJECTID|SHAPE_LEN
 8|8||no|0|8|797.901095
 8|8||no|0|8|797.901095
 9|9|NC-98|no|0|9|14772.176241
 9|9|NC-98|no|0|9|14772.176241
 """
 """
+
+
 class TestRasterreport(TestCase):
 class TestRasterreport(TestCase):
-    input="roadsmajor"
-    output="testoutput"
-    geology='geology'
+    input = "roadsmajor"
+    output = "testoutput"
+    geology = "geology"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
@@ -52,43 +54,66 @@ class TestRasterreport(TestCase):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(cls):
     def tearDown(cls):
-        cls.runModule('g.remove', flags='f', type='vector', name=cls.output)
+        cls.runModule("g.remove", flags="f", type="vector", name=cls.output)
 
 
     def test_flagd(self):
     def test_flagd(self):
         """Testing flag d """
         """Testing flag d """
-        self.assertModule('v.extract', input=self.input, output=self.output, cats="1,2,3,4")
-        category = read_command('v.db.select', map=self.output,
-                                separator='pipe')
-        self.assertEqual(first=TABLE_1.replace('\n', os.linesep),
-                                 second=category,
-                                 msg="Attribute table has wrong entries")
+        self.assertModule(
+            "v.extract", input=self.input, output=self.output, cats="1,2,3,4"
+        )
+        category = read_command("v.db.select", map=self.output, separator="pipe")
+        self.assertEqual(
+            first=TABLE_1.replace("\n", os.linesep),
+            second=category,
+            msg="Attribute table has wrong entries",
+        )
 
 
     def test_cats2(self):
     def test_cats2(self):
         """Testing cats=2 """
         """Testing cats=2 """
-        self.assertModule('v.extract', input=self.geology, output=self.output, flags='d', cats="1,2,3,4,5")
-        category = read_command('v.db.select', map=self.output,
-                                separator='pipe')
-        self.assertEqual(first=TABLE_2.replace('\n', os.linesep),
-                                 second=category,
-                                 msg="Attribute table has wrong entries")
+        self.assertModule(
+            "v.extract",
+            input=self.geology,
+            output=self.output,
+            flags="d",
+            cats="1,2,3,4,5",
+        )
+        category = read_command("v.db.select", map=self.output, separator="pipe")
+        self.assertEqual(
+            first=TABLE_2.replace("\n", os.linesep),
+            second=category,
+            msg="Attribute table has wrong entries",
+        )
 
 
     def test_flagt(self):
     def test_flagt(self):
         """Testing Falg T"""
         """Testing Falg T"""
-        self.assertModule('v.extract', input=self.input, output=self.output, flags='t', cats=1 )
+        self.assertModule(
+            "v.extract", input=self.input, output=self.output, flags="t", cats=1
+        )
 
 
     def test_flatr(self):
     def test_flatr(self):
         """Testing flag r """
         """Testing flag r """
-        self.assertModule('v.extract', input=self.geology, output=self.output, flags='r', cats=1 )
+        self.assertModule(
+            "v.extract", input=self.geology, output=self.output, flags="r", cats=1
+        )
 
 
-    def  test_where(self):
+    def test_where(self):
         """Testing where"""
         """Testing where"""
-        self.assertModule('v.extract', input=self.input, output=self.output, flags='d',
-                            where="cat < 10")
-        category = read_command('v.db.select', map=self.output,
-                                separator='pipe')
-        self.assertEqual(first=TABLE_3.replace('\n', os.linesep),
-                                 second=category,
-                                 msg="Attribute table has wrong entries")
-if __name__ == '__main__':
+        self.assertModule(
+            "v.extract",
+            input=self.input,
+            output=self.output,
+            flags="d",
+            where="cat < 10",
+        )
+        category = read_command("v.db.select", map=self.output, separator="pipe")
+        self.assertEqual(
+            first=TABLE_3.replace("\n", os.linesep),
+            second=category,
+            msg="Attribute table has wrong entries",
+        )
+
+
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 95 - 57
vector/v.in.ascii/testsuite/test_csv.py

@@ -52,27 +52,34 @@ TABLE_1 = """cat|x|y|ed_cat|field_estimate
 
 
 class SimpleCsvTestCase(TestCase):
 class SimpleCsvTestCase(TestCase):
 
 
-    xyvector = 'yxvetor_test'
+    xyvector = "yxvetor_test"
 
 
     def tearDown(self):
     def tearDown(self):
         """Remove the vector map after each test method"""
         """Remove the vector map after each test method"""
-        self.runModule('g.remove', flags='f', type='vector',
-                       name=self.xyvector)
+        self.runModule("g.remove", flags="f", type="vector", name=self.xyvector)
 
 
     def test_no_text_delimeter(self):
     def test_no_text_delimeter(self):
         """Test type of resulting map"""
         """Test type of resulting map"""
         self.assertModule(
         self.assertModule(
-            'v.in.ascii', input='-', output=self.xyvector,
-            separator='comma', skip=1, x=2, y=3, cat=1,
+            "v.in.ascii",
+            input="-",
+            output=self.xyvector,
+            separator="comma",
+            skip=1,
+            x=2,
+            y=3,
+            cat=1,
             columns="cat int, x double, y double,"
             columns="cat int, x double, y double,"
-                    " ed_cat varchar(20), field_estimate varchar(20)",
-            stdin_=INPUT_NOQUOTES)
+            " ed_cat varchar(20), field_estimate varchar(20)",
+            stdin_=INPUT_NOQUOTES,
+        )
 
 
-        category = read_command('v.db.select', map=self.xyvector,
-                                separator='pipe')
-        self.assertEqual(first=TABLE_1.replace('\n', os.linesep),
-                         second=category,
-                         msg="Attribute table has wrong entries")
+        category = read_command("v.db.select", map=self.xyvector, separator="pipe")
+        self.assertEqual(
+            first=TABLE_1.replace("\n", os.linesep),
+            second=category,
+            msg="Attribute table has wrong entries",
+        )
 
 
     def test_text_delimeter(self):
     def test_text_delimeter(self):
         """Test loading CSV with text delimiter
         """Test loading CSV with text delimiter
@@ -80,18 +87,26 @@ class SimpleCsvTestCase(TestCase):
         Text delimiter added in r63581
         Text delimiter added in r63581
         """
         """
         self.assertModule(
         self.assertModule(
-            'v.in.ascii', input='-', output=self.xyvector,
-            separator='comma', text='doublequote',
-            skip=1, x=2, y=3, cat=1,
+            "v.in.ascii",
+            input="-",
+            output=self.xyvector,
+            separator="comma",
+            text="doublequote",
+            skip=1,
+            x=2,
+            y=3,
+            cat=1,
             columns="cat int, x double, y double,"
             columns="cat int, x double, y double,"
-                    " ed_cat varchar(20), field_estimate varchar(20)",
-            stdin_=INPUT_DOUBLEQUOTES)
-
-        category = read_command('v.db.select', map=self.xyvector,
-                                separator='pipe')
-        self.assertEqual(first=TABLE_1.replace('\n', os.linesep),
-                         second=category,
-                         msg="Attribute table has wrong entries")
+            " ed_cat varchar(20), field_estimate varchar(20)",
+            stdin_=INPUT_DOUBLEQUOTES,
+        )
+
+        category = read_command("v.db.select", map=self.xyvector, separator="pipe")
+        self.assertEqual(
+            first=TABLE_1.replace("\n", os.linesep),
+            second=category,
+            msg="Attribute table has wrong entries",
+        )
         # TODO: a general method to compare attribute tables? (might need to solve because of floats)
         # TODO: a general method to compare attribute tables? (might need to solve because of floats)
         # TODO: standardize string strip? perhaps discourage, it messes up the diff
         # TODO: standardize string strip? perhaps discourage, it messes up the diff
         # TODO: use replace solution for newlines in lib (compare to current one)
         # TODO: use replace solution for newlines in lib (compare to current one)
@@ -102,34 +117,50 @@ class SimpleCsvTestCase(TestCase):
         Using double quote character for quote.
         Using double quote character for quote.
         """
         """
         self.assertModule(
         self.assertModule(
-            'v.in.ascii', input='-', output=self.xyvector,
-            separator='tab', text='"',
-            skip=1, x=2, y=3, cat=1,
+            "v.in.ascii",
+            input="-",
+            output=self.xyvector,
+            separator="tab",
+            text='"',
+            skip=1,
+            x=2,
+            y=3,
+            cat=1,
             columns="cat int, x double, y double,"
             columns="cat int, x double, y double,"
-                    " ed_cat varchar(20), field_estimate varchar(20)",
-            stdin_=INPUT_TSV)
+            " ed_cat varchar(20), field_estimate varchar(20)",
+            stdin_=INPUT_TSV,
+        )
 
 
-        category = read_command('v.db.select', map=self.xyvector,
-                                separator='pipe')
-        self.assertEqual(first=TABLE_1.replace('\n', os.linesep),
-                         second=category,
-                         msg="Attribute table has wrong entries")
+        category = read_command("v.db.select", map=self.xyvector, separator="pipe")
+        self.assertEqual(
+            first=TABLE_1.replace("\n", os.linesep),
+            second=category,
+            msg="Attribute table has wrong entries",
+        )
 
 
     def test_uncommon_delims(self):
     def test_uncommon_delims(self):
         """Test loading CSV with uncommon delimiters"""
         """Test loading CSV with uncommon delimiters"""
         self.assertModule(
         self.assertModule(
-            'v.in.ascii', input='-', output=self.xyvector,
-            separator='@', text='^',
-            skip=1, x=2, y=3, cat=1,
+            "v.in.ascii",
+            input="-",
+            output=self.xyvector,
+            separator="@",
+            text="^",
+            skip=1,
+            x=2,
+            y=3,
+            cat=1,
             columns="cat int, x double, y double,"
             columns="cat int, x double, y double,"
-                    " ed_cat varchar(20), field_estimate varchar(20)",
-            stdin_=INPUT_UNCOMMON)
+            " ed_cat varchar(20), field_estimate varchar(20)",
+            stdin_=INPUT_UNCOMMON,
+        )
 
 
-        category = read_command('v.db.select', map=self.xyvector,
-                                separator='pipe')
-        self.assertEqual(first=TABLE_1.replace('\n', os.linesep),
-                         second=category,
-                         msg="Attribute table has wrong entries")
+        category = read_command("v.db.select", map=self.xyvector, separator="pipe")
+        self.assertEqual(
+            first=TABLE_1.replace("\n", os.linesep),
+            second=category,
+            msg="Attribute table has wrong entries",
+        )
 
 
 
 
 INPUT_DELIM_IN_TEXT = """Id,POINT_X,POINT_Y,Category,"ED field estimate"
 INPUT_DELIM_IN_TEXT = """Id,POINT_X,POINT_Y,Category,"ED field estimate"
@@ -151,12 +182,11 @@ TABLE_2 = """cat|x|y|ed_cat|field_estimate
 
 
 class AdvancedCsvTestCase(TestCase):
 class AdvancedCsvTestCase(TestCase):
 
 
-    xyvector = 'yxvetor_test'
+    xyvector = "yxvetor_test"
 
 
     def tearDown(self):
     def tearDown(self):
         """Remove the vector map after each test method"""
         """Remove the vector map after each test method"""
-        self.runModule('g.remove', flags='f', type='vector',
-                       name=self.xyvector)
+        self.runModule("g.remove", flags="f", type="vector", name=self.xyvector)
 
 
     def test_delimeter_in_text(self):
     def test_delimeter_in_text(self):
         """Test loading CSV with delimiter in text
         """Test loading CSV with delimiter in text
@@ -164,19 +194,27 @@ class AdvancedCsvTestCase(TestCase):
         Text delimiter added in r63581
         Text delimiter added in r63581
         """
         """
         self.assertModule(
         self.assertModule(
-            'v.in.ascii', input='-', output=self.xyvector,
-            separator='comma', text='doublequote',
-            skip=1, x=2, y=3, cat=1,
+            "v.in.ascii",
+            input="-",
+            output=self.xyvector,
+            separator="comma",
+            text="doublequote",
+            skip=1,
+            x=2,
+            y=3,
+            cat=1,
             columns="cat int, x double, y double,"
             columns="cat int, x double, y double,"
-                    " ed_cat varchar(40), field_estimate varchar(40)",
-            stdin_=INPUT_DELIM_IN_TEXT)
+            " ed_cat varchar(40), field_estimate varchar(40)",
+            stdin_=INPUT_DELIM_IN_TEXT,
+        )
 
 
-        category = read_command('v.db.select', map=self.xyvector,
-                                separator='pipe')
-        self.assertEqual(first=TABLE_2.replace('\n', os.linesep),
-                         second=category,
-                         msg="Attribute table has wrong entries")
+        category = read_command("v.db.select", map=self.xyvector, separator="pipe")
+        self.assertEqual(
+            first=TABLE_2.replace("\n", os.linesep),
+            second=category,
+            msg="Attribute table has wrong entries",
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 89 - 46
vector/v.in.lidar/testsuite/decimation_test.py

@@ -21,26 +21,31 @@ class TestCountBasedDecimation(TestCase):
     """
     """
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    vector_points = 'vinlidar_decimation_original'
-    imported_points = 'vinlidar_decimation_imported'
-    las_file = 'vinlidar_decimation_points.las'
+    vector_points = "vinlidar_decimation_original"
+    imported_points = "vinlidar_decimation_imported"
+    las_file = "vinlidar_decimation_points.las"
     npoints = 300  # the values works well for 300 without rounding
     npoints = 300  # the values works well for 300 without rounding
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and generated data"""
         """Ensures expected computational region and generated data"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
-        cls.runModule('v.random', flags='zb', output=cls.vector_points,
-            npoints=cls.npoints, zmin=200, zmax=500, seed=100)
-        cls.runModule('v.out.lidar', input=cls.vector_points,
-            output=cls.las_file)
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
+        cls.runModule(
+            "v.random",
+            flags="zb",
+            output=cls.vector_points,
+            npoints=cls.npoints,
+            zmin=200,
+            zmax=500,
+            seed=100,
+        )
+        cls.runModule("v.out.lidar", input=cls.vector_points, output=cls.las_file)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove the temporary region and generated data"""
         """Remove the temporary region and generated data"""
-        cls.runModule('g.remove', flags='f', type='vector',
-            name=cls.vector_points)
+        cls.runModule("g.remove", flags="f", type="vector", name=cls.vector_points)
         if os.path.isfile(cls.las_file):
         if os.path.isfile(cls.las_file):
             os.remove(cls.las_file)
             os.remove(cls.las_file)
         cls.del_temp_region()
         cls.del_temp_region()
@@ -50,53 +55,73 @@ class TestCountBasedDecimation(TestCase):
 
 
         This is executed after each test run.
         This is executed after each test run.
         """
         """
-        self.runModule('g.remove', flags='f', type='vector',
-            name=self.imported_points)
+        self.runModule("g.remove", flags="f", type="vector", name=self.imported_points)
 
 
     def test_identical(self):
     def test_identical(self):
         """Test to see if the standard outputs are created"""
         """Test to see if the standard outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt')
+        self.assertModule(
+            "v.in.lidar", input=self.las_file, output=self.imported_points, flags="bt"
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=self.npoints))
+            vector=self.imported_points, reference=dict(points=self.npoints)
+        )
 
 
     def skip_number(self, number, expect):
     def skip_number(self, number, expect):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt', skip=number)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            skip=number,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=expect))
+            vector=self.imported_points, reference=dict(points=expect)
+        )
 
 
     def preserve_number(self, number, expect):
     def preserve_number(self, number, expect):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt', preserve=number)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            preserve=number,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=expect))
+            vector=self.imported_points, reference=dict(points=expect)
+        )
 
 
     def offset_number(self, number, expect):
     def offset_number(self, number, expect):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt', offset=number)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            offset=number,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=expect))
+            vector=self.imported_points, reference=dict(points=expect)
+        )
 
 
     def limit_number(self, number, expect):
     def limit_number(self, number, expect):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt', limit=number)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            limit=number,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=expect))
+            vector=self.imported_points, reference=dict(points=expect)
+        )
 
 
     def test_decimated_skip_2(self):
     def test_decimated_skip_2(self):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
@@ -128,34 +153,52 @@ class TestCountBasedDecimation(TestCase):
 
 
     def test_offset_preserve(self):
     def test_offset_preserve(self):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            offset=105, preserve=10)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            offset=105,
+            preserve=10,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
             vector=self.imported_points,
             vector=self.imported_points,
-            reference=dict(points=int((self.npoints - 105) / 10)))
+            reference=dict(points=int((self.npoints - 105) / 10)),
+        )
 
 
     def test_limit_skip(self):
     def test_limit_skip(self):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            limit=105, skip=10)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            limit=105,
+            skip=10,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=105))
+            vector=self.imported_points, reference=dict(points=105)
+        )
 
 
     def test_offset_limit_skip(self):
     def test_offset_limit_skip(self):
         """Test to see if the outputs are created"""
         """Test to see if the outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            offset=50, skip=5, limit=self.npoints - 1)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            offset=50,
+            skip=5,
+            limit=self.npoints - 1,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
             vector=self.imported_points,
             vector=self.imported_points,
-            reference=dict(points=0.8 * (self.npoints - 50)))
+            reference=dict(points=0.8 * (self.npoints - 50)),
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 45 - 30
vector/v.in.lidar/testsuite/mask_test.py

@@ -89,28 +89,35 @@ class VectorMaskTest(TestCase):
     """
     """
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    points = 'vinlidar_points'
-    areas = 'vinlidar_areas'
-    las_file = 'vinlidar_mask_points.las'
-    imported_points = 'vinlidar_imported_points'
+    points = "vinlidar_points"
+    areas = "vinlidar_areas"
+    las_file = "vinlidar_mask_points.las"
+    imported_points = "vinlidar_imported_points"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and generated data"""
         """Ensures expected computational region and generated data"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
-        cls.runModule('v.in.ascii', input='-', output=cls.points,
-                      separator='comma', format='point', stdin_=POINTS)
-        cls.runModule('v.in.ascii', input='-', output=cls.areas,
-                      format='standard', stdin_=AREAS)
-        cls.runModule('v.out.lidar', input=cls.points,
-            output=cls.las_file)
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
+        cls.runModule(
+            "v.in.ascii",
+            input="-",
+            output=cls.points,
+            separator="comma",
+            format="point",
+            stdin_=POINTS,
+        )
+        cls.runModule(
+            "v.in.ascii", input="-", output=cls.areas, format="standard", stdin_=AREAS
+        )
+        cls.runModule("v.out.lidar", input=cls.points, output=cls.las_file)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove the temporary region and generated data"""
         """Remove the temporary region and generated data"""
-        cls.runModule('g.remove', flags='f', type='vector',
-            name=(cls.points, cls.areas))
+        cls.runModule(
+            "g.remove", flags="f", type="vector", name=(cls.points, cls.areas)
+        )
         if os.path.isfile(cls.las_file):
         if os.path.isfile(cls.las_file):
             os.remove(cls.las_file)
             os.remove(cls.las_file)
         cls.del_temp_region()
         cls.del_temp_region()
@@ -120,38 +127,46 @@ class VectorMaskTest(TestCase):
 
 
         This is executed after each test run.
         This is executed after each test run.
         """
         """
-        self.runModule('g.remove', flags='f', type='vector',
-            name=self.imported_points)
+        self.runModule("g.remove", flags="f", type="vector", name=self.imported_points)
 
 
     def test_no_mask(self):
     def test_no_mask(self):
         """Test to see if the standard outputs are created"""
         """Test to see if the standard outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt')
+        self.assertModule(
+            "v.in.lidar", input=self.las_file, output=self.imported_points, flags="bt"
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=19))
+            vector=self.imported_points, reference=dict(points=19)
+        )
 
 
     def test_mask(self):
     def test_mask(self):
         """Test to see if the standard outputs are created"""
         """Test to see if the standard outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            mask=self.areas)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            mask=self.areas,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=11))
+            vector=self.imported_points, reference=dict(points=11)
+        )
 
 
     def test_inverted_mask(self):
     def test_inverted_mask(self):
         """Test to see if the standard outputs are created"""
         """Test to see if the standard outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='btu',
-            mask=self.areas)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="btu",
+            mask=self.areas,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=8))
+            vector=self.imported_points, reference=dict(points=8)
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 23 - 16
vector/v.in.lidar/testsuite/test_v_in_lidar_basic.py

@@ -21,26 +21,31 @@ class BasicTest(TestCase):
     """
     """
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    vector_points = 'vinlidar_basic_original'
-    imported_points = 'vinlidar_basic_imported'
-    las_file = 'vinlidar_basic_points.las'
+    vector_points = "vinlidar_basic_original"
+    imported_points = "vinlidar_basic_imported"
+    las_file = "vinlidar_basic_points.las"
     npoints = 300
     npoints = 300
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and generated data"""
         """Ensures expected computational region and generated data"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
-        cls.runModule('v.random', flags='zb', output=cls.vector_points,
-            npoints=cls.npoints, zmin=200, zmax=500, seed=100)
-        cls.runModule('v.out.lidar', input=cls.vector_points,
-            output=cls.las_file)
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
+        cls.runModule(
+            "v.random",
+            flags="zb",
+            output=cls.vector_points,
+            npoints=cls.npoints,
+            zmin=200,
+            zmax=500,
+            seed=100,
+        )
+        cls.runModule("v.out.lidar", input=cls.vector_points, output=cls.las_file)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove the temporary region and generated data"""
         """Remove the temporary region and generated data"""
-        cls.runModule('g.remove', flags='f', type='vector',
-            name=cls.vector_points)
+        cls.runModule("g.remove", flags="f", type="vector", name=cls.vector_points)
         if os.path.isfile(cls.las_file):
         if os.path.isfile(cls.las_file):
             os.remove(cls.las_file)
             os.remove(cls.las_file)
         cls.del_temp_region()
         cls.del_temp_region()
@@ -50,19 +55,21 @@ class BasicTest(TestCase):
 
 
         This is executed after each test run.
         This is executed after each test run.
         """
         """
-        self.runModule('g.remove', flags='f', type='vector',
-            name=self.imported_points)
+        self.runModule("g.remove", flags="f", type="vector", name=self.imported_points)
 
 
     def test_output_identical(self):
     def test_output_identical(self):
         """Test to see if the standard outputs are created"""
         """Test to see if the standard outputs are created"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt')
+        self.assertModule(
+            "v.in.lidar", input=self.las_file, output=self.imported_points, flags="bt"
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorEqualsVector(
         self.assertVectorEqualsVector(
             actual=self.imported_points,
             actual=self.imported_points,
             reference=self.vector_points,
             reference=self.vector_points,
-            digits=2, precision=.01)
+            digits=2,
+            precision=0.01,
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 96 - 60
vector/v.in.lidar/testsuite/test_v_in_lidar_filter.py

@@ -44,34 +44,43 @@ class FilterTest(TestCase):
     """
     """
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    vector_points = 'vinlidar_filters_original'
-    imported_points = 'vinlidar_filters_imported'
-    las_file = 'vinlidar_filters_points.las'
+    vector_points = "vinlidar_filters_original"
+    imported_points = "vinlidar_filters_imported"
+    las_file = "vinlidar_filters_points.las"
     npoints = 300
     npoints = 300
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and generated data"""
         """Ensures expected computational region and generated data"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
-        cls.runModule('v.in.ascii', input='-', stdin_=POINTS,
-                      flags='z', z=3, cat=0, separator='comma',
-                      output=cls.vector_points,
-                      columns="x double precision, y double precision,"
-                              " z double precision, return_n integer,"
-                              " n_returns integer, class_n integer")
-        cls.runModule('v.out.lidar',
-                      input=cls.vector_points, layer=1,
-                      output=cls.las_file,
-                      return_column='return_n',
-                      n_returns_column='n_returns',
-                      class_column='class_n')
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
+        cls.runModule(
+            "v.in.ascii",
+            input="-",
+            stdin_=POINTS,
+            flags="z",
+            z=3,
+            cat=0,
+            separator="comma",
+            output=cls.vector_points,
+            columns="x double precision, y double precision,"
+            " z double precision, return_n integer,"
+            " n_returns integer, class_n integer",
+        )
+        cls.runModule(
+            "v.out.lidar",
+            input=cls.vector_points,
+            layer=1,
+            output=cls.las_file,
+            return_column="return_n",
+            n_returns_column="n_returns",
+            class_column="class_n",
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove the temporary region and generated data"""
         """Remove the temporary region and generated data"""
-        cls.runModule('g.remove', flags='f', type='vector',
-            name=cls.vector_points)
+        cls.runModule("g.remove", flags="f", type="vector", name=cls.vector_points)
         if os.path.isfile(cls.las_file):
         if os.path.isfile(cls.las_file):
             os.remove(cls.las_file)
             os.remove(cls.las_file)
         cls.del_temp_region()
         cls.del_temp_region()
@@ -81,52 +90,60 @@ class FilterTest(TestCase):
 
 
         This is executed after each test run.
         This is executed after each test run.
         """
         """
-        self.runModule('g.remove', flags='f', type='vector',
-            name=self.imported_points)
+        self.runModule("g.remove", flags="f", type="vector", name=self.imported_points)
 
 
     def test_no_filter(self):
     def test_no_filter(self):
         """Test to see if the standard outputs are created
         """Test to see if the standard outputs are created
 
 
         This shows if the inpute data are as expected.
         This shows if the inpute data are as expected.
         """
         """
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt')
+        self.assertModule(
+            "v.in.lidar", input=self.las_file, output=self.imported_points, flags="bt"
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=19))
+            vector=self.imported_points, reference=dict(points=19)
+        )
 
 
     def return_filter(self, name, npoints):
     def return_filter(self, name, npoints):
         """Mid return filter test"""
         """Mid return filter test"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            return_filter=name)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            return_filter=name,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=npoints))
+            vector=self.imported_points, reference=dict(points=npoints)
+        )
 
 
     def test_first_return_filter(self):
     def test_first_return_filter(self):
         """First return filter test"""
         """First return filter test"""
-        self.return_filter('first', 9)
+        self.return_filter("first", 9)
 
 
     def test_mid_return_filter(self):
     def test_mid_return_filter(self):
         """Mid return filter test"""
         """Mid return filter test"""
-        self.return_filter('mid', 5)
+        self.return_filter("mid", 5)
 
 
     def test_last_return_filter(self):
     def test_last_return_filter(self):
         """Last return filter test"""
         """Last return filter test"""
-        self.return_filter('last', 5)
+        self.return_filter("last", 5)
 
 
     def class_filter(self, class_n, npoints):
     def class_filter(self, class_n, npoints):
         """Actual code for testing class filter"""
         """Actual code for testing class filter"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            class_filter=class_n)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            class_filter=class_n,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=npoints))
+            vector=self.imported_points, reference=dict(points=npoints)
+        )
 
 
     def test_class_2_filter(self):
     def test_class_2_filter(self):
         """Test to filter classes"""
         """Test to filter classes"""
@@ -146,31 +163,40 @@ class FilterTest(TestCase):
 
 
     def return_and_class_filter(self, return_name, class_n, npoints):
     def return_and_class_filter(self, return_name, class_n, npoints):
         """Return and class filter combined test code"""
         """Return and class filter combined test code"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            return_filter=return_name, class_filter=class_n)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            return_filter=return_name,
+            class_filter=class_n,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=npoints))
+            vector=self.imported_points, reference=dict(points=npoints)
+        )
 
 
     def test_first_return_and_class_filter(self):
     def test_first_return_and_class_filter(self):
         """Combined test for return and class"""
         """Combined test for return and class"""
-        self.return_and_class_filter('first', 2, 2)
+        self.return_and_class_filter("first", 2, 2)
 
 
     def test_last_return_and_class_filter(self):
     def test_last_return_and_class_filter(self):
         """Combined test for return and class"""
         """Combined test for return and class"""
-        self.return_and_class_filter('last', 5, 3)
+        self.return_and_class_filter("last", 5, 3)
 
 
     def zrange_filter(self, zrange, npoints):
     def zrange_filter(self, zrange, npoints):
         """Actual code for zrange option test"""
         """Actual code for zrange option test"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            zrange=zrange)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            zrange=zrange,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=npoints))
+            vector=self.imported_points, reference=dict(points=npoints)
+        )
 
 
     def test_zrange_filter(self):
     def test_zrange_filter(self):
         """Test zrange option"""
         """Test zrange option"""
@@ -185,24 +211,34 @@ class FilterTest(TestCase):
 
 
     def test_zrange_and_class_filter(self):
     def test_zrange_and_class_filter(self):
         """zrange and class_filter option combined test"""
         """zrange and class_filter option combined test"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            zrange=(141, 900), class_filter=5)
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            zrange=(141, 900),
+            class_filter=5,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=4))
+            vector=self.imported_points, reference=dict(points=4)
+        )
 
 
     def test_zrange_and_return_filter(self):
     def test_zrange_and_return_filter(self):
         """zrange and class_filter option combined test"""
         """zrange and class_filter option combined test"""
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt',
-            zrange=(141, 900), return_filter='last')
+        self.assertModule(
+            "v.in.lidar",
+            input=self.las_file,
+            output=self.imported_points,
+            flags="bt",
+            zrange=(141, 900),
+            return_filter="last",
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=2))
+            vector=self.imported_points, reference=dict(points=2)
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 38 - 20
vector/v.in.pdal/testsuite/test_v_in_pdal_basic.py

@@ -15,6 +15,7 @@ from grass.gunittest.main import test
 import unittest
 import unittest
 from grass.script import shutil_which
 from grass.script import shutil_which
 
 
+
 class BasicTest(TestCase):
 class BasicTest(TestCase):
     """Test case for watershed module
     """Test case for watershed module
 
 
@@ -22,29 +23,44 @@ class BasicTest(TestCase):
     """
     """
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    vector_generated = 'vinlidar_basic_generated'
-    vector_points = 'vinlidar_basic_original'
-    imported_points = 'vinlidar_basic_imported'
-    las_file = 'vinlidar_basic_points.las'
+    vector_generated = "vinlidar_basic_generated"
+    vector_points = "vinlidar_basic_original"
+    imported_points = "vinlidar_basic_imported"
+    las_file = "vinlidar_basic_points.las"
     npoints = 300
     npoints = 300
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and generated data"""
         """Ensures expected computational region and generated data"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
-        cls.runModule('v.random', flags='zb', output=cls.vector_generated,
-            npoints=cls.npoints, zmin=200, zmax=500, seed=100)
-        cls.runModule('v.category', input=cls.vector_generated,
-            output=cls.vector_points, option='del', cat=-1)
-        cls.runModule('v.out.lidar', input=cls.vector_points,
-            output=cls.las_file)
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
+        cls.runModule(
+            "v.random",
+            flags="zb",
+            output=cls.vector_generated,
+            npoints=cls.npoints,
+            zmin=200,
+            zmax=500,
+            seed=100,
+        )
+        cls.runModule(
+            "v.category",
+            input=cls.vector_generated,
+            output=cls.vector_points,
+            option="del",
+            cat=-1,
+        )
+        cls.runModule("v.out.lidar", input=cls.vector_points, output=cls.las_file)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove the temporary region and generated data"""
         """Remove the temporary region and generated data"""
-        cls.runModule('g.remove', flags='f', type='vector',
-            name=(cls.vector_points, cls.vector_generated))
+        cls.runModule(
+            "g.remove",
+            flags="f",
+            type="vector",
+            name=(cls.vector_points, cls.vector_generated),
+        )
         if os.path.isfile(cls.las_file):
         if os.path.isfile(cls.las_file):
             os.remove(cls.las_file)
             os.remove(cls.las_file)
         cls.del_temp_region()
         cls.del_temp_region()
@@ -54,20 +70,22 @@ class BasicTest(TestCase):
 
 
         This is executed after each test run.
         This is executed after each test run.
         """
         """
-        self.runModule('g.remove', flags='f', type='vector',
-            name=self.imported_points)
+        self.runModule("g.remove", flags="f", type="vector", name=self.imported_points)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_same_data(self):
     def test_same_data(self):
         """Test to see if the standard outputs are created"""
         """Test to see if the standard outputs are created"""
-        self.assertModule('v.in.pdal', input=self.las_file, flags='c',
-            output=self.imported_points)
+        self.assertModule(
+            "v.in.pdal", input=self.las_file, flags="c", output=self.imported_points
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorEqualsVector(
         self.assertVectorEqualsVector(
             actual=self.imported_points,
             actual=self.imported_points,
             reference=self.vector_points,
             reference=self.vector_points,
-            digits=2, precision=.01)
+            digits=2,
+            precision=0.01,
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 98 - 73
vector/v.in.pdal/testsuite/test_v_in_pdal_filter.py

@@ -45,34 +45,43 @@ class FilterTest(TestCase):
     """
     """
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    vector_points = 'vinlidar_filters_original'
-    imported_points = 'vinlidar_filters_imported'
-    las_file = 'vinlidar_filters_points.las'
+    vector_points = "vinlidar_filters_original"
+    imported_points = "vinlidar_filters_imported"
+    las_file = "vinlidar_filters_points.las"
     npoints = 300
     npoints = 300
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and generated data"""
         """Ensures expected computational region and generated data"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
-        cls.runModule('v.in.ascii', input='-', stdin_=POINTS,
-                      flags='z', z=3, cat=0, separator='comma',
-                      output=cls.vector_points,
-                      columns="x double precision, y double precision,"
-                              " z double precision, return_n integer,"
-                              " n_returns integer, class_n integer")
-        cls.runModule('v.out.lidar',
-                      input=cls.vector_points, layer=1,
-                      output=cls.las_file,
-                      return_column='return_n',
-                      n_returns_column='n_returns',
-                      class_column='class_n')
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
+        cls.runModule(
+            "v.in.ascii",
+            input="-",
+            stdin_=POINTS,
+            flags="z",
+            z=3,
+            cat=0,
+            separator="comma",
+            output=cls.vector_points,
+            columns="x double precision, y double precision,"
+            " z double precision, return_n integer,"
+            " n_returns integer, class_n integer",
+        )
+        cls.runModule(
+            "v.out.lidar",
+            input=cls.vector_points,
+            layer=1,
+            output=cls.las_file,
+            return_column="return_n",
+            n_returns_column="n_returns",
+            class_column="class_n",
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove the temporary region and generated data"""
         """Remove the temporary region and generated data"""
-        cls.runModule('g.remove', flags='f', type='vector',
-            name=cls.vector_points)
+        cls.runModule("g.remove", flags="f", type="vector", name=cls.vector_points)
         if os.path.isfile(cls.las_file):
         if os.path.isfile(cls.las_file):
             os.remove(cls.las_file)
             os.remove(cls.las_file)
         cls.del_temp_region()
         cls.del_temp_region()
@@ -82,117 +91,125 @@ class FilterTest(TestCase):
 
 
         This is executed after each test run.
         This is executed after each test run.
         """
         """
-        self.runModule('g.remove', flags='f', type='vector',
-            name=self.imported_points)
+        self.runModule("g.remove", flags="f", type="vector", name=self.imported_points)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_no_filter(self):
     def test_no_filter(self):
         """Test to see if the standard outputs are created
         """Test to see if the standard outputs are created
 
 
         This shows if the inpute data are as expected.
         This shows if the inpute data are as expected.
         """
         """
-        self.assertModule('v.in.pdal', input=self.las_file,
-            output=self.imported_points)
+        self.assertModule("v.in.pdal", input=self.las_file, output=self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=19))
+            vector=self.imported_points, reference=dict(points=19)
+        )
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def return_filter(self, name, npoints):
     def return_filter(self, name, npoints):
         """Mid return filter test"""
         """Mid return filter test"""
-        self.assertModule('v.in.pdal', input=self.las_file,
+        self.assertModule(
+            "v.in.pdal",
+            input=self.las_file,
             output=self.imported_points,
             output=self.imported_points,
-            return_filter=name)
+            return_filter=name,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=npoints))
+            vector=self.imported_points, reference=dict(points=npoints)
+        )
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_first_return_filter(self):
     def test_first_return_filter(self):
         """First return filter test"""
         """First return filter test"""
-        self.return_filter('first', 9)
+        self.return_filter("first", 9)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_mid_return_filter(self):
     def test_mid_return_filter(self):
         """Mid return filter test"""
         """Mid return filter test"""
-        self.return_filter('mid', 5)
+        self.return_filter("mid", 5)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_last_return_filter(self):
     def test_last_return_filter(self):
         """Last return filter test"""
         """Last return filter test"""
-        self.return_filter('last', 5)
+        self.return_filter("last", 5)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def class_filter(self, class_n, npoints):
     def class_filter(self, class_n, npoints):
         """Actual code for testing class filter"""
         """Actual code for testing class filter"""
-        self.assertModule('v.in.pdal', input=self.las_file,
+        self.assertModule(
+            "v.in.pdal",
+            input=self.las_file,
             output=self.imported_points,
             output=self.imported_points,
-            class_filter=class_n)
+            class_filter=class_n,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=npoints))
+            vector=self.imported_points, reference=dict(points=npoints)
+        )
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_class_2_filter(self):
     def test_class_2_filter(self):
         """Test to filter classes"""
         """Test to filter classes"""
         self.class_filter(2, 2)
         self.class_filter(2, 2)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_class_3_filter(self):
     def test_class_3_filter(self):
         """Test to filter classes"""
         """Test to filter classes"""
         self.class_filter(3, 5)
         self.class_filter(3, 5)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_class_4_filter(self):
     def test_class_4_filter(self):
         """Test to filter classes"""
         """Test to filter classes"""
         self.class_filter(4, 4)
         self.class_filter(4, 4)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_class_5_filter(self):
     def test_class_5_filter(self):
         """Test to filter classes"""
         """Test to filter classes"""
         self.class_filter(5, 8)
         self.class_filter(5, 8)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def return_and_class_filter(self, return_name, class_n, npoints):
     def return_and_class_filter(self, return_name, class_n, npoints):
         """Return and class filter combined test code"""
         """Return and class filter combined test code"""
-        self.assertModule('v.in.pdal', input=self.las_file,
+        self.assertModule(
+            "v.in.pdal",
+            input=self.las_file,
             output=self.imported_points,
             output=self.imported_points,
-            return_filter=return_name, class_filter=class_n)
+            return_filter=return_name,
+            class_filter=class_n,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=npoints))
+            vector=self.imported_points, reference=dict(points=npoints)
+        )
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_first_return_and_class_filter(self):
     def test_first_return_and_class_filter(self):
         """Combined test for return and class"""
         """Combined test for return and class"""
-        self.return_and_class_filter('first', 2, 2)
+        self.return_and_class_filter("first", 2, 2)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_last_return_and_class_filter(self):
     def test_last_return_and_class_filter(self):
         """Combined test for return and class"""
         """Combined test for return and class"""
-        self.return_and_class_filter('last', 5, 3)
+        self.return_and_class_filter("last", 5, 3)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def zrange_filter(self, zrange, npoints):
     def zrange_filter(self, zrange, npoints):
         """Actual code for zrange option test"""
         """Actual code for zrange option test"""
-        self.assertModule('v.in.pdal', input=self.las_file,
-            output=self.imported_points,
-            zrange=zrange)
+        self.assertModule(
+            "v.in.pdal", input=self.las_file, output=self.imported_points, zrange=zrange
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=npoints))
+            vector=self.imported_points, reference=dict(points=npoints)
+        )
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_zrange_filter(self):
     def test_zrange_filter(self):
         """Test zrange option"""
         """Test zrange option"""
         self.zrange_filter((130.1, 139.9), 3)
         self.zrange_filter((130.1, 139.9), 3)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_non_int_zrange_filter(self):
     def test_non_int_zrange_filter(self):
         """Test zrange option with float number
         """Test zrange option with float number
 
 
@@ -200,28 +217,36 @@ class FilterTest(TestCase):
         """
         """
         self.zrange_filter((140.5, 900), 8)
         self.zrange_filter((140.5, 900), 8)
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_zrange_and_class_filter(self):
     def test_zrange_and_class_filter(self):
         """zrange and class_filter option combined test"""
         """zrange and class_filter option combined test"""
-        self.assertModule('v.in.pdal', input=self.las_file,
+        self.assertModule(
+            "v.in.pdal",
+            input=self.las_file,
             output=self.imported_points,
             output=self.imported_points,
-            zrange=(141, 900), class_filter=5)
+            zrange=(141, 900),
+            class_filter=5,
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=4))
+            vector=self.imported_points, reference=dict(points=4)
+        )
 
 
-    @unittest.skipIf(shutil_which('v.in.pdal') is None, "Cannot find v.in.pdal")
+    @unittest.skipIf(shutil_which("v.in.pdal") is None, "Cannot find v.in.pdal")
     def test_zrange_and_return_filter(self):
     def test_zrange_and_return_filter(self):
         """zrange and class_filter option combined test"""
         """zrange and class_filter option combined test"""
-        self.assertModule('v.in.pdal', input=self.las_file,
+        self.assertModule(
+            "v.in.pdal",
+            input=self.las_file,
             output=self.imported_points,
             output=self.imported_points,
-            zrange=(141, 900), return_filter='last')
+            zrange=(141, 900),
+            return_filter="last",
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorFitsTopoInfo(
         self.assertVectorFitsTopoInfo(
-            vector=self.imported_points,
-            reference=dict(points=2))
+            vector=self.imported_points, reference=dict(points=2)
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 176 - 105
vector/v.info/testsuite/test_vinfo.py

@@ -3,135 +3,206 @@ from grass.gunittest.main import test
 
 
 
 
 class TestVInfo(TestCase):
 class TestVInfo(TestCase):
-    """Test the shell output of v.info that is not location/mapset or user dependent
-    """
+    """Test the shell output of v.info that is not location/mapset or user dependent"""
 
 
-    test_vinfo_no_db = 'test_vinfo_no_db'
-    test_vinfo_with_db = 'test_vinfo_with_db'
-    test_vinfo_with_db_3d = 'test_vinfo_with_db_3d'
+    test_vinfo_no_db = "test_vinfo_no_db"
+    test_vinfo_with_db = "test_vinfo_with_db"
+    test_vinfo_with_db_3d = "test_vinfo_with_db_3d"
 
 
     # All maps should be tested against these references
     # All maps should be tested against these references
-    reference = dict(format="native", level=2,
-                     nodes=0, points=5, lines=0, boundaries=0,
-                     centroids=0, areas=0, islands=0, primitives=5,
-                     scale="1:1")
+    reference = dict(
+        format="native",
+        level=2,
+        nodes=0,
+        points=5,
+        lines=0,
+        boundaries=0,
+        centroids=0,
+        areas=0,
+        islands=0,
+        primitives=5,
+        scale="1:1",
+    )
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Generate some vector layer with attribute table, z coordinates
         """Generate some vector layer with attribute table, z coordinates
         and timestamp
         and timestamp
         """
         """
-        cls.runModule('v.random', output=cls.test_vinfo_no_db, npoints=5,
-                      zmin=0, zmax=100)
-
-        cls.runModule('v.random', output=cls.test_vinfo_with_db, npoints=5,
-                      zmin=0, zmax=100,
-                      column="elevation")
-
-        cls.runModule('v.random', output=cls.test_vinfo_with_db_3d, npoints=5,
-                      zmin=0, zmax=100,
-                      column="elevation",
-                      flags="z")
-
-        cls.runModule("v.timestamp", map=cls.test_vinfo_with_db_3d, date='15 jan 1994')
+        cls.runModule(
+            "v.random", output=cls.test_vinfo_no_db, npoints=5, zmin=0, zmax=100
+        )
+
+        cls.runModule(
+            "v.random",
+            output=cls.test_vinfo_with_db,
+            npoints=5,
+            zmin=0,
+            zmax=100,
+            column="elevation",
+        )
+
+        cls.runModule(
+            "v.random",
+            output=cls.test_vinfo_with_db_3d,
+            npoints=5,
+            zmin=0,
+            zmax=100,
+            column="elevation",
+            flags="z",
+        )
+
+        cls.runModule("v.timestamp", map=cls.test_vinfo_with_db_3d, date="15 jan 1994")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        """Remove created maps
-        """
-        cls.runModule('g.remove', flags='f', type='vector',
-                      name=[cls.test_vinfo_no_db,
-                            cls.test_vinfo_with_db,
-                            cls.test_vinfo_with_db_3d])
+        """Remove created maps"""
+        cls.runModule(
+            "g.remove",
+            flags="f",
+            type="vector",
+            name=[
+                cls.test_vinfo_no_db,
+                cls.test_vinfo_with_db,
+                cls.test_vinfo_with_db_3d,
+            ],
+        )
 
 
     def test_smoke(self):
     def test_smoke(self):
-        """Simply test running the module with different parameters
-        """
-        self.assertModule('v.info', map=self.test_vinfo_with_db_3d)
-        self.assertModule('v.info', map=self.test_vinfo_with_db_3d, flags='e')
-        self.assertModule('v.info', map=self.test_vinfo_with_db_3d, flags='et')
-        self.assertModule('v.info', map=self.test_vinfo_with_db_3d, flags='tg')
-        self.assertModule('v.info', map=self.test_vinfo_with_db_3d, flags='t')
-        self.assertModule('v.info', map=self.test_vinfo_with_db_3d, flags='c')
-        self.assertModule('v.info', map=self.test_vinfo_with_db_3d, flags='h')
+        """Simply test running the module with different parameters"""
+        self.assertModule("v.info", map=self.test_vinfo_with_db_3d)
+        self.assertModule("v.info", map=self.test_vinfo_with_db_3d, flags="e")
+        self.assertModule("v.info", map=self.test_vinfo_with_db_3d, flags="et")
+        self.assertModule("v.info", map=self.test_vinfo_with_db_3d, flags="tg")
+        self.assertModule("v.info", map=self.test_vinfo_with_db_3d, flags="t")
+        self.assertModule("v.info", map=self.test_vinfo_with_db_3d, flags="c")
+        self.assertModule("v.info", map=self.test_vinfo_with_db_3d, flags="h")
 
 
     def test_common_references(self):
     def test_common_references(self):
-        """Test all maps against the common references
-        """
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_no_db, flags='etg',
-                                  sep="=", precision=0.1,
-                                  reference=self.reference)
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_with_db, flags='etg',
-                                  sep="=", precision=0.1,
-                                  reference=self.reference)
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_with_db_3d, flags='etg',
-                                  sep="=", precision=0.1,
-                                  reference=self.reference)
+        """Test all maps against the common references"""
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_no_db,
+            flags="etg",
+            sep="=",
+            precision=0.1,
+            reference=self.reference,
+        )
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_with_db,
+            flags="etg",
+            sep="=",
+            precision=0.1,
+            reference=self.reference,
+        )
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_with_db_3d,
+            flags="etg",
+            sep="=",
+            precision=0.1,
+            reference=self.reference,
+        )
 
 
     def test_info_no_db(self):
     def test_info_no_db(self):
-        """Test the simple vector map
-        """
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_no_db, flags='etg',
-                                  sep="=", precision=0.1,
-                                  reference=dict(name=self.test_vinfo_no_db,
-                                                 map3d=0,
-                                                 num_dblinks=0,
-                                                 bottom=0.0,
-                                                 top=0.0))
+        """Test the simple vector map"""
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_no_db,
+            flags="etg",
+            sep="=",
+            precision=0.1,
+            reference=dict(
+                name=self.test_vinfo_no_db, map3d=0, num_dblinks=0, bottom=0.0, top=0.0
+            ),
+        )
 
 
     def test_info_with_db(self):
     def test_info_with_db(self):
-        """Test the vector map with database
-        """
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_with_db, flags='etg',
-                                  sep="=", precision=0.1, layer="1",
-                                  reference=dict(name=self.test_vinfo_with_db,
-                                                 num_dblinks=1,
-                                                 attribute_layer_name=self.test_vinfo_with_db,
-                                                 attribute_layer_number=1,
-                                                 attribute_database_driver="sqlite",
-                                                 attribute_table=self.test_vinfo_with_db,
-                                                 attribute_primary_key="cat",
-                                                 timestamp="none",
-                                                 map3d=0,
-                                                 bottom=0.0,
-                                                 top=0.0))
+        """Test the vector map with database"""
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_with_db,
+            flags="etg",
+            sep="=",
+            precision=0.1,
+            layer="1",
+            reference=dict(
+                name=self.test_vinfo_with_db,
+                num_dblinks=1,
+                attribute_layer_name=self.test_vinfo_with_db,
+                attribute_layer_number=1,
+                attribute_database_driver="sqlite",
+                attribute_table=self.test_vinfo_with_db,
+                attribute_primary_key="cat",
+                timestamp="none",
+                map3d=0,
+                bottom=0.0,
+                top=0.0,
+            ),
+        )
 
 
     def test_info_with_db_wrong_layer(self):
     def test_info_with_db_wrong_layer(self):
-        """Test the vector map with database and set the wrong layer, the output should not contain attribute data
-        """
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_with_db, flags='etg',
-                                  sep="=", precision=0.1, layer="2",
-                                  reference=dict(name=self.test_vinfo_with_db,
-                                                 num_dblinks=1,
-                                                 timestamp="none",
-                                                 map3d=0,
-                                                 bottom=0.0,
-                                                 top=0.0))
+        """Test the vector map with database and set the wrong layer, the output should not contain attribute data"""
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_with_db,
+            flags="etg",
+            sep="=",
+            precision=0.1,
+            layer="2",
+            reference=dict(
+                name=self.test_vinfo_with_db,
+                num_dblinks=1,
+                timestamp="none",
+                map3d=0,
+                bottom=0.0,
+                top=0.0,
+            ),
+        )
 
 
     def test_info_with_db_3d(self):
     def test_info_with_db_3d(self):
-        """Test the vector map with database, z coordinates and timestamp
-        """
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_with_db_3d, flags='etg',
-                                  sep="=", precision=0.1, layer="1",
-                                  reference=dict(name=self.test_vinfo_with_db_3d,
-                                                 num_dblinks=1,
-                                                 attribute_layer_name=self.test_vinfo_with_db_3d,
-                                                 attribute_layer_number=1,
-                                                 attribute_database_driver="sqlite",
-                                                 attribute_table=self.test_vinfo_with_db_3d,
-                                                 attribute_primary_key="cat",
-                                                 map3d=1, timestamp='15 Jan 1994'))
+        """Test the vector map with database, z coordinates and timestamp"""
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_with_db_3d,
+            flags="etg",
+            sep="=",
+            precision=0.1,
+            layer="1",
+            reference=dict(
+                name=self.test_vinfo_with_db_3d,
+                num_dblinks=1,
+                attribute_layer_name=self.test_vinfo_with_db_3d,
+                attribute_layer_number=1,
+                attribute_database_driver="sqlite",
+                attribute_table=self.test_vinfo_with_db_3d,
+                attribute_primary_key="cat",
+                map3d=1,
+                timestamp="15 Jan 1994",
+            ),
+        )
 
 
     def test_database_table(self):
     def test_database_table(self):
-        """Test the database table column and type of the two vector maps with attribute data
-        """
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_with_db, flags='c',
-                                  sep="|", precision=0.1,
-                                  reference={"INTEGER":"cat", "DOUBLE PRECISION":"elevation"})
-
-        self.assertModuleKeyValue('v.info', map=self.test_vinfo_with_db, flags='c',
-                                  sep="|", precision=0.1,
-                                  reference={"INTEGER":"cat", "DOUBLE PRECISION":"elevation"})
-
-if __name__ == '__main__':
+        """Test the database table column and type of the two vector maps with attribute data"""
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_with_db,
+            flags="c",
+            sep="|",
+            precision=0.1,
+            reference={"INTEGER": "cat", "DOUBLE PRECISION": "elevation"},
+        )
+
+        self.assertModuleKeyValue(
+            "v.info",
+            map=self.test_vinfo_with_db,
+            flags="c",
+            sep="|",
+            precision=0.1,
+            reference={"INTEGER": "cat", "DOUBLE PRECISION": "elevation"},
+        )
+
+
+if __name__ == "__main__":
     test()
     test()

+ 29 - 13
vector/v.net/testsuite/test_v_net.py

@@ -5,46 +5,62 @@ from grass.script.core import read_command
 
 
 class TestVNet(TestCase):
 class TestVNet(TestCase):
 
 
-    network = 'test_vnet'
+    network = "test_vnet"
 
 
     def tearDown(cls):
     def tearDown(cls):
         """Remove viewshed map after each test method"""
         """Remove viewshed map after each test method"""
         # TODO: eventually, removing maps should be handled through testing framework functions
         # TODO: eventually, removing maps should be handled through testing framework functions
-        cls.runModule('g.remove', flags='f', type='vector',
-                      name=cls.network)
+        cls.runModule("g.remove", flags="f", type="vector", name=cls.network)
 
 
     def test_nodes(self):
     def test_nodes(self):
         """Test"""
         """Test"""
-        self.assertModule('v.net', input='streets', output=self.network, operation='nodes')
+        self.assertModule(
+            "v.net", input="streets", output=self.network, operation="nodes"
+        )
         topology = dict(points=41813, nodes=41813, lines=49746)
         topology = dict(points=41813, nodes=41813, lines=49746)
         self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
         self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
-        layers = read_command('v.category', input=self.network, option='layers').strip()
+        layers = read_command("v.category", input=self.network, option="layers").strip()
         self.assertEqual(first="1", second=layers, msg="Layers do not match")
         self.assertEqual(first="1", second=layers, msg="Layers do not match")
 
 
     def test_nodes_layers(self):
     def test_nodes_layers(self):
         """Test"""
         """Test"""
-        self.assertModule('v.net', input='streets', output=self.network, operation='nodes', flags='c')
+        self.assertModule(
+            "v.net", input="streets", output=self.network, operation="nodes", flags="c"
+        )
         topology = dict(points=41813, nodes=41813, lines=49746)
         topology = dict(points=41813, nodes=41813, lines=49746)
         self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
         self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
-        layers = read_command('v.category', input=self.network, option='layers').strip()
+        layers = read_command("v.category", input=self.network, option="layers").strip()
         self.assertEqual(first="1\n2", second=layers, msg="Layers do not match")
         self.assertEqual(first="1\n2", second=layers, msg="Layers do not match")
 
 
     def test_connect(self):
     def test_connect(self):
         """Test"""
         """Test"""
-        self.assertModule('v.net', input='streets', points='schools',
-                          output=self.network, operation='connect', threshold=1000)
+        self.assertModule(
+            "v.net",
+            input="streets",
+            points="schools",
+            output=self.network,
+            operation="connect",
+            threshold=1000,
+        )
         topology = dict(points=167, nodes=42136, lines=50069)
         topology = dict(points=167, nodes=42136, lines=50069)
         self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
         self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
-        layers = read_command('v.category', input=self.network, option='layers').strip()
+        layers = read_command("v.category", input=self.network, option="layers").strip()
         self.assertEqual(first="1\n2", second=layers, msg="Layers do not match")
         self.assertEqual(first="1\n2", second=layers, msg="Layers do not match")
 
 
     def test_connect_snap(self):
     def test_connect_snap(self):
         """Test"""
         """Test"""
-        self.assertModule('v.net', input='streets', points='schools', flags='s',
-                          output=self.network, operation='connect', threshold=1000)
+        self.assertModule(
+            "v.net",
+            input="streets",
+            points="schools",
+            flags="s",
+            output=self.network,
+            operation="connect",
+            threshold=1000,
+        )
         topology = dict(points=167, nodes=41969, lines=49902)
         topology = dict(points=167, nodes=41969, lines=49902)
         self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
         self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 24 - 18
vector/v.out.lidar/testsuite/test_v_out_lidar.py

@@ -21,23 +21,29 @@ class BasicTest(TestCase):
     """
     """
 
 
     # Setup variables to be used for outputs
     # Setup variables to be used for outputs
-    vector_points = 'v_out_lidar_original'
-    imported_points = 'v_out_lidar_imported'
-    las_file = 'v_out_lidar_points.las'
+    vector_points = "v_out_lidar_original"
+    imported_points = "v_out_lidar_imported"
+    las_file = "v_out_lidar_points.las"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Ensures expected computational region and generated data"""
         """Ensures expected computational region and generated data"""
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', n=20, s=10, e=25, w=15, res=1)
-        cls.runModule('v.random', flags='zb', output=cls.vector_points,
-            npoints=300, zmin=200, zmax=500, seed=100)
+        cls.runModule("g.region", n=20, s=10, e=25, w=15, res=1)
+        cls.runModule(
+            "v.random",
+            flags="zb",
+            output=cls.vector_points,
+            npoints=300,
+            zmin=200,
+            zmax=500,
+            seed=100,
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove the temporary region and generated data"""
         """Remove the temporary region and generated data"""
-        cls.runModule('g.remove', flags='f', type='vector',
-            name=cls.vector_points)
+        cls.runModule("g.remove", flags="f", type="vector", name=cls.vector_points)
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(self):
     def tearDown(self):
@@ -47,13 +53,11 @@ class BasicTest(TestCase):
         """
         """
         if os.path.isfile(self.las_file):
         if os.path.isfile(self.las_file):
             os.remove(self.las_file)
             os.remove(self.las_file)
-        self.runModule('g.remove', flags='f', type='vector',
-            name=self.imported_points)
+        self.runModule("g.remove", flags="f", type="vector", name=self.imported_points)
 
 
     def test_module_runs_output_created(self):
     def test_module_runs_output_created(self):
         """Test to see if the standard outputs are created"""
         """Test to see if the standard outputs are created"""
-        self.assertModule('v.out.lidar', input=self.vector_points,
-            output=self.las_file)
+        self.assertModule("v.out.lidar", input=self.vector_points, output=self.las_file)
         self.assertFileExists(self.las_file)
         self.assertFileExists(self.las_file)
 
 
     def test_output_identical(self):
     def test_output_identical(self):
@@ -61,16 +65,18 @@ class BasicTest(TestCase):
 
 
         This test depends on v.in.lidar working properly.
         This test depends on v.in.lidar working properly.
         """
         """
-        self.assertModule('v.out.lidar', input=self.vector_points,
-            output=self.las_file)
-        self.assertModule('v.in.lidar', input=self.las_file,
-            output=self.imported_points, flags='bt')
+        self.assertModule("v.out.lidar", input=self.vector_points, output=self.las_file)
+        self.assertModule(
+            "v.in.lidar", input=self.las_file, output=self.imported_points, flags="bt"
+        )
         self.assertVectorExists(self.imported_points)
         self.assertVectorExists(self.imported_points)
         self.assertVectorEqualsVector(
         self.assertVectorEqualsVector(
             actual=self.imported_points,
             actual=self.imported_points,
             reference=self.vector_points,
             reference=self.vector_points,
-            digits=2, precision=.01)
+            digits=2,
+            precision=0.01,
+        )
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 114 - 43
vector/v.profile/testsuite/test_v_profile.py

@@ -18,89 +18,135 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
-output_full = u"""Number|Distance|cat|feature_id|featurenam|class|st_alpha|st_num|county|county_num|primlat_dm|primlon_dm|primlatdec|primlondec|srclat_dms|srclon_dms|srclatdec|srclondec|elev_m|map_name
+output_full = """Number|Distance|cat|feature_id|featurenam|class|st_alpha|st_num|county|county_num|primlat_dm|primlon_dm|primlatdec|primlondec|srclat_dms|srclon_dms|srclatdec|srclondec|elev_m|map_name
 1|19537.97|572|986138|"Greshams Lake"|"Reservoir"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 1|19537.97|572|986138|"Greshams Lake"|"Reservoir"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 2|19537.97|1029|999647|"Greshams Lake Dam"|"Dam"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 2|19537.97|1029|999647|"Greshams Lake Dam"|"Dam"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 """
 """
 
 
-output_nocols = u"""1|19537.97|572|986138|"Greshams Lake"|"Reservoir"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
+output_nocols = """1|19537.97|572|986138|"Greshams Lake"|"Reservoir"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 2|19537.97|1029|999647|"Greshams Lake Dam"|"Dam"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 2|19537.97|1029|999647|"Greshams Lake Dam"|"Dam"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 """
 """
 
 
-output_filtered = u"""Number|Distance|cat|feature_id|featurenam|class|st_alpha|st_num|county|county_num|primlat_dm|primlon_dm|primlatdec|primlondec|srclat_dms|srclon_dms|srclatdec|srclondec|elev_m|map_name
+output_filtered = """Number|Distance|cat|feature_id|featurenam|class|st_alpha|st_num|county|county_num|primlat_dm|primlon_dm|primlatdec|primlondec|srclat_dms|srclon_dms|srclatdec|srclondec|elev_m|map_name
 1|19537.97|1029|999647|"Greshams Lake Dam"|"Dam"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 1|19537.97|1029|999647|"Greshams Lake Dam"|"Dam"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 """
 """
 
 
-output_coords = u"""Number|Distance|cat|feature_id|featurenam|class|st_alpha|st_num|county|county_num|primlat_dm|primlon_dm|primlatdec|primlondec|srclat_dms|srclon_dms|srclatdec|srclondec|elev_m|map_name
+output_coords = """Number|Distance|cat|feature_id|featurenam|class|st_alpha|st_num|county|county_num|primlat_dm|primlon_dm|primlatdec|primlondec|srclat_dms|srclon_dms|srclatdec|srclondec|elev_m|map_name
 1|24.34|572|986138|"Greshams Lake"|"Reservoir"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 1|24.34|572|986138|"Greshams Lake"|"Reservoir"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 2|24.34|1029|999647|"Greshams Lake Dam"|"Dam"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 2|24.34|1029|999647|"Greshams Lake Dam"|"Dam"|"NC"|37|"Wake"|183|"078:34:31W"|"35:52:43N"|35.878484|-78.57528|""|""|""|""|77|"Wake Forest"
 """
 """
 
 
-buf_points = u"""\
+buf_points = """\
 626382.68026139|228917.44816672|1
 626382.68026139|228917.44816672|1
 626643.91393428|228738.2879083|2
 626643.91393428|228738.2879083|2
 626907.14939778|228529.10079092|3
 626907.14939778|228529.10079092|3
 """
 """
-buf_output = u"""\
+buf_output = """\
 Number,Distance,cat,dbl_1,dbl_2,int_1
 Number,Distance,cat,dbl_1,dbl_2,int_1
 1,2102.114,3,626907.14939778,228529.10079092,3
 1,2102.114,3,626907.14939778,228529.10079092,3
 2,2854.300,2,626643.91393428,228738.2879083,2
 2,2854.300,2,626643.91393428,228738.2879083,2
 3,2960.822,1,626382.68026139,228917.44816672,1
 3,2960.822,1,626382.68026139,228917.44816672,1
 """
 """
 
 
+
 class TestProfiling(TestCase):
 class TestProfiling(TestCase):
     to_remove = []
     to_remove = []
-    points = 'test_v_profile_points'
-    in_points = 'poi_names_wake'
-    in_map = 'roadsmajor'
+    points = "test_v_profile_points"
+    in_points = "poi_names_wake"
+    in_map = "roadsmajor"
     where = "cat='354'"
     where = "cat='354'"
     prof_ponts = (647952, 236176, 647950, 236217)
     prof_ponts = (647952, 236176, 647950, 236217)
-    outfile = 'test_out.csv'
+    outfile = "test_out.csv"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         """Create vector map with points for sampling"""
         """Create vector map with points for sampling"""
-        cls.runModule('v.in.ascii', input='-', output=cls.points,
-                      stdin=buf_points)
+        cls.runModule("v.in.ascii", input="-", output=cls.points, stdin=buf_points)
         cls.to_remove.append(cls.points)
         cls.to_remove.append(cls.points)
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         """Remove vector maps"""
         """Remove vector maps"""
         if cls.to_remove:
         if cls.to_remove:
-            cls.runModule('g.remove', flags='f', type='vector',
-                          name=','.join(cls.to_remove), verbose=True)
+            cls.runModule(
+                "g.remove",
+                flags="f",
+                type="vector",
+                name=",".join(cls.to_remove),
+                verbose=True,
+            )
 
 
     def testParsing(self):
     def testParsing(self):
         """Test input parameter parsing"""
         """Test input parameter parsing"""
         # Positive buffer size
         # Positive buffer size
-        self.assertModuleFail('v.profile', input=self.in_points, coordinates=self.prof_ponts, buffer=0)
+        self.assertModuleFail(
+            "v.profile", input=self.in_points, coordinates=self.prof_ponts, buffer=0
+        )
         # Where without input map
         # Where without input map
-        self.assertModuleFail('v.profile', input=self.in_points, coordinates=self.prof_ponts, buffer=10,
-            profile_where=self.where)
+        self.assertModuleFail(
+            "v.profile",
+            input=self.in_points,
+            coordinates=self.prof_ponts,
+            buffer=10,
+            profile_where=self.where,
+        )
         # Both coords and input vector is not supported
         # Both coords and input vector is not supported
-        self.assertModuleFail('v.profile', input=self.in_points, coordinates=self.prof_ponts, buffer=10,
-            profile_map=self.in_map)
+        self.assertModuleFail(
+            "v.profile",
+            input=self.in_points,
+            coordinates=self.prof_ponts,
+            buffer=10,
+            profile_map=self.in_map,
+        )
         # Neither of coords or input line are provided
         # Neither of coords or input line are provided
-        self.assertModuleFail('v.profile', input=self.in_points, buffer=10)
+        self.assertModuleFail("v.profile", input=self.in_points, buffer=10)
         # Two coordinate parirs are reqiured
         # Two coordinate parirs are reqiured
-        self.assertModuleFail('v.profile', input=self.in_points, coordinates=(647952, 236176), buffer=10)
+        self.assertModuleFail(
+            "v.profile", input=self.in_points, coordinates=(647952, 236176), buffer=10
+        )
         # Wrong object match count
         # Wrong object match count
-        self.assertModuleFail('v.profile', input=self.in_points, profile_map=self.in_map, buffer=10,
-            profile_where="ROAD_NAME='wrong'")
-        self.assertModuleFail('v.profile', input=self.in_points, profile_map=self.in_map, buffer=10,
-            profile_where="ROAD_NAME='US-1'")
-        self.assertModuleFail('v.profile', input=self.in_points, profile_map=self.in_map, buffer=10)
-        self.assertModuleFail('v.profile', input=self.in_points, coordinates=self.prof_ponts, buffer=10,
-            where="class='wrong'")
+        self.assertModuleFail(
+            "v.profile",
+            input=self.in_points,
+            profile_map=self.in_map,
+            buffer=10,
+            profile_where="ROAD_NAME='wrong'",
+        )
+        self.assertModuleFail(
+            "v.profile",
+            input=self.in_points,
+            profile_map=self.in_map,
+            buffer=10,
+            profile_where="ROAD_NAME='US-1'",
+        )
+        self.assertModuleFail(
+            "v.profile", input=self.in_points, profile_map=self.in_map, buffer=10
+        )
+        self.assertModuleFail(
+            "v.profile",
+            input=self.in_points,
+            coordinates=self.prof_ponts,
+            buffer=10,
+            where="class='wrong'",
+        )
         # Wrong output name
         # Wrong output name
-        self.assertModuleFail('v.profile', input=self.in_points, coordinates=self.prof_ponts, buffer=10,
-            map_output='5cats')
+        self.assertModuleFail(
+            "v.profile",
+            input=self.in_points,
+            coordinates=self.prof_ponts,
+            buffer=10,
+            map_output="5cats",
+        )
 
 
     def testFileExists(self):
     def testFileExists(self):
         """This function checks if the output file is written correctly"""
         """This function checks if the output file is written correctly"""
-        self.runModule('v.profile', input=self.in_points, coordinates=self.prof_ponts, buffer=10,
-            output=self.outfile)
+        self.runModule(
+            "v.profile",
+            input=self.in_points,
+            coordinates=self.prof_ponts,
+            buffer=10,
+            output=self.outfile,
+        )
         self.assertFileExists(self.outfile)
         self.assertFileExists(self.outfile)
         if os.path.isfile(self.outfile):
         if os.path.isfile(self.outfile):
             os.remove(self.outfile)
             os.remove(self.outfile)
@@ -108,32 +154,57 @@ class TestProfiling(TestCase):
     def testOutput(self):
     def testOutput(self):
         """Test correctness of output"""
         """Test correctness of output"""
         # Normal output
         # Normal output
-        vpro = SimpleModule('v.profile', input=self.in_points, profile_map=self.in_map, buffer=200,
-            profile_where=self.where)
+        vpro = SimpleModule(
+            "v.profile",
+            input=self.in_points,
+            profile_map=self.in_map,
+            buffer=200,
+            profile_where=self.where,
+        )
         vpro.run()
         vpro.run()
         self.assertLooksLike(reference=output_full, actual=vpro.outputs.stdout)
         self.assertLooksLike(reference=output_full, actual=vpro.outputs.stdout)
         # Without column names
         # Without column names
-        vpro = SimpleModule('v.profile', input=self.in_points, profile_map=self.in_map, buffer=200,
-            profile_where=self.where, c=True)
+        vpro = SimpleModule(
+            "v.profile",
+            input=self.in_points,
+            profile_map=self.in_map,
+            buffer=200,
+            profile_where=self.where,
+            c=True,
+        )
         vpro.run()
         vpro.run()
         self.assertLooksLike(reference=output_nocols, actual=vpro.outputs.stdout)
         self.assertLooksLike(reference=output_nocols, actual=vpro.outputs.stdout)
         # Filtering input points
         # Filtering input points
-        vpro = SimpleModule('v.profile', input=self.in_points, profile_map=self.in_map, buffer=200,
-            where="class='Dam'", profile_where=self.where)
+        vpro = SimpleModule(
+            "v.profile",
+            input=self.in_points,
+            profile_map=self.in_map,
+            buffer=200,
+            where="class='Dam'",
+            profile_where=self.where,
+        )
         vpro.run()
         vpro.run()
         self.assertLooksLike(reference=output_filtered, actual=vpro.outputs.stdout)
         self.assertLooksLike(reference=output_filtered, actual=vpro.outputs.stdout)
         # Providing profiling line from coordinates
         # Providing profiling line from coordinates
-        vpro = SimpleModule('v.profile', input=self.in_points, coordinates=self.prof_ponts, buffer=200)
+        vpro = SimpleModule(
+            "v.profile", input=self.in_points, coordinates=self.prof_ponts, buffer=200
+        )
         vpro.run()
         vpro.run()
         self.assertLooksLike(reference=output_coords, actual=vpro.outputs.stdout)
         self.assertLooksLike(reference=output_coords, actual=vpro.outputs.stdout)
 
 
     def testBuffering(self):
     def testBuffering(self):
         """Test against errors in buffering implementation"""
         """Test against errors in buffering implementation"""
-        vpro = SimpleModule('v.profile', input=self.points, separator='comma', dp=3,
-            buffer=500, profile_map=self.in_map, profile_where='cat=193')
+        vpro = SimpleModule(
+            "v.profile",
+            input=self.points,
+            separator="comma",
+            dp=3,
+            buffer=500,
+            profile_map=self.in_map,
+            profile_where="cat=193",
+        )
         vpro.run()
         vpro.run()
 
 
 
 
-
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 38 - 12
vector/v.select/testsuite/test_v_select.py

@@ -31,44 +31,70 @@ class TestRasterReport(TestCase):
         cls.del_temp_region()
         cls.del_temp_region()
 
 
     def tearDown(cls):
     def tearDown(cls):
-        cls.runModule('g.remove', type='vector', flags='f', name=cls.output)
+        cls.runModule("g.remove", type="vector", flags="f", name=cls.output)
 
 
     def test_opo(self):
     def test_opo(self):
         """Testing operator overlap"""
         """Testing operator overlap"""
-        self.assertModule('v.select', ainput=self.ainput, binput=self.binput,
-                          output=self.output, operator='overlap')
+        self.assertModule(
+            "v.select",
+            ainput=self.ainput,
+            binput=self.binput,
+            output=self.output,
+            operator="overlap",
+        )
         topology = dict(points=1088, lines=0, areas=0)
         topology = dict(points=1088, lines=0, areas=0)
         self.assertVectorFitsTopoInfo(self.overlap, topology)
         self.assertVectorFitsTopoInfo(self.overlap, topology)
 
 
     def test_opd(self):
     def test_opd(self):
         """Testign operator disjoint """
         """Testign operator disjoint """
-        self.assertModule('v.select', ainput=self.ainput, binput=self.binput,
-                          output=self.output, operator='disjoint')
+        self.assertModule(
+            "v.select",
+            ainput=self.ainput,
+            binput=self.binput,
+            output=self.output,
+            operator="disjoint",
+        )
         topology = dict(points=167, lines=0, areas=0)
         topology = dict(points=167, lines=0, areas=0)
         self.assertVectorFitsTopoInfo(self.disjoint, topology)
         self.assertVectorFitsTopoInfo(self.disjoint, topology)
 
 
     def test_ope(self):
     def test_ope(self):
         """Testing operator equals """
         """Testing operator equals """
-        self.assertModule('v.select', ainput=self.ainput, binput=self.binput,
-                          output=self.output, operator='equals')
+        self.assertModule(
+            "v.select",
+            ainput=self.ainput,
+            binput=self.binput,
+            output=self.output,
+            operator="equals",
+        )
         topology = dict(points=0, lines=49746, areas=0)
         topology = dict(points=0, lines=49746, areas=0)
         self.assertVectorFitsTopoInfo(self.equals, topology)
         self.assertVectorFitsTopoInfo(self.equals, topology)
 
 
     def test_opt(self):
     def test_opt(self):
         """Testing operator touches"""
         """Testing operator touches"""
-        self.assertModule('v.select', ainput=self.ainput, binput=self.binput,
-                          output=self.output, operator='touches')
+        self.assertModule(
+            "v.select",
+            ainput=self.ainput,
+            binput=self.binput,
+            output=self.output,
+            operator="touches",
+        )
         topology = dict(points=0, lines=0, areas=48)
         topology = dict(points=0, lines=0, areas=48)
         self.assertVectorFitsTopoInfo(self.touches, topology)
         self.assertVectorFitsTopoInfo(self.touches, topology)
 
 
     def test_opw(self):
     def test_opw(self):
         """Testing operator within"""
         """Testing operator within"""
-        self.assertModule('v.select', ainput=self.ainput, binput=self.binput,
-                          output=self.output, operator='within')
+        self.assertModule(
+            "v.select",
+            ainput=self.ainput,
+            binput=self.binput,
+            output=self.output,
+            operator="within",
+        )
         topology = dict(points=1088, lines=0, areas=0)
         topology = dict(points=1088, lines=0, areas=0)
         self.assertVectorFitsTopoInfo(self.within, topology)
         self.assertVectorFitsTopoInfo(self.within, topology)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     from grass.gunittest.main import test
     from grass.gunittest.main import test
+
     test()
     test()

+ 87 - 40
vector/v.surf.rst/testsuite/test_vsurfrst.py

@@ -6,46 +6,74 @@ from grass.gunittest.gmodules import SimpleModule
 
 
 class TestVsurfrst(TestCase):
 class TestVsurfrst(TestCase):
 
 
-    elevation = 'elevation'
-    elevation_attrib = 'elevation_attrib'
-    elevation_threads = 'elevation_threads'
-    slope = 'slope'
-    aspect = 'aspect'
-    pcurvature = 'pcurvature'
-    tcurvature = 'tcurvature'
-    mcurvature = 'mcurvature'
-    deviations = 'deviations'
-    cvdev = 'cvdev'
-    treeseg = 'treeseg'
-    overwin = 'overwin'
+    elevation = "elevation"
+    elevation_attrib = "elevation_attrib"
+    elevation_threads = "elevation_threads"
+    slope = "slope"
+    aspect = "aspect"
+    pcurvature = "pcurvature"
+    tcurvature = "tcurvature"
+    mcurvature = "mcurvature"
+    deviations = "deviations"
+    cvdev = "cvdev"
+    treeseg = "treeseg"
+    overwin = "overwin"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', vector='elev_lid792_randpts', res=1)
-        cls.runModule('v.to.3d', input='elev_lid792_randpts', type='point',
-                      output='elev_points3d', column='value', overwrite=True)
+        cls.runModule("g.region", vector="elev_lid792_randpts", res=1)
+        cls.runModule(
+            "v.to.3d",
+            input="elev_lid792_randpts",
+            type="point",
+            output="elev_points3d",
+            column="value",
+            overwrite=True,
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
         cls.del_temp_region()
         cls.del_temp_region()
-        cls.runModule('g.remove', type=['raster', 'vector'],
-                      name=['elev_points3d', cls.elevation, cls.elevation_threads,
-                            cls.elevation_attrib, cls.slope, cls.aspect, cls.pcurvature,
-                            cls.tcurvature, cls.mcurvature, cls.deviations,
-                            cls.cvdev, cls.treeseg, cls.overwin], flags='f')
+        cls.runModule(
+            "g.remove",
+            type=["raster", "vector"],
+            name=[
+                "elev_points3d",
+                cls.elevation,
+                cls.elevation_threads,
+                cls.elevation_attrib,
+                cls.slope,
+                cls.aspect,
+                cls.pcurvature,
+                cls.tcurvature,
+                cls.mcurvature,
+                cls.deviations,
+                cls.cvdev,
+                cls.treeseg,
+                cls.overwin,
+            ],
+            flags="f",
+        )
 
 
     def setUp(self):
     def setUp(self):
-        self.vsurfrst = SimpleModule('v.surf.rst', input='elev_points3d', npmin=100,
-                                     elevation=self.elevation, overwrite=True)
+        self.vsurfrst = SimpleModule(
+            "v.surf.rst",
+            input="elev_points3d",
+            npmin=100,
+            elevation=self.elevation,
+            overwrite=True,
+        )
 
 
     def test_more_threads(self):
     def test_more_threads(self):
         self.assertModule(self.vsurfrst)
         self.assertModule(self.vsurfrst)
         try:
         try:
-            self.vsurfrst.inputs['nprocs'].value = 4
+            self.vsurfrst.inputs["nprocs"].value = 4
             self.vsurfrst.outputs.elevation = self.elevation_threads
             self.vsurfrst.outputs.elevation = self.elevation_threads
             self.assertModule(self.vsurfrst)
             self.assertModule(self.vsurfrst)
-            self.assertRastersNoDifference(self.elevation, self.elevation_threads, precision=1e-8)
+            self.assertRastersNoDifference(
+                self.elevation, self.elevation_threads, precision=1e-8
+            )
         except KeyError:
         except KeyError:
             # original version of v.surf.rst without parallel processing
             # original version of v.surf.rst without parallel processing
             return
             return
@@ -70,26 +98,42 @@ class TestVsurfrst(TestCase):
         self.assertVectorExists(name=self.deviations)
         self.assertVectorExists(name=self.deviations)
         self.assertVectorExists(name=self.treeseg)
         self.assertVectorExists(name=self.treeseg)
         self.assertVectorExists(name=self.overwin)
         self.assertVectorExists(name=self.overwin)
-        values = 'min=103.973861694336\nmax=131.529937744141\nmean=120.774013407641'
-        self.assertRasterFitsUnivar(raster=self.elevation, reference=values, precision=1e-8)
+        values = "min=103.973861694336\nmax=131.529937744141\nmean=120.774013407641"
+        self.assertRasterFitsUnivar(
+            raster=self.elevation, reference=values, precision=1e-8
+        )
         # slope
         # slope
-        values = 'min=0.00417369091883302\nmax=15.4391813278198\nmean=3.32303673469512'
+        values = "min=0.00417369091883302\nmax=15.4391813278198\nmean=3.32303673469512"
         self.assertRasterFitsUnivar(raster=self.slope, reference=values, precision=1e-8)
         self.assertRasterFitsUnivar(raster=self.slope, reference=values, precision=1e-8)
         # aspect
         # aspect
-        values = 'min=0\nmax=360\nmean=212.026580596575'
-        self.assertRasterFitsUnivar(raster=self.aspect, reference=values, precision=1e-8)
+        values = "min=0\nmax=360\nmean=212.026580596575"
+        self.assertRasterFitsUnivar(
+            raster=self.aspect, reference=values, precision=1e-8
+        )
         # pcurvature
         # pcurvature
-        values = 'min=-0.0507194809615612\nmax=0.0395903363823891\nmean=0.00013527328666273'
-        self.assertRasterFitsUnivar(raster=self.pcurvature, reference=values, precision=1e-8)
+        values = (
+            "min=-0.0507194809615612\nmax=0.0395903363823891\nmean=0.00013527328666273"
+        )
+        self.assertRasterFitsUnivar(
+            raster=self.pcurvature, reference=values, precision=1e-8
+        )
         # tcurvature
         # tcurvature
-        values = 'min=-0.0455724261701107\nmax=0.0380486063659191\nmean=-0.000136686790876467'
-        self.assertRasterFitsUnivar(raster=self.tcurvature, reference=values, precision=1e-8)
+        values = "min=-0.0455724261701107\nmax=0.0380486063659191\nmean=-0.000136686790876467"
+        self.assertRasterFitsUnivar(
+            raster=self.tcurvature, reference=values, precision=1e-8
+        )
         # mcurvature
         # mcurvature
-        values = 'min=-0.0437114611268044\nmax=0.032054178416729\nmean=-6.78450785489373e-07'
-        self.assertRasterFitsUnivar(raster=self.mcurvature, reference=values, precision=1e-8)
+        values = (
+            "min=-0.0437114611268044\nmax=0.032054178416729\nmean=-6.78450785489373e-07"
+        )
+        self.assertRasterFitsUnivar(
+            raster=self.mcurvature, reference=values, precision=1e-8
+        )
         # deviations
         # deviations
-        values = 'min=-0.035444\nmax=0.048801\nmean=4.21945e-05'
-        self.assertVectorFitsUnivar(map=self.deviations, column='flt1', reference=values, precision=1e-8)
+        values = "min=-0.035444\nmax=0.048801\nmean=4.21945e-05"
+        self.assertVectorFitsUnivar(
+            map=self.deviations, column="flt1", reference=values, precision=1e-8
+        )
         # treeseg
         # treeseg
         topology = dict(primitives=256)
         topology = dict(primitives=256)
         self.assertVectorFitsTopoInfo(vector=self.treeseg, reference=topology)
         self.assertVectorFitsTopoInfo(vector=self.treeseg, reference=topology)
@@ -99,9 +143,12 @@ class TestVsurfrst(TestCase):
 
 
         # test 3D versus attribute
         # test 3D versus attribute
         self.vsurfrst.outputs.elevation = self.elevation_attrib
         self.vsurfrst.outputs.elevation = self.elevation_attrib
-        self.vsurfrst.inputs.column = 'value'
+        self.vsurfrst.inputs.column = "value"
         self.assertModule(self.vsurfrst)
         self.assertModule(self.vsurfrst)
-        self.assertRastersNoDifference(self.elevation, self.elevation_attrib, precision=1e-8)
+        self.assertRastersNoDifference(
+            self.elevation, self.elevation_attrib, precision=1e-8
+        )
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 20 - 12
vector/v.to.3d/testsuite/test_vto3d.py

@@ -4,13 +4,13 @@ from grass.gunittest.main import test
 
 
 class TestVTo3D(TestCase):
 class TestVTo3D(TestCase):
 
 
-    contours2d = 'test_vto3d_contours2d'
-    contours3d = 'test_vto3d_contours3d'
+    contours2d = "test_vto3d_contours2d"
+    contours3d = "test_vto3d_contours3d"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
         cls.use_temp_region()
         cls.use_temp_region()
-        cls.runModule('g.region', raster='elevation')
+        cls.runModule("g.region", raster="elevation")
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
@@ -18,21 +18,29 @@ class TestVTo3D(TestCase):
 
 
     def tearDown(cls):
     def tearDown(cls):
         """Remove contours map after each test method"""
         """Remove contours map after each test method"""
-        cls.runModule('g.remove', flags='f', type='vector',
-                      name=[cls.contours2d, cls.contours3d])
+        cls.runModule(
+            "g.remove", flags="f", type="vector", name=[cls.contours2d, cls.contours3d]
+        )
 
 
     def test_contours(self):
     def test_contours(self):
         """Test if results is in expected limits"""
         """Test if results is in expected limits"""
-        self.runModule('r.contour', input='elevation', output=self.contours3d, step=5)
-        self.runModule('v.db.addcolumn', map=self.contours3d, columns="z double precision")
-
-        self.assertModule('v.to.3d', input=self.contours3d, output=self.contours2d,
-                          column='z', flags='r')
+        self.runModule("r.contour", input="elevation", output=self.contours3d, step=5)
+        self.runModule(
+            "v.db.addcolumn", map=self.contours3d, columns="z double precision"
+        )
+
+        self.assertModule(
+            "v.to.3d",
+            input=self.contours3d,
+            output=self.contours2d,
+            column="z",
+            flags="r",
+        )
         is3d = dict(map3d=0)
         is3d = dict(map3d=0)
         self.assertVectorFitsTopoInfo(vector=self.contours2d, reference=is3d)
         self.assertVectorFitsTopoInfo(vector=self.contours2d, reference=is3d)
         missing = dict(nmissing=0, nnull=0)
         missing = dict(nmissing=0, nnull=0)
-        self.assertVectorFitsUnivar(map=self.contours2d, column='z', reference=missing)
+        self.assertVectorFitsUnivar(map=self.contours2d, column="z", reference=missing)
 
 
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 25 - 22
vector/v.univar/testsuite/v_univar_test.py

@@ -12,11 +12,11 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
-class TestProfiling(TestCase):
 
 
+class TestProfiling(TestCase):
     def test_flagg(self):
     def test_flagg(self):
         """Testing flag g with map lakes"""
         """Testing flag g with map lakes"""
-        output_str = u"""n=15279
+        output_str = """n=15279
 nmissing=0
 nmissing=0
 nnull=0
 nnull=0
 min=1
 min=1
@@ -32,14 +32,13 @@ sample_stddev=4410.81
 sample_variance=1.94553e+07
 sample_variance=1.94553e+07
 kurtosis=-1.20024
 kurtosis=-1.20024
 skewness=-2.41826e-14"""
 skewness=-2.41826e-14"""
-        v_univar = SimpleModule("v.univar", flags="g", map='lakes', column='cat')
+        v_univar = SimpleModule("v.univar", flags="g", map="lakes", column="cat")
         v_univar.run()
         v_univar.run()
-        self.assertLooksLike(actual=v_univar.outputs.stdout,
-                             reference=output_str)
+        self.assertLooksLike(actual=v_univar.outputs.stdout, reference=output_str)
 
 
     def test_flage(self):
     def test_flage(self):
         """Testing flag e with map geology"""
         """Testing flag e with map geology"""
-        output_str = u"""number of features with non NULL attribute: 1832
+        output_str = """number of features with non NULL attribute: 1832
 number of missing attributes: 0
 number of missing attributes: 0
 number of NULL attributes: 0
 number of NULL attributes: 0
 minimum: 166.947
 minimum: 166.947
@@ -59,14 +58,15 @@ skewness: 9.7065
 median (even number of cells): 10308.4
 median (even number of cells): 10308.4
 3rd quartile: 29259.1
 3rd quartile: 29259.1
 90th percentile: 86449.7"""
 90th percentile: 86449.7"""
-        v_univar = SimpleModule('v.univar', map='geology', column='PERIMETER', flags='e')
+        v_univar = SimpleModule(
+            "v.univar", map="geology", column="PERIMETER", flags="e"
+        )
         v_univar.run()
         v_univar.run()
-        self.assertLooksLike(actual=v_univar.outputs.stdout,
-                             reference=output_str)
+        self.assertLooksLike(actual=v_univar.outputs.stdout, reference=output_str)
 
 
     def test_flagw(self):
     def test_flagw(self):
         """Testing flag w with map lakes"""
         """Testing flag w with map lakes"""
-        output_str = u"""number of features with non NULL attribute: 15279
+        output_str = """number of features with non NULL attribute: 15279
 number of missing attributes: 0
 number of missing attributes: 0
 number of NULL attributes: 0
 number of NULL attributes: 0
 minimum: 2
 minimum: 2
@@ -75,14 +75,13 @@ range: 15278
 sum: 5.76349e+11
 sum: 5.76349e+11
 mean: 6190.76
 mean: 6190.76
 mean of absolute values: 6190.76"""
 mean of absolute values: 6190.76"""
-        v_univar = SimpleModule('v.univar', map='lakes', column='FULL_HYDRO', flags='w')
+        v_univar = SimpleModule("v.univar", map="lakes", column="FULL_HYDRO", flags="w")
         v_univar.run()
         v_univar.run()
-        self.assertLooksLike(actual=v_univar.outputs.stdout,
-                             reference=output_str)
+        self.assertLooksLike(actual=v_univar.outputs.stdout, reference=output_str)
 
 
     def test_flagd(self):
     def test_flagd(self):
         """Testing flag d with map hospitals"""
         """Testing flag d with map hospitals"""
-        univar_string = u"""number of primitives: 160
+        univar_string = """number of primitives: 160
 number of non zero distances: 12561
 number of non zero distances: 12561
 number of zero distances: 0
 number of zero distances: 0
 minimum: 9.16773
 minimum: 9.16773
@@ -98,30 +97,34 @@ sample standard deviation: 128511
 sample variance: 1.6515e+10
 sample variance: 1.6515e+10
 kurtosis: 0.277564
 kurtosis: 0.277564
 skewness: 0.801646"""
 skewness: 0.801646"""
-        v_univar = SimpleModule('v.univar', map='hospitals', column='CITY', flags='d')
+        v_univar = SimpleModule("v.univar", map="hospitals", column="CITY", flags="d")
         v_univar.run()
         v_univar.run()
-        self.assertLooksLike(actual=v_univar.outputs.stdout,
-                             reference=univar_string)
+        self.assertLooksLike(actual=v_univar.outputs.stdout, reference=univar_string)
 
 
     def test_output(self):
     def test_output(self):
         """Testing output of v.univar"""
         """Testing output of v.univar"""
-        univar_string="""n=160
+        univar_string = """n=160
         min=1
         min=1
         max=160
         max=160
         range=159
         range=159
         mean=80.5
         mean=80.5
         sum=12880"""
         sum=12880"""
-        self.assertVectorFitsUnivar(map='hospitals', column='cat', reference=univar_string, precision=3)
+        self.assertVectorFitsUnivar(
+            map="hospitals", column="cat", reference=univar_string, precision=3
+        )
 
 
     def test_output2(self):
     def test_output2(self):
         """Testing output of v.univar"""
         """Testing output of v.univar"""
-        univar_string="""n=357
+        univar_string = """n=357
         min=1
         min=1
         max=357
         max=357
         range=356
         range=356
         mean=179.82
         mean=179.82
         sum=63836"""
         sum=63836"""
-        self.assertVectorFitsUnivar(map='roadsmajor', column='MAJORRDS_', reference=univar_string, precision=3)
+        self.assertVectorFitsUnivar(
+            map="roadsmajor", column="MAJORRDS_", reference=univar_string, precision=3
+        )
+
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()

+ 71 - 28
vector/v.vect.stats/testsuite/test_vect_stats.py

@@ -12,9 +12,10 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
+
 class Testrr(TestCase):
 class Testrr(TestCase):
-    input='hospitals'
-    areas='zipcodes_wake'
+    input = "hospitals"
+    areas = "zipcodes_wake"
 
 
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
@@ -26,7 +27,7 @@ class Testrr(TestCase):
 
 
     def test_sum(self):
     def test_sum(self):
         """Testing method sum"""
         """Testing method sum"""
-        string="""area_cat|count|sum
+        string = """area_cat|count|sum
         1|0|null
         1|0|null
         2|0|null
         2|0|null
         3|0|null
         3|0|null
@@ -38,15 +39,21 @@ class Testrr(TestCase):
         9|1|7
         9|1|7
         10|0|null
         10|0|null
         """
         """
-        v_vect_stats = SimpleModule('v.vect.stats', points=self.input, areas=self.areas, method='sum', count_column='num_points',
-                                    stats_column='avg_elev', points_column='cat')
-        v_vect_stats.outputs.stdout= string
+        v_vect_stats = SimpleModule(
+            "v.vect.stats",
+            points=self.input,
+            areas=self.areas,
+            method="sum",
+            count_column="num_points",
+            stats_column="avg_elev",
+            points_column="cat",
+        )
+        v_vect_stats.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
 
 
-
     def test_average(self):
     def test_average(self):
         """Testing method average"""
         """Testing method average"""
-        string="""area_cat|count|average
+        string = """area_cat|count|average
         1|1|2681
         1|1|2681
         2|0|null
         2|0|null
         3|2|3958.5
         3|2|3958.5
@@ -58,14 +65,21 @@ class Testrr(TestCase):
         9|4|4222
         9|4|4222
         10|3|4400.33333333333
         10|3|4400.33333333333
         """
         """
-        v_vect_stats = SimpleModule('v.vect.stats', points=self.input, areas=self.areas, method='average', count_column='num_points',
-                                    stats_column='avg_elev', points_column='cat')
-        v_vect_stats.outputs.stdout= string
+        v_vect_stats = SimpleModule(
+            "v.vect.stats",
+            points=self.input,
+            areas=self.areas,
+            method="average",
+            count_column="num_points",
+            stats_column="avg_elev",
+            points_column="cat",
+        )
+        v_vect_stats.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
 
 
     def test_median(self):
     def test_median(self):
         """Testing method variance"""
         """Testing method variance"""
-        string="""area_cat|count|variance
+        string = """area_cat|count|variance
         1|1|0
         1|1|0
         2|0|null
         2|0|null
         3|2|702.25
         3|2|702.25
@@ -77,14 +91,21 @@ class Testrr(TestCase):
         9|4|42.5
         9|4|42.5
         10|3|3968.22222222222
         10|3|3968.22222222222
         """
         """
-        v_vect_stats = SimpleModule('v.vect.stats', points=self.input, areas=self.areas, method='variance', count_column='num_points',
-                                    stats_column='avg_elev', points_column='cat')
-        v_vect_stats.outputs.stdout= string
+        v_vect_stats = SimpleModule(
+            "v.vect.stats",
+            points=self.input,
+            areas=self.areas,
+            method="variance",
+            count_column="num_points",
+            stats_column="avg_elev",
+            points_column="cat",
+        )
+        v_vect_stats.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
 
 
     def test_mincat(self):
     def test_mincat(self):
         """Testing method min_cat"""
         """Testing method min_cat"""
-        string="""area_cat|count|range
+        string = """area_cat|count|range
         1|1|0
         1|1|0
         2|0|null
         2|0|null
         3|2|53
         3|2|53
@@ -96,14 +117,21 @@ class Testrr(TestCase):
         9|4|17
         9|4|17
         10|3|152
         10|3|152
         """
         """
-        v_vect_stats = SimpleModule('v.vect.stats', points=self.input, areas=self.areas, method='range', count_column='num_points',
-                                    stats_column='avg_elev', points_column='cat')
-        v_vect_stats.outputs.stdout= string
+        v_vect_stats = SimpleModule(
+            "v.vect.stats",
+            points=self.input,
+            areas=self.areas,
+            method="range",
+            count_column="num_points",
+            stats_column="avg_elev",
+            points_column="cat",
+        )
+        v_vect_stats.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
 
 
     def test_maxcat(self):
     def test_maxcat(self):
         """Testing method max_cat"""
         """Testing method max_cat"""
-        string="""area_cat|count|max_cat
+        string = """area_cat|count|max_cat
         1|0|null
         1|0|null
         2|0|null
         2|0|null
         3|0|null
         3|0|null
@@ -115,14 +143,21 @@ class Testrr(TestCase):
         9|1|7
         9|1|7
         10|0|null
         10|0|null
         """
         """
-        v_vect_stats = SimpleModule('v.vect.stats', points=self.input, areas=self.areas, method='max_cat', count_column='num_points',
-                                    stats_column='avg_elev', points_column='cat')
-        v_vect_stats.outputs.stdout= string
+        v_vect_stats = SimpleModule(
+            "v.vect.stats",
+            points=self.input,
+            areas=self.areas,
+            method="max_cat",
+            count_column="num_points",
+            stats_column="avg_elev",
+            points_column="cat",
+        )
+        v_vect_stats.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
 
 
     def test_mode(self):
     def test_mode(self):
         """Testing method mode """
         """Testing method mode """
-        string="""area_cat|count|mode
+        string = """area_cat|count|mode
         1|0|null
         1|0|null
         2|0|null
         2|0|null
         3|0|null
         3|0|null
@@ -134,10 +169,18 @@ class Testrr(TestCase):
         9|1|7
         9|1|7
         10|0|null
         10|0|null
         """
         """
-        v_vect_stats = SimpleModule('v.vect.stats', points=self.input, areas=self.areas, method='mode', count_column='num_points',
-                                    stats_column='avg_elev', points_column='cat')
-        v_vect_stats.outputs.stdout= string
+        v_vect_stats = SimpleModule(
+            "v.vect.stats",
+            points=self.input,
+            areas=self.areas,
+            method="mode",
+            count_column="num_points",
+            stats_column="avg_elev",
+            points_column="cat",
+        )
+        v_vect_stats.outputs.stdout = string
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
         self.assertLooksLike(reference=string, actual=v_vect_stats.outputs.stdout)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 37 - 25
vector/v.what/testsuite/test_vwhat_layers.py

@@ -3,7 +3,7 @@ from grass.gunittest.case import TestCase
 from grass.gunittest.main import test
 from grass.gunittest.main import test
 from grass.gunittest.gmodules import SimpleModule
 from grass.gunittest.gmodules import SimpleModule
 
 
-out1 = u"""East: 634243
+out1 = """East: 634243
 North: 226193
 North: 226193
 ------------------------------------------------------------------
 ------------------------------------------------------------------
 Map: test_vector
 Map: test_vector
@@ -24,7 +24,7 @@ Category: 4
 """
 """
 
 
 
 
-out2 = u"""East: 634243
+out2 = """East: 634243
 North: 226193
 North: 226193
 ------------------------------------------------------------------
 ------------------------------------------------------------------
 Map: test_vector
 Map: test_vector
@@ -70,7 +70,7 @@ text : yyy
 number : 8.09
 number : 8.09
 """
 """
 
 
-out3 = u"""East=634243
+out3 = """East=634243
 North=226193
 North=226193
 
 
 Map=test_vector
 Map=test_vector
@@ -112,7 +112,7 @@ text=yyy
 number=8.09
 number=8.09
 """
 """
 
 
-out4 = u"""East=634243
+out4 = """East=634243
 North=226193
 North=226193
 
 
 Map=test_vector
 Map=test_vector
@@ -139,7 +139,7 @@ text=Petrášová
 number=6
 number=6
 """
 """
 
 
-out5 = u"""East=634243
+out5 = """East=634243
 North=226193
 North=226193
 
 
 Map=test_vector
 Map=test_vector
@@ -157,52 +157,63 @@ Category=4
 
 
 
 
 class TestMultiLayerMap(TestCase):
 class TestMultiLayerMap(TestCase):
-
     @classmethod
     @classmethod
     def setUpClass(cls):
     def setUpClass(cls):
-        cls.runModule('v.in.ascii', input='./data/testing.ascii', output='test_vector',
-                      format='standard')
-        cls.runModule('db.connect', flags='c')
-        cls.runModule('db.in.ogr', input='./data/table1.csv', output='t1')
-        cls.runModule('db.in.ogr', input='./data/table2.csv', output='t2')
-        cls.runModule('v.db.connect', map='test_vector', table='t1', key='cat_', layer=1)
-        cls.runModule('v.db.connect', map='test_vector', table='t2', key='cat_', layer=2)
+        cls.runModule(
+            "v.in.ascii",
+            input="./data/testing.ascii",
+            output="test_vector",
+            format="standard",
+        )
+        cls.runModule("db.connect", flags="c")
+        cls.runModule("db.in.ogr", input="./data/table1.csv", output="t1")
+        cls.runModule("db.in.ogr", input="./data/table2.csv", output="t2")
+        cls.runModule(
+            "v.db.connect", map="test_vector", table="t1", key="cat_", layer=1
+        )
+        cls.runModule(
+            "v.db.connect", map="test_vector", table="t2", key="cat_", layer=2
+        )
 
 
     @classmethod
     @classmethod
     def tearDownClass(cls):
     def tearDownClass(cls):
-        cls.runModule('g.remove', type='vector', name='test_vector', flags='f')
+        cls.runModule("g.remove", type="vector", name="test_vector", flags="f")
 
 
     def setUp(self):
     def setUp(self):
-        self.vwhat = SimpleModule('v.what', map='test_vector',
-                                  coordinates=[634243, 226193], distance=10)
+        self.vwhat = SimpleModule(
+            "v.what", map="test_vector", coordinates=[634243, 226193], distance=10
+        )
 
 
     def test_run(self):
     def test_run(self):
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertLooksLike(reference=out1, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out1, actual=self.vwhat.outputs.stdout)
 
 
     def test_print_options(self):
     def test_print_options(self):
-        self.vwhat.flags['a'].value = True
+        self.vwhat.flags["a"].value = True
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertLooksLike(reference=out2, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out2, actual=self.vwhat.outputs.stdout)
 
 
-        self.vwhat.flags['g'].value = True
+        self.vwhat.flags["g"].value = True
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertLooksLike(reference=out3, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out3, actual=self.vwhat.outputs.stdout)
 
 
     def test_print_options_json(self):
     def test_print_options_json(self):
         import json
         import json
-        self.vwhat.flags['j'].value = True
-        self.vwhat.flags['a'].value = True
+
+        self.vwhat.flags["j"].value = True
+        self.vwhat.flags["a"].value = True
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         try:
         try:
             json.loads(self.vwhat.outputs.stdout)
             json.loads(self.vwhat.outputs.stdout)
         except ValueError:
         except ValueError:
-            self.fail(msg="No JSON object could be decoded:\n" + self.vwhat.outputs.stdout)
+            self.fail(
+                msg="No JSON object could be decoded:\n" + self.vwhat.outputs.stdout
+            )
 
 
     def test_selected_layers(self):
     def test_selected_layers(self):
         self.vwhat.inputs.layer = -1
         self.vwhat.inputs.layer = -1
-        self.vwhat.flags['g'].value = True
-        self.vwhat.flags['a'].value = True
+        self.vwhat.flags["g"].value = True
+        self.vwhat.flags["a"].value = True
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertLooksLike(reference=out3, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out3, actual=self.vwhat.outputs.stdout)
 
 
@@ -211,9 +222,10 @@ class TestMultiLayerMap(TestCase):
         self.assertLooksLike(reference=out4, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out4, actual=self.vwhat.outputs.stdout)
 
 
         self.vwhat.inputs.layer = 2
         self.vwhat.inputs.layer = 2
-        self.vwhat.flags['a'].value = False
+        self.vwhat.flags["a"].value = False
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertLooksLike(reference=out5, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out5, actual=self.vwhat.outputs.stdout)
 
 
-if __name__ == '__main__':
+
+if __name__ == "__main__":
     test()
     test()

+ 21 - 14
vector/v.what/testsuite/test_vwhat_ncspm.py

@@ -7,7 +7,7 @@ from grass.gunittest.gmodules import SimpleModule
 
 
 
 
 # v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000
 # v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000
-out1 = u"""East: 636661
+out1 = """East: 636661
 North: 226489
 North: 226489
 ------------------------------------------------------------------
 ------------------------------------------------------------------
 Map: schools
 Map: schools
@@ -38,7 +38,7 @@ Category: 217
 """
 """
 
 
 # v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000 -ag
 # v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000 -ag
-out2 = u"""East: 636661
+out2 = """East: 636661
 North: 226489
 North: 226489
 ------------------------------------------------------------------
 ------------------------------------------------------------------
 Map: schools
 Map: schools
@@ -94,7 +94,7 @@ SHAPE_len : 198808.723525
 """
 """
 
 
 # v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000 -ag
 # v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000 -ag
-out3 = u"""East=636661
+out3 = """East=636661
 North=226489
 North=226489
 
 
 Map=schools
 Map=schools
@@ -146,7 +146,7 @@ SHAPE_len=198808.723525
 """
 """
 
 
 # v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=100
 # v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=100
-out4 = u"""East: 636661
+out4 = """East: 636661
 North: 226489
 North: 226489
 ------------------------------------------------------------------
 ------------------------------------------------------------------
 Map: schools
 Map: schools
@@ -174,38 +174,45 @@ Category: 217
 
 
 
 
 class TestNCMaps(TestCase):
 class TestNCMaps(TestCase):
-
     def setUp(self):
     def setUp(self):
-        self.vwhat = SimpleModule('v.what', map=['schools', 'roadsmajor', 'elev_points', 'geology'],
-                                  layer=['-1', '-1', '-1', '-1'], coordinates=[636661, 226489],
-                                  distance=1000)
+        self.vwhat = SimpleModule(
+            "v.what",
+            map=["schools", "roadsmajor", "elev_points", "geology"],
+            layer=["-1", "-1", "-1", "-1"],
+            coordinates=[636661, 226489],
+            distance=1000,
+        )
 
 
     def test_multiple_maps(self):
     def test_multiple_maps(self):
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertMultiLineEqual(first=out1, second=self.vwhat.outputs.stdout)
         self.assertMultiLineEqual(first=out1, second=self.vwhat.outputs.stdout)
 
 
     def test_print_options(self):
     def test_print_options(self):
-        self.vwhat.flags['a'].value = True
+        self.vwhat.flags["a"].value = True
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertLooksLike(reference=out2, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out2, actual=self.vwhat.outputs.stdout)
 
 
-        self.vwhat.flags['g'].value = True
+        self.vwhat.flags["g"].value = True
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertLooksLike(reference=out3, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out3, actual=self.vwhat.outputs.stdout)
 
 
     def test_threshold(self):
     def test_threshold(self):
-        self.vwhat.inputs['distance'].value = 100
+        self.vwhat.inputs["distance"].value = 100
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         self.assertLooksLike(reference=out4, actual=self.vwhat.outputs.stdout)
         self.assertLooksLike(reference=out4, actual=self.vwhat.outputs.stdout)
 
 
     def test_print_options_json(self):
     def test_print_options_json(self):
         import json
         import json
-        self.vwhat.flags['j'].value = True
+
+        self.vwhat.flags["j"].value = True
         self.assertModule(self.vwhat)
         self.assertModule(self.vwhat)
         try:
         try:
             json.loads(self.vwhat.outputs.stdout)
             json.loads(self.vwhat.outputs.stdout)
         except ValueError:
         except ValueError:
-            self.fail(msg="No JSON object could be decoded:\n" + self.vwhat.outputs.stdout)
+            self.fail(
+                msg="No JSON object could be decoded:\n" + self.vwhat.outputs.stdout
+            )
+
 
 
-if __name__ == '__main__':
+if __name__ == "__main__":
     test()
     test()