Visitar URL original
Fix assertions in tests that were always `True` by namurphy · Pull Request #1634 · PlasmaPy/PlasmaPy · GitHub
Skip to content

Fix assertions in tests that were always True - #1634

Merged
namurphy merged 1 commit into
PlasmaPy:mainfrom
namurphy:fix-dielectric-tests
Jul 16, 2022
Merged

namurphy merged 1 commit into
PlasmaPy:mainfrom
namurphy:fix-dielectric-tests

Conversation

@namurphy

@namurphy namurphy commented Jul 7, 2022

Copy link
Copy Markdown
Member

There were a few tests in test_dielectric.py which were of the form

assert (
    np.isclose(...), "message"
)

This was doing an assert on a non-empty tuple, which consequently always evaluated to True. This PR adjusts the parentheses on the tests.

@github-actions github-actions Bot added the plasmapy.formulary Related to the plasmapy.formulary subpackage label Jul 7, 2022
@codecov

codecov Bot commented Jul 7, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #1634 (7791fd9) into main (32b8090) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #1634   +/-   ##
=======================================
  Coverage   97.21%   97.21%           
=======================================
  Files          83       83           
  Lines        7961     7961           
=======================================
  Hits         7739     7739           
  Misses        222      222           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32b8090...7791fd9. Read the comment docs.

@namurphy namurphy added no changelog entry needed For PRs that should not have a changelog entry size: very small < 10 changed lines testing labels Jul 7, 2022
@namurphy
namurphy requested a review from a team July 7, 2022 14:10
@namurphy namurphy added the status: ready for review PRs that are ready for code review label Jul 7, 2022
@StanczakDominik
StanczakDominik marked this pull request as ready for review July 16, 2022 07:35

@StanczakDominik StanczakDominik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh darn. Gotta admit that assert syntax was always a little magical to me.

So without the parenthesis, it passes in an unzipped tuple (like *args), and with them, just a tuple that's always true since it's non empty?

Good catch, all in all!

@namurphy

Copy link
Copy Markdown
Member Author

So without the parenthesis, it passes in an unzipped tuple (like *args), and with them, just a tuple that's always true since it's non empty?

That's my understanding of it! I think it was an extension to PyCharm (or maybe flake8?) that caught this...otherwise I don't think I'd have noticed it!

@namurphy
namurphy merged commit 4342b08 into PlasmaPy:main Jul 16, 2022
@namurphy
namurphy deleted the fix-dielectric-tests branch July 16, 2022 19:28
@namurphy namurphy removed the status: ready for review PRs that are ready for code review label Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog entry needed For PRs that should not have a changelog entry plasmapy.formulary Related to the plasmapy.formulary subpackage size: very small < 10 changed lines testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants