This issue is from a Codex global scan of the repository.
Two tests use assertTrue(actual, expected) where the second argument is only the failure message, so the intended comparison is never performed.
Evidence:
|
def _check_numb_models(testCase, iter_idx, numb_models): |
|
models = glob.glob( |
|
os.path.join("iter.%06d" % iter_idx, "00.train", "[0-9][0-9][0-9]") # noqa: UP031 |
|
) |
|
testCase.assertTrue(len(models), numb_models) |
|
def test_make_potential_files(self): |
|
cwd = os.getcwd() |
|
abs_equi_path = os.path.abspath(self.equi_path) |
|
self.Lammps.make_potential_files(abs_equi_path) |
|
self.assertTrue(os.path.islink(os.path.join(self.equi_path, "frozen_model.pb"))) |
|
self.assertTrue(os.path.isfile(os.path.join(self.equi_path, "inter.json"))) |
|
ret = loadfn(os.path.join(self.equi_path, "inter.json")) |
|
self.assertTrue(self.inter_param, ret) |
_check_numb_models() currently passes whenever len(models) is nonzero, even if it does not equal numb_models. test_make_potential_files() passes whenever self.inter_param is truthy; the loaded ret value is used only as a message and is not compared.
Expected behavior: use equality assertions such as assertEqual(len(models), numb_models) and assertEqual(ret, self.inter_param) so these tests catch regressions.
This issue is from a Codex global scan of the repository.
Two tests use
assertTrue(actual, expected)where the second argument is only the failure message, so the intended comparison is never performed.Evidence:
dpgen/tests/generator/test_make_train.py
Lines 59 to 63 in 7af5246
dpgen/tests/auto_test/test_lammps.py
Lines 75 to 82 in 7af5246
_check_numb_models()currently passes wheneverlen(models)is nonzero, even if it does not equalnumb_models.test_make_potential_files()passes wheneverself.inter_paramis truthy; the loadedretvalue is used only as a message and is not compared.Expected behavior: use equality assertions such as
assertEqual(len(models), numb_models)andassertEqual(ret, self.inter_param)so these tests catch regressions.