Skip to content

Commit

Permalink
t.rast.univar: Use pathlib Path.read_text to open test outputs in t.r…
Browse files Browse the repository at this point in the history
…ast.univar and t.rast3d.univar (OSGeo#4334)
  • Loading branch information
echoix authored Sep 17, 2024
1 parent a816dc1 commit 5d6a2e8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,7 @@ ignore = [
"temporal/t.rast.algebra/testsu*/*_algebra_arithmetic.py" = ["FLY002"]
"temporal/t.rast.colors/t.rast.colors.py" = ["SIM115"]
"temporal/t.rast.series/t.rast.series.py" = ["SIM115"]
"temporal/t.rast.univar/testsuite/test_t_rast_univar.py" = ["SIM115"]
"temporal/t.rast.what/t.rast.what.py" = ["SIM115"]
"temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py" = ["SIM115"]
"temporal/t.register/testsu*/*_raster_different_local.py" = ["FLY002"]
"temporal/t.register/testsu*/*_raster_mapmetadata.py" = ["FLY002"]
"temporal/t.register/testsuite/test_t_register_raster.py" = ["FLY002"]
Expand Down
7 changes: 4 additions & 3 deletions temporal/t.rast.univar/testsuite/test_t_rast_univar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@author Soeren Gebbert
"""

from pathlib import Path
from grass.gunittest.case import TestCase
from grass.gunittest.gmodules import SimpleModule

Expand Down Expand Up @@ -243,7 +244,7 @@ def test_subset_with_output(self):
a_3@testing||2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600|9600
a_4@testing||2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600|9600
"""
univar_output = open("univar_output.txt", "r").read()
univar_output = Path("univar_output.txt").read_text()

for ref, res in zip(univar_text.split("\n"), univar_output.split("\n")):
if ref and res:
Expand All @@ -269,7 +270,7 @@ def test_subset_with_extended_statistics_and_output(self):
a_3@m2||2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600|9600|300|300|300|300|300
a_4@m2||2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600|9600|400|400|400|400|400
"""
univar_output = open("univar_output.txt", "r").read()
univar_output = Path("univar_output.txt").read_text()

for ref, res in zip(univar_text.split("\n"), univar_output.split("\n")):
if ref and res:
Expand All @@ -292,7 +293,7 @@ def test_subset_with_extended_statistics_and_output(self):
a_3@testing||2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|2880000|0|9600|9600
a_4@testing||2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|3840000|0|9600|9600
"""
univar_output = open("univar_output.txt", "r").read()
univar_output = Path("univar_output.txt").read_text()

for ref, res in zip(univar_text.split("\n"), univar_output.split("\n")):
if ref and res:
Expand Down
5 changes: 3 additions & 2 deletions temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
@author Soeren Gebbert
"""

from pathlib import Path
from grass.gunittest.case import TestCase
from grass.gunittest.gmodules import SimpleModule

Expand Down Expand Up @@ -119,7 +120,7 @@ def test_subset_with_output(self):
a_3@testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|144000000|0|480000|480000
a_4@testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|192000000|0|480000|480000
"""
univar_output = open("univar_output.txt", "r").read()
univar_output = Path("univar_output.txt").read_text()

for ref, res in zip(univar_text.split("\n"), univar_output.split("\n")):
if ref and res:
Expand All @@ -142,7 +143,7 @@ def test_subset_with_output_no_header(self):
a_3@testing|2001-07-01 00:00:00|2001-10-01 00:00:00|300|300|300|300|0|0|0|144000000|0|480000|480000
a_4@testing|2001-10-01 00:00:00|2002-01-01 00:00:00|400|400|400|400|0|0|0|192000000|0|480000|480000
"""
univar_output = open("univar_output.txt", "r").read()
univar_output = Path("univar_output.txt").read_text()

for ref, res in zip(univar_text.split("\n"), univar_output.split("\n")):
if ref and res:
Expand Down

0 comments on commit 5d6a2e8

Please sign in to comment.