Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t.rast.univar: Use pathlib Path.read_text to open test outputs in t.rast.univar and t.rast3d.univar #4334

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading