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

test harness for unit models of waste treatment #1371

Merged
merged 8 commits into from
May 31, 2024

Conversation

agarciadiego
Copy link
Contributor

@agarciadiego agarciadiego commented Apr 28, 2024

Fixes/Resolves:

Addresses for 3 unit models #1302

Summary/Motivation:

Adds unit test harness for:

  • CSTR
  • CSTR injection
  • Thickener

Changes proposed in this PR:

  • changes in the test for CSTR, CSTR injection, Thickener

Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

  1. I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
  2. I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

@agarciadiego agarciadiego self-assigned this Apr 28, 2024
Copy link

codecov bot commented Apr 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.01%. Comparing base (ef4e4ef) to head (6359177).
Report is 52 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1371   +/-   ##
=======================================
  Coverage   94.01%   94.01%           
=======================================
  Files         335      335           
  Lines       35561    35561           
=======================================
  Hits        33431    33431           
  Misses       2130     2130           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ksbeattie ksbeattie added the Priority:Normal Normal Priority Issue or PR label May 2, 2024
Comment on lines 245 to +248
class TestInitializers:
@pytest.fixture
def model(self):
m = build()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class seems mostly unchanged. Are you able to make use of self.unit_solutions here instead of the assert statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are testing the initialization methods here not the solutions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were to channel my "inner Tim", I'd say is testing the initialization methods necessary? If not, we should delete it. If so, we should consider doing something similar for other unit models or adding it to the harness (which might not be feasible/a good idea)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To add my 2 cents: the Initializers are not part of WaterTAP and are tested as part of IDAES, so the question becomes twofold:

  1. do you trust IDAES not to break things on you, and
  2. what do you do if these tests start failing?

From a software engineering point of view, the "best" answer to this would be to add this case study to the IDAES backward compatibility tests. That way IDAES will see immediately if they break the tests, rather than having to wait for WaterTAP to discover and report it.

watertap/unit_models/tests/test_cstr_injection.py Outdated Show resolved Hide resolved
watertap/unit_models/tests/test_cstr.py Show resolved Hide resolved
Copy link
Contributor

@MarcusHolly MarcusHolly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (other than the unrelated test failure). I'll just note here that the team internally discussed the inclusion of the initializer tests in the CSTR test file, and we ultimately decided that it's fine to add additional tests outside of the TestHarness framework.

Copy link
Contributor

@savannahsakhai savannahsakhai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lbianchi-lbl lbianchi-lbl enabled auto-merge (squash) May 31, 2024 12:24
@lbianchi-lbl lbianchi-lbl merged commit 271e43b into watertap-org:main May 31, 2024
24 checks passed
k1nshuk pushed a commit to k1nshuk/watertap that referenced this pull request Jun 7, 2024
* test harness cstr, thickener

* running black

* cstr_injection and conservation

* running black

* LCOW for CSTR

* removing duplicateted class

* deleting extra class

---------

Co-authored-by: Ludovico Bianchi <lbianchi@lbl.gov>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:Normal Normal Priority Issue or PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants