[Code scan] HTI systematic-error tests compare a value to itself

Open Beginner friendly
#145 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
88/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
python
Domain
testing

Research direction

Open tests/test_lib_utils.py at the HTI integration-test assertions around lines 75-96 and inspect the calls to integrate_range_hti(). Keep the expected and actual systematic-error values in distinct variables, then assert them against each other. Done means an obviously incorrect returned sys_err causes the test to fail.

Written by the indexing model from the issue text.

Description

Source: Codex global repository scan of deepmodeling/dpti at commit b719828e7eeb571bd26411430197cd74ea78e38c.
Project: https://github.com/orgs/deepmodeling/projects/27

Problem
The HTI integration tests intend to assert the expected systematic error, but they store the expected value in sys_err2, overwrite sys_err2 with the function return value, and then assert sys_err2 against itself. This masks regressions in the third return value from integrate_range_hti().

Code references
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/tests/test_lib_utils.py#L75
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/tests/test_lib_utils.py#L80
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/tests/test_lib_utils.py#L83
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/tests/test_lib_utils.py#L88
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/tests/test_lib_utils.py#L93
https://github.com/deepmodeling/dpti/blob/b719828e7eeb571bd26411430197cd74ea78e38c/tests/test_lib_utils.py#L96

Reproduction
Change integrate_range_hti() to return an obviously wrong sys_err; these assertions can still pass because the expected value has been overwritten.

Expected result
Use distinct variable names, for example sys_err1 for the expected value and sys_err2 for the actual value, then assert them against each other.

Dominant language
Python
Stars
42
Forks
27
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from deepmodeling/dpti

All issues in deepmodeling/dpti

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.