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

Fake data Issue #354 (#360) #369

Merged
merged 11 commits into from
Dec 20, 2024
Merged

Fake data Issue #354 (#360) #369

merged 11 commits into from
Dec 20, 2024

Conversation

peterdudfield
Copy link
Collaborator

@peterdudfield peterdudfield commented Dec 20, 2024

Following on from #360 for issue #354

The trick was to change is_fake to is_fake() in the routes. This sovles the tests problems in #360

* Fake data Issue #354

* Fake data Issue #354

* Fake data Issue #354

* Changed relative imports and removed pre-commit from requirements.txt

* Using more flexible python3 version to attempt to fix pre-commit.ci build issue

* Written new Unit Test for fake forecast with specified GSP ID

* Written unit tests for all endpoints/routes and modified gsp.py to support new tests

* Removed duplicated Test Cases

* 1st test case for fake environment

* Fixed accidental activation of fake environment in gsp.py module

* Written and tested remaining test cases for is_fake

* Moved isintance check to prior to is_fake condition

* Added 2 Tests to test_national.py and cleaned up some logic in test_gsp test cases

* Modified gsp.py and national.py modules and accompanying test cases to address feedback

* Fixed incorrect for loop iteration through list (should be singular ForecastSQL object) to forecasts object in the test_national.py test cases

* Modified test cases to use NationalForecastValue, ForecastValue, and the ManyForecasts as the return objects

* Modified test cases to uss pytest.fixture() to yield values from db_session

* Possible fix for test_read_latest_all_gsp_normalized() and test_read_latest_all_gsp()

* 1st experiment for test_read_truth_national_gsp() and test_read_forecast_values_gsp()

* 1st experiment with make_fake_gsp_yields()

* 2nd experiment with make_fake_gsp_yields() - modified test_gsp routes

* 3rd experiment with make_fake_gsp_yields() - modified List Comprehension

* 4th experiment with make_fake_gsp_yields() - hard coded _gsp_id_

* Removed yield and fixture

* Experiment: Create a separate tests/fake/test_gsp_fake.py test case module
@peterdudfield peterdudfield marked this pull request as draft December 20, 2024 08:34
Copy link

sentry-io bot commented Dec 20, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: src/gsp.py

Function Unhandled Issue
get_truths_for_all_gsps ValueError: invalid literal for int() with base 10: '' /v0/solar/GB/gsp/pvli...
Event Count: 172
get_all_available_forecasts ValueError: invalid literal for int() with base 10: '' /v0/solar/GB/gsp/forecas...
Event Count: 99
📄 File: src/national.py (Click to Expand)
Function Unhandled Issue
get_national_forecast IndexError: list index out of range /v0/solar/GB/...
Event Count: 30
get_national_forecast ValueError: Invalid isoformat string: '2023-1-07 11:10' /v0/solar/GB/national/f...
Event Count: 1
---

Did you find this useful? React with a 👍 or 👎

@peterdudfield peterdudfield marked this pull request as ready for review December 20, 2024 09:07
@peterdudfield
Copy link
Collaborator Author

Here we go @VikramsDataScience , Would you like review this. You basically did it all, i just tidy up some off test behaviour

@VikramsDataScience
Copy link
Contributor

VikramsDataScience commented Dec 20, 2024

Here we go @VikramsDataScience , Would you like review this. You basically did it all, i just tidy up some off test behaviour

Ah, right. That's wonderful. Thank you, Peter! I guess we're now finally ready to use these cool new features (and just in time for holidays, as well :))?

@peterdudfield peterdudfield merged commit 97bbca1 into main Dec 20, 2024
2 checks passed
@peterdudfield peterdudfield deleted the fake-data branch December 20, 2024 10:30
@peterdudfield
Copy link
Collaborator Author

@all-contributors please add @VikramsDataScience for code

Copy link
Contributor

@peterdudfield

I've put up a pull request to add @VikramsDataScience! 🎉

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.

2 participants