openclimatefix / pv-site-datamodel

Datamodel for PV sites
MIT License
2 stars 10 forks source link

refactor: test_read.py #132

Closed peterdudfield closed 6 months ago

peterdudfield commented 7 months ago

Would be great to refactor test_read.py - https://github.com/openclimatefix/pv-site-datamodel/blob/main/tests/test_read.py as the file is a it long.

Could

Why? Makes it more readable, and easy to run a smaller amount of tests

vishalj0501 commented 6 months ago

Hi @peterdudfield, I'm a first timer to Open Climate Fix

I've refactored the test_read.py as follows :

tests/read/

1) test_get_sites.py Classes: TestGetAllSites TestGetSitesByCountry TestGetSiteByUUID

2) test_get_site.py Functions: test_get_site_group_by_name test_get_site_group_by_name_new_group test_get_all_users test_get_all_site_groups test_get_site_from_user test_get_site_list_max test_get_site_list_min

3) test_get_latest_status.py Classes: TestGetLatestStatus

4) test_get_PV_generation.py Classes: TestGetPVGenerationByUser TestGetPVGenerationBySites

5) test_get_latest_forecast_values.py Functions: _add_forecast_value test_get_latest_forecast_values test_get_latest_forecast_values_day_head test_get_latest_forecast_values_day_head_with_timezone

6) test_get_api_req.py Functions: test_get_all_last_api_request test_get_api_requests_for_one_user test_get_api_requests_for_one_user_start_datetime test_get_api_requests_for_one_user_end_datetime

7) test_get_user_by_email.py TestGetUserByEmail

Is this fine and should I send out PR?

peterdudfield commented 6 months ago

Yea, thanks for doing this, a pr would be great

some small comments I'd be tempted to put 1 and 2 together, as they are all sites tests.

  1. test_get_PV_generation.py --> est_get_generation.py 6.req to requests
vishalj0501 commented 6 months ago

@peterdudfield Thank You :) , Can you please review into the PR.