Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 19, 2026

The _get_date_range function always returns tuple[datetime, datetime]—every code path assigns both start and end before returning. Any call site checking for (None, None) covers dead code.

Changes

  • Added 8 test cases covering all _get_date_range branches:

    • Default behavior (past 7 days)
    • Period options: yesterday, today, day, month, year
    • on parameter (full day range)
    • Explicit start_date/end_date combinations
  • All tests verify both return values are datetime instances, never None

# Every path returns valid datetimes
start, end = _get_date_range("", "", "", None, None, None)
assert isinstance(start, datetime)  # Always true
assert isinstance(end, datetime)    # Always true

The function raises exceptions (StartDateAbsentError, StartDateGreaterError) for invalid inputs rather than returning None.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 19, 2026 21:34
Co-authored-by: viseshrp <11642379+viseshrp@users.noreply.github.com>
Co-authored-by: viseshrp <11642379+viseshrp@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 19, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Add tests for _get_date_range function Add comprehensive tests for _get_date_range to verify it never returns None Jan 19, 2026
Copilot AI requested a review from viseshrp January 19, 2026 21:36
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