'data' key not required; can be any friendly name.#710
Conversation
Previous testing incorrectly assumed that in a data request, the data source name had to be called 'data' if there weren't multiple sources. This is not true. Corrected both test and logic.
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug in the DataRequestDefinition.as_dict() method where dictionary-based dataset configurations (multiple datasets with friendly names) were incorrectly being wrapped with an extra "data" key. The fix ensures that when exporting configurations with multiple datasets, the friendly names (like "cifar_0", "cifar_1", "random") are used directly as keys, matching the expected format used in notebooks and documentation.
Changes:
- Corrected the
as_dict()method to not wrap dict configs in an extra "data" key - Updated test assertions to match the corrected behavior
- Updated comment to clarify that dict config keys are "already friendly names"
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/hyrax/config_schemas/data_request.py |
Fixed as_dict() method to not wrap dict configs in extra "data" key, preserving friendly names directly |
tests/hyrax/test_data_request_config.py |
Updated test assertions to match corrected dict config structure without nested "data" key |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #710 +/- ##
=======================================
Coverage 64.17% 64.17%
=======================================
Files 61 61
Lines 5892 5892
=======================================
Hits 3781 3781
Misses 2111 2111 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Click here to view all benchmarks. |
Discovered while testing pre-executed notebooks.
Solution Description
Previous testing incorrectly assumed that in a data request, the data source name had to be called 'data' if there weren't multiple sources. This is not true. Corrected both test and logic.
Code Quality