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

Formatting #3

Closed
wants to merge 3 commits into from
Closed

Formatting #3

wants to merge 3 commits into from

Conversation

siddharth7113
Copy link
Owner

No description provided.

Added necessary dependencies (excluding `pandas`) to support project functionality, testing, and CI workflows.
- Added `format_to_forecast_sql` in `format_forecast.py` to convert NESO solar forecast data into a `ForecastSQL` object.
  - Fetches model metadata, location, and input data last updated timestamp.
  - Processes rows to create `ForecastValue` objects and aggregates them into a single `ForecastSQL` object.
  - Logs key steps for improved traceability and debugging.

- Added `test_format_to_forecast_sql_real` in `test_format_forecast.py` to validate the functionality of `format_to_forecast_sql`.
  - Fetches real data using `fetch_data` and ensures it is correctly formatted into a `ForecastSQL` object.
  - Performs validation to ensure the number of `ForecastValue` entries matches the filtered DataFrame.

- Added `conftest.py` to provide shared test fixtures for the test suite:
  - `postgres_container` fixture spins up a PostgreSQL container for isolated testing using `testcontainers`.
  - `db_session` fixture sets up a clean database schema and a test ML model for each test function.
  - `test_config` fixture provides shared configuration constants for tests.

These changes establish a robust framework for processing and testing solar forecast data effectively.
…tion

- Replaced hardcoded variables (`resource_id`, `limit`, `columns`, `rename_columns`, `sql_query`) with `test_config` fixture for better reusability and maintainability.
- Updated all test cases (`test_fetch_data_api`, `test_fetch_data_sql`, `test_data_consistency`) to use `test_config` for dynamic parameterization.
- Ensured SQL queries and API calls use values from `test_config`.
- Improved code readability and consistency across test cases.
@siddharth7113 siddharth7113 marked this pull request as ready for review January 2, 2025 05:23
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.

1 participant