Skip to content

Conversation

@tRosenflanz
Copy link
Contributor

Fixes #2843

Summary

Simple improvement to consider parameters of the full class inheritance of the checked class instead of specific classes for TorchForecastingModel

@codecov
Copy link

codecov bot commented Sep 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.45%. Comparing base (2c666f8) to head (19ac6f6).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2908      +/-   ##
==========================================
- Coverage   95.52%   95.45%   -0.07%     
==========================================
  Files         146      146              
  Lines       15703    15710       +7     
==========================================
- Hits        15000    14996       -4     
- Misses        703      714      +11     

☔ 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.

@tRosenflanz
Copy link
Contributor Author

Do you want me to add a test for this? I can use the example from the original issue for it

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

Hi @tRosenflanz and thanks a lot for the PR 🚀

Yes, a unit test would be great :) Could you also:

  • try to improve the code coverage with the new tests (from the codecov comment above).
  • add an entry to CHANGELOG.md describing your change

@tRosenflanz
Copy link
Contributor Author

tRosenflanz commented Nov 13, 2025

Can I rework the test_wrong_model_creation_params using a RnnLambda class or would you prefer a separate test? They will be testing essentially the same behavior so I reworked the existing test but had to change the params because inheritance changes the argument order

Also I will remove that uncovered Try/except block - it only comes into play with very exotic cases that should probably be forbidden anyway like using double inheritance with C implemented types like list

@dennisbader
Copy link
Collaborator

Hi @tRosenflanz, removing the try / except sounds good. Probably better to let it fail then continue silently and we won't know what went wrong.

I would prefer a new test. You can pretty much copy-paste the test_wrong_model_creation_params, and adapt it to use a Subclass that adds one additional parameter. You can then add this param to the existing valid_kwarg and test that it works. invalid_kwarg should still raise an exception.

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

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

Perfect, thanks a lot @tRosenflanz, this really simplifies subclassing from TFM 🚀

I pushed a minor change to also test that passing the positional arguments works.

@dennisbader dennisbader merged commit ab24853 into unit8co:master Nov 16, 2025
9 checks passed
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.

Modified parameter validation to support better subclassing

2 participants