Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3b9e8d6
Fix for Imprecise assert
echoix May 12, 2026
7c3336b
Fix for Imprecise assert
echoix May 12, 2026
84b4a8b
Fix for Imprecise assert
echoix May 12, 2026
306be7b
Fix for Imprecise assert
echoix May 12, 2026
2dd313b
Fix for Imprecise assert
echoix May 12, 2026
0db1977
Fix for Imprecise assert
echoix May 12, 2026
43332e3
Fix for Imprecise assert
echoix May 12, 2026
f83184b
Fix for Imprecise assert
echoix May 12, 2026
f62e09d
Fix for Imprecise assert
echoix May 12, 2026
eb46ebe
Fix for Imprecise assert
echoix May 12, 2026
23a7082
Potential fixes for 5 code quality findings (#16)
echoix May 12, 2026
e709216
Apply suggested fix to raster/r.smooth.edgepreserve/testsuite/test_r_…
echoix May 12, 2026
6bb4a65
Apply suggested fix to raster/r.smooth.edgepreserve/testsuite/test_r_…
echoix May 12, 2026
2a5b169
Fix for Imprecise assert
echoix May 12, 2026
3c40ad7
Fix for Imprecise assert
echoix May 12, 2026
7d52dc2
Fix for Imprecise assert
echoix May 12, 2026
cd7e999
Fix for Imprecise assert
echoix May 12, 2026
0d5f584
Fix for Imprecise assert
echoix May 12, 2026
ab7f01e
Fix for Imprecise assert
echoix May 12, 2026
e3d67ad
Apply suggested fix to imagery/i.gensig/testsuite/test_i_gensig.py fr…
echoix May 12, 2026
2033560
Apply suggested fix to imagery/i.gensig/testsuite/test_i_gensig.py fr…
echoix May 12, 2026
d70ad3e
Fix for Imprecise assert
echoix May 12, 2026
5bc9765
Fix for Imprecise assert
echoix May 13, 2026
a683b2f
Merge branch 'fix-imprecise-assert' into fix-imprecise-assert
echoix May 13, 2026
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
24 changes: 12 additions & 12 deletions imagery/i.gensig/testsuite/test_i_gensig.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,28 +136,28 @@ def test_creation(self):
self.assertEqual(Sn.sig[0].have_color, 0)
self.assertEqual(Sn.sig[0].npoints, 4)
self.assertEqual(Sn.sig[0].oclass, 1)
self.assertTrue(abs(Sn.sig[0].mean[0] - 2.9) < 0.1)
self.assertTrue(abs(Sn.sig[0].mean[1] - 7.0) < 0.1)
self.assertTrue(abs(Sn.sig[0].var[0][0] - 0.03) < 0.01)
self.assertTrue(abs(Sn.sig[0].var[1][1] - 0.6) < 0.1)
self.assertLess(abs(Sn.sig[0].mean[0] - 2.9), 0.1)
self.assertLess(abs(Sn.sig[0].mean[1] - 7.0), 0.1)
self.assertLess(abs(Sn.sig[0].var[0][0] - 0.03), 0.01)
self.assertLess(abs(Sn.sig[0].var[1][1] - 0.6), 0.1)
# 6
self.assertEqual(Sn.sig[1].status, 1)
self.assertEqual(Sn.sig[1].have_color, 0)
self.assertEqual(Sn.sig[1].npoints, 4)
self.assertEqual(Sn.sig[1].oclass, 6)
self.assertTrue(abs(Sn.sig[1].mean[0] - 8.9) < 0.1)
self.assertTrue(abs(Sn.sig[1].mean[1] - 1.5) < 0.1)
self.assertTrue(abs(Sn.sig[1].var[0][0] - 0.003) < 0.001)
self.assertTrue(abs(Sn.sig[1].var[1][1] - 0.3) < 0.1)
self.assertLess(abs(Sn.sig[1].mean[0] - 8.9), 0.1)
self.assertLess(abs(Sn.sig[1].mean[1] - 1.5), 0.1)
self.assertLess(abs(Sn.sig[1].var[0][0] - 0.003), 0.001)
self.assertLess(abs(Sn.sig[1].var[1][1] - 0.3), 0.1)
# 9
self.assertEqual(Sn.sig[2].status, 1)
self.assertEqual(Sn.sig[2].have_color, 0)
self.assertEqual(Sn.sig[2].npoints, 3)
self.assertEqual(Sn.sig[2].oclass, 9)
self.assertTrue(abs(Sn.sig[2].mean[0] - 6.7) < 0.1)
self.assertTrue(abs(Sn.sig[2].mean[1] - 8.3) < 0.1)
self.assertTrue(abs(Sn.sig[2].var[0][0] - 0.043) < 0.01)
self.assertTrue(abs(Sn.sig[2].var[1][1] - 0.3) < 0.1)
self.assertLess(abs(Sn.sig[2].mean[0] - 6.7), 0.1)
self.assertLess(abs(Sn.sig[2].mean[1] - 8.3), 0.1)
self.assertLess(abs(Sn.sig[2].var[0][0] - 0.043), 0.01)
self.assertLess(abs(Sn.sig[2].var[1][1] - 0.3), 0.1)


if __name__ == "__main__":
Expand Down
6 changes: 3 additions & 3 deletions imagery/i.svm.predict/testsuite/test_i_svm_predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ def test_semantic_label_mismatch2(self):
self.tmp_rasts.append(rast)
self.assertModuleFail(isvm)
self.assertTrue(isvm.outputs.stderr)
self.assertTrue(
"Signature band count: 2, imagery group band count: 3"
in isvm.outputs.stderr
self.assertIn(
"Signature band count: 2, imagery group band count: 3",
isvm.outputs.stderr,
)

@unittest.skipIf(shutil.which("i.svm.predict") is None, "i.svm.predict not found.")
Expand Down
4 changes: 2 additions & 2 deletions imagery/i.svm.train/testsuite/test_i_svm_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ def test_rescaling(self):
lines = rf.readlines()
M, R = lines[0].strip().split(" ")
self.assertTrue(float(M) > -1 and float(M) < 1)
self.assertTrue(float(R) <= 2)
self.assertLessEqual(float(R), 2)
M, R = lines[1].strip().split(" ")
self.assertTrue(float(M) > -1 and float(M) < 1)
self.assertTrue(float(R) <= 20)
self.assertLessEqual(float(R), 20)

@unittest.skipIf(shutil.which("i.svm.train") is None, "i.svm.train not found.")
def test_fail_on_empty_raster(self):
Expand Down
12 changes: 6 additions & 6 deletions lib/imagery/testsuite/test_imagery_signature_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ def test_multiple_sigs_multiple_mapsets(self):
# As temporary mapset is not in the search path, there must be
# at least one sig file present
# There could be more sigs if this is not an empty mapset
self.assertTrue(ret >= 1)
self.assertGreaterEqual(ret, 1)
ret_list = list(map(utils.decode, sig_list[:ret]))
golden = (
f"{rnd_sig1}@{self.rnd_mapset_name}",
Expand All @@ -1007,7 +1007,7 @@ def test_multiple_sigs_multiple_mapsets(self):
shutil.rmtree(sig_dir1)
shutil.rmtree(sig_dir2)
# There could be more sigs if this is not an empty mapset
self.assertTrue(ret >= 2)
self.assertGreaterEqual(ret, 2)
ret_list = list(map(utils.decode, sig_list[:ret]))
self.assertIn(golden[0], ret_list)
self.assertIn(golden[1], ret_list)
Expand All @@ -1032,7 +1032,7 @@ def test_multiple_sigsets_multiple_mapsets(self):
# As temporary mapset is not in the search path, there must be
# at least one sig file present
# There could be more sigs if this is not an empty mapset
self.assertTrue(ret >= 1)
self.assertGreaterEqual(ret, 1)
ret_list = list(map(utils.decode, sig_list[:ret]))
golden = (
f"{rnd_sig1}@{self.rnd_mapset_name}",
Expand All @@ -1054,7 +1054,7 @@ def test_multiple_sigsets_multiple_mapsets(self):
shutil.rmtree(sig_dir1)
shutil.rmtree(sig_dir2)
# There could be more sigs if this is not an empty mapset
self.assertTrue(ret >= 2)
self.assertGreaterEqual(ret, 2)
ret_list = list(map(utils.decode, sig_list[:ret]))
self.assertIn(golden[0], ret_list)
self.assertIn(golden[1], ret_list)
Expand All @@ -1080,7 +1080,7 @@ def test_multiple_libsvms_multiple_mapsets(self):
# As temporary mapset is not in the search path, there must be
# at least one sig file present
# There could be more sigs if this is not an empty mapset
self.assertTrue(ret >= 1)
self.assertGreaterEqual(ret, 1)
ret_list = list(map(utils.decode, sig_list[:ret]))
golden = (
f"{rnd_sig1}@{self.rnd_mapset_name}",
Expand All @@ -1102,7 +1102,7 @@ def test_multiple_libsvms_multiple_mapsets(self):
shutil.rmtree(sig_dir1)
shutil.rmtree(sig_dir2)
# There could be more sigs if this is not an empty mapset
self.assertTrue(ret >= 2)
self.assertGreaterEqual(ret, 2)
ret_list = list(map(utils.decode, sig_list[:ret]))
self.assertIn(golden[0], ret_list)
self.assertIn(golden[1], ret_list)
Expand Down
5 changes: 3 additions & 2 deletions lib/init/testsuite/test_grass_tmp_mapset.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ def test_mapset_deleted(self):
[self.executable, "--tmp-mapset", self.location, "--exec", "g.proj", "-p"]
)
for directory in os.listdir(self.location):
self.assertTrue(
directory in self.subdirs,
self.assertIn(
directory,
self.subdirs,
msg="Directory {directory} should have been deleted".format(**locals()),
)

Expand Down
4 changes: 2 additions & 2 deletions python/grass/pygrass/vector/testsuite/test_geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ def test_eq(self):
point0 = Point(0, 0)
point1 = Point(1, 0)
self.assertFalse(point0 == point1)
self.assertFalse(point0 == (1, 0))
self.assertNotEqual(point0, (1, 0))
self.assertTrue(point0 == point0) # noqa: PLR0124 # pylint: disable=R0124
self.assertTrue(point0 == (0, 0))
self.assertEqual(point0, (0, 0))

def test_repr(self):
"""Test __eq__"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_getitem(self):
with self.assertRaises(ValueError) as cm:
self.attrs["not_existing_column_name"]

self.assertTrue("not_existing_column_name" in str(cm.exception))
self.assertIn("not_existing_column_name", str(cm.exception))

def test_setitem(self):
"""Test __setitem__ magic method"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def test_exp_i_ram(self):
function="exp",
quiet=True,
)
self.assertTrue(raster_info(out_map_i)["datatype"] == "CELL")
self.assertEqual(raster_info(out_map_i)["datatype"], "CELL")
self.assertRastersEqual(out_map_i, self.ref_exp_i)

def test_exp_f_ram(self):
Expand All @@ -132,7 +132,7 @@ def test_exp_f_ram(self):
function="exp",
quiet=True,
)
self.assertTrue(raster_info(out_map_f)["datatype"] == "FCELL")
self.assertEqual(raster_info(out_map_f)["datatype"], "FCELL")
self.assertRastersEqual(out_map_f, self.ref_exp_f, precision=0.1)

def test_exp_d_ram(self):
Expand All @@ -155,7 +155,7 @@ def test_exp_d_ram(self):
function="exp",
quiet=True,
)
self.assertTrue(raster_info(out_map_d)["datatype"] == "DCELL")
self.assertEqual(raster_info(out_map_d)["datatype"], "DCELL")
self.assertRastersEqual(out_map_d, self.ref_exp_f, precision=0.1)

def test_quad_ram(self):
Expand Down
4 changes: 2 additions & 2 deletions temporal/t.rename/testsuite/test_t_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def test_rename(self):
print(gs.read_command("t.info", type="strds", input="precip_abs6"))

self.assertEqual(strds.metadata.get_description(), "This is the 3 test strds")
self.assertTrue("t.rename" in strds.metadata.get_command())
self.assertIn("t.rename", strds.metadata.get_command())

def test_rename_with_overwrite(self):
"""Test renaming a space time raster dataset while overwriting
Expand All @@ -159,7 +159,7 @@ def test_rename_with_overwrite(self):
print(gs.read_command("t.info", type="strds", input="precip_abs2"))

self.assertEqual(strds.metadata.get_description(), "This is the 1 test strds")
self.assertTrue("t.rename" in strds.metadata.get_command())
self.assertIn("t.rename", strds.metadata.get_command())

def test_fail_overwrite_without_flag(self):
"""Test that renaming a space time raster dataset fails if the
Expand Down
Loading