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

error handling on mphys pygeo 'type' #264

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

error handling on mphys pygeo 'type' #264

wants to merge 6 commits into from

Conversation

gawng
Copy link
Contributor

@gawng gawng commented Mar 4, 2025

Purpose

This places an else check on the info['type'] because I kept passing in type keyword argument as uppercase 'FFD' when it was looking for lowercase 'ffd'. Now at least the warning message will tell the user what is breaking.

Expected time until merged

Relatively simple so maybe a few days?

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

I ran it locally passing in 'FFD' and it returned an error instead of proceeding.

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@gawng gawng requested a review from a team as a code owner March 4, 2025 20:46
@gawng gawng requested review from marcomangano and anilyil March 4, 2025 20:46
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

Attention: Patch coverage is 60.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 67.01%. Comparing base (ba45e83) to head (e601e72).

Files with missing lines Patch % Lines
pygeo/mphys/mphys_dvgeo.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #264      +/-   ##
==========================================
- Coverage   67.02%   67.01%   -0.01%     
==========================================
  Files          47       47              
  Lines       12326    12327       +1     
==========================================
  Hits         8261     8261              
- Misses       4065     4066       +1     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@marcomangano marcomangano left a comment

Choose a reason for hiding this comment

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

This looks good, but what if we cast info["type"] to lower case by default, maybe here? Not sure if that reflect best coding practices though

@gawng
Copy link
Contributor Author

gawng commented Mar 5, 2025

We could certainly do that. I don't know if that is the best spot to cast to lower case because I think using DVGeoMulti may bypass that. I just figured that the else catch is a more robust catch for the type of error I was falling into.

marcomangano
marcomangano previously approved these changes Mar 5, 2025
Copy link
Member

@A-CGray A-CGray left a comment

Choose a reason for hiding this comment

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

Why not check the equality using info["type"].lower()? That way it's case insensitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants