Skip to content

Commit

Permalink
grass.unittest: Fix usage of assertRegexpMatches() removed from Pytho…
Browse files Browse the repository at this point in the history
…n 3.12
  • Loading branch information
pesekon2 committed Jun 7, 2023
1 parent b7b51eb commit 3dd9fc5
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion general/g.remove/testsuite/test_g_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_remove_procedure_exclude(self):
)
self.assertModule(module)
self.assertMultiLineEqual(module.outputs.stdout, "")
self.assertRegexpMatches(
self.assertRegex(
module.outputs.stderr, "(.*<.+>[^\n]*\n){4}", msg="4 maps should be removed"
)

Expand Down
2 changes: 1 addition & 1 deletion scripts/db.dropcolumn/testsuite/test_db_dropcolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def test_drop_column_check(self):

m = SimpleModule("db.columns", table=self.mapName)
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), self.colName)
self.assertRegex(decode(m.outputs.stdout), self.colName)

def test_drop_column_with_force(self):
"""Drop column with force, the column should not be in the table"""
Expand Down
2 changes: 1 addition & 1 deletion scripts/db.droptable/testsuite/test_db_droptable.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_drop_table_check(self):

m = SimpleModule("db.tables", flags="p")
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), self.mapName)
self.assertRegex(decode(m.outputs.stdout), self.mapName)

def test_drop_table_with_force(self):
"""Drop table with force, the column should not be in the table"""
Expand Down
4 changes: 2 additions & 2 deletions scripts/db.in.ogr/testsuite/test_db_in_ogr.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def test_import_csv_file(self):

m = SimpleModule("db.tables", flags="p")
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), self.tableName1)
self.assertRegex(decode(m.outputs.stdout), self.tableName1)

def test_import_dbf_file(self):
"""import dbf table"""
Expand All @@ -54,7 +54,7 @@ def test_import_dbf_file(self):

m = SimpleModule("db.tables", flags="p")
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), self.tableName2)
self.assertRegex(decode(m.outputs.stdout), self.tableName2)


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions scripts/v.db.addcolumn/testsuite/test_v_db_addcolumn.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_add_single_column_check(self):

m = SimpleModule("v.info", map="myroads", flags="c")
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), "slope")
self.assertRegex(decode(m.outputs.stdout), "slope")

def test_add_two_columns_check(self):
"""Add two column to the attribute table"""
Expand All @@ -48,8 +48,8 @@ def test_add_two_columns_check(self):

m = SimpleModule("v.info", map="myroads", flags="c")
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), "slope_2")
self.assertRegexpMatches(decode(m.outputs.stdout), "myname")
self.assertRegex(decode(m.outputs.stdout), "slope_2")
self.assertRegex(decode(m.outputs.stdout), "myname")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion scripts/v.db.addtable/testsuite/test_v_db_addtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def test_add_single_columned_table_check(self):

m = SimpleModule("v.info", map="myroads", flags="c", layer=2)
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), "slope")
self.assertRegex(decode(m.outputs.stdout), "slope")


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion scripts/v.db.droptable/testsuite/test_v_db_droptable.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_drop_table_check(self):

m = SimpleModule("db.tables", flags="p")
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), "myroads")
self.assertRegex(decode(m.outputs.stdout), "myroads")

def test_drop_table_with_force(self):
"""Drop table with force, the column should not be in the table"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_rename_column(self):

m = SimpleModule("v.info", flags="c", map="myroads")
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), "roadname")
self.assertRegex(decode(m.outputs.stdout), "roadname")
self.assertNotRegex(decode(m.outputs.stdout), "ROAD_NAME")


Expand Down
2 changes: 1 addition & 1 deletion scripts/v.what.vect/testsuite/test_v_what_vect.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_what_vect(self):

m = SimpleModule("v.db.select", map=self.mapName)
self.assertModule(m)
self.assertRegexpMatches(decode(m.outputs.stdout), "urb_name")
self.assertRegex(decode(m.outputs.stdout), "urb_name")


if __name__ == "__main__":
Expand Down

0 comments on commit 3dd9fc5

Please sign in to comment.