Skip to content

feat(prices): validate latest_value_only vs dates, widen default date range - #115

Open
Bloom79 wants to merge 1 commit into
WFP-VAM:mainfrom
Bloom79:fix/market-prices-date-handling
Open

Bloom79 wants to merge 1 commit into
WFP-VAM:mainfrom
Bloom79:fix/market-prices-date-handling

Conversation

@Bloom79

@Bloom79 Bloom79 commented Aug 31, 2026

Copy link
Copy Markdown

Description

Three small related improvements to MarketPricesApi.get_prices(), coming from the review comments in #36:

Added tests/unit/test_market_prices.py (6 tests, pure mocks — no API credentials needed) covering the validation, the defaults and the RFC 3339 formatting. Docstring updated (new default, Raises section).

Developed with AI assistance (Claude Code); all changes reviewed and tested locally (make codestyle clean, unit suite green).

Related Issue

Closes #42
Closes #39
Closes #40

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

Checklist

  • I've updated the code style using make codestyle.
  • I've written tests for all new methods and classes that I created.
  • I've written the docstring in Google format for all the methods and classes that I used.
  • My commits follow the Conventional Commits format (fix:, feat:, chore:, etc.).

… range

- raise ValueError when latest_value_only=True is combined with
  start_date/end_date, which the API ignores (WFP-VAM#42)
- default start_date to 7 days before today instead of today,
  avoiding a zero-length default date range (WFP-VAM#39)
- extract RFC3339_DATE_FORMAT constant used for all date formatting (WFP-VAM#40)
- add unit tests covering validation, defaults, and date formatting

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012LeVhWqMdzPDFCpvLKazLB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant