From 5d6a2e84e19a37adbecc684ca8c5b2e1d5c154c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edouard=20Choini=C3=A8re?= <27212526+echoix@users.noreply.github.com> Date: Tue, 17 Sep 2024 14:27:20 -0400 Subject: [PATCH] t.rast.univar: Use pathlib Path.read_text to open test outputs in t.rast.univar and t.rast3d.univar (#4334) --- pyproject.toml | 2 -- temporal/t.rast.univar/testsuite/test_t_rast_univar.py | 7 ++++--- temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py | 5 +++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f3ca9ab8dd6..52c24a386fb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] diff --git a/temporal/t.rast.univar/testsuite/test_t_rast_univar.py b/temporal/t.rast.univar/testsuite/test_t_rast_univar.py index cfdfa78ab27..11a91614b6c 100644 --- a/temporal/t.rast.univar/testsuite/test_t_rast_univar.py +++ b/temporal/t.rast.univar/testsuite/test_t_rast_univar.py @@ -8,6 +8,7 @@ @author Soeren Gebbert """ +from pathlib import Path from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule @@ -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: @@ -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: @@ -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: diff --git a/temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py b/temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py index d34c1f253aa..7c8ab1e4100 100644 --- a/temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py +++ b/temporal/t.rast3d.univar/testsuite/test_t_rast3d_univar.py @@ -8,6 +8,7 @@ @author Soeren Gebbert """ +from pathlib import Path from grass.gunittest.case import TestCase from grass.gunittest.gmodules import SimpleModule @@ -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: @@ -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: