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_load_corrector #162

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from
Draft

test_load_corrector #162

wants to merge 23 commits into from

Conversation

NormannK
Copy link
Collaborator

  • added a test for class_load_corrector.py
  • added type hints and comments to the class_load_corrector.py

@drbacke
Copy link
Contributor

drbacke commented Oct 11, 2024

@NormannK Please resolve the confilicts Thanks

Lasall and others added 6 commits October 11, 2024 10:44
 * Dockerfile: Use non-root user, buildx cache, setup for readonly
   container, remove unused apt deps.
   For now don't install pip package and keep development flask server
   as this will be replaced in the future (fastapi). Then a proper
   webserver (e.g. nginx) should be used and the pip package can be
   created and deployed just to the run-stage (with the webserver).
 * docker-compose: Set to readonly (anonymous volumes declared in
   Dockerfile should maintain all writable data).
   Mount config.py for easier development. Should be replaced by
   environment support for all config file variables.
 * Remove unused runtime dependencies: mariadb, joblib, pytest,
   pytest-cov.
 * Move pytest-cov to dev dependencies.
 * Add output_dir to config.py.
 * Fix visualization_results.pdf endpoint.
 * Update docs.
@drbacke drbacke marked this pull request as draft October 22, 2024 08:45
@drbacke
Copy link
Contributor

drbacke commented Oct 22, 2024

Please re-run all tests

@NormannK NormannK marked this pull request as ready for review October 22, 2024 19:57
@NormannK NormannK closed this Oct 22, 2024
@NormannK NormannK reopened this Oct 22, 2024
@NormannK
Copy link
Collaborator Author

done

Copy link
Collaborator

@michaelosthege michaelosthege left a comment

Choose a reason for hiding this comment

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

Testing is good, but we should be careful to avoid locking down the codebase to the current architecture and making it harder to do important refactoring in the future.

For example, here are two things that if addressed could make things easier in the long run:

  1. The LoadPredictionAdjuster is extremely stateful. The relevant data are stored as attributes that are set or modified by calling the methods in exactly the correct order. A scikit-learn Pipeline might be more suited for this sequence of data transformations.
  2. The LoadPredictionAdjuster is initialized with this magic load_forecast: object, but it doesn't actually need the load_forecast! All it needs is a callable with the same signature as get_daily_stats which can be type annotated as a Callable. Then the test also wouldn't need a MagicMock.

src/akkudoktoreos/class_load_corrector.py Outdated Show resolved Hide resolved
src/akkudoktoreos/class_load_corrector.py Outdated Show resolved Hide resolved
src/akkudoktoreos/class_load_corrector.py Outdated Show resolved Hide resolved
src/akkudoktoreos/class_load_corrector.py Outdated Show resolved Hide resolved
src/akkudoktoreos/class_load_corrector.py Outdated Show resolved Hide resolved
src/akkudoktoreos/class_load_corrector.py Outdated Show resolved Hide resolved
src/akkudoktoreos/class_load_corrector.py Outdated Show resolved Hide resolved
tests/test_load_corrector.py Outdated Show resolved Hide resolved
tests/test_load_corrector.py Outdated Show resolved Hide resolved
tests/test_load_corrector.py Outdated Show resolved Hide resolved
NormannK and others added 13 commits October 31, 2024 12:44
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
Co-authored-by: Michael Osthege <[email protected]>
NormannK and others added 2 commits October 31, 2024 12:58
Co-authored-by: Michael Osthege <[email protected]>
@NormannK
Copy link
Collaborator Author

thanks for you thorough review. I don't know what happen with those double lines.
Should we address your remarks for the long run in this PR or produce a milestone/issue for this?

@michaelosthege
Copy link
Collaborator

michaelosthege commented Oct 31, 2024

thanks for you thorough review. I don't know what happen with those double lines. Should we address your remarks for the long run in this PR or produce a milestone/issue for this?

Maybe address 2. in this PR because it simplifies the test?

I will propose 1. in a discussion together with some other proposals along the same line. 👉 #187

@NormannK NormannK marked this pull request as draft November 28, 2024 00:14
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.

4 participants