Skip to content

test: improve darksky.py test coverage from 53% to 100%#3

Merged
Orinks merged 3 commits intomainfrom
test/darksky-coverage
Feb 4, 2026
Merged

test: improve darksky.py test coverage from 53% to 100%#3
Orinks merged 3 commits intomainfrom
test/darksky-coverage

Conversation

@Orinks
Copy link
Owner

@Orinks Orinks commented Feb 3, 2026

Summary

Adds comprehensive tests for the darksky.py module, improving coverage from 53% to 100%.

What's covered now

  • TwilightType.sun_angle_range property for all types
  • DarkSkyWindow.time_until_darkness() — all code paths (None, before, after, naive datetime)
  • DarkSkyWindow.time_remaining() — all code paths (None, after, during, before, naive datetime)
  • DarkSkyWindow.__str__() — no darkness reason, no data, fractional hours
  • DarkSkyWindow.is_currently_dark() — no data, naive datetime
  • get_twilight_type() — all angle ranges and boundaries
  • get_dark_sky_window() — polar summer/winter, non-polar missing data, best viewing time, moon times
  • DarkSkyClient — all async wrapper methods including close()
  • Naive datetime UTC conversion in is_astronomical_darkness()

Stats

  • 54 tests (up from 13)
  • Coverage: 53% → 100%
  • All existing tests continue to pass

Closes #1

Add comprehensive tests covering all previously uncovered areas:
- TwilightType.sun_angle_range property for all types
- DarkSkyWindow.time_until_darkness() all code paths
- DarkSkyWindow.time_remaining() all code paths
- DarkSkyWindow.__str__() edge cases (no data, no darkness reason)
- DarkSkyWindow.is_currently_dark() with naive datetimes
- get_twilight_type() function for all angle ranges
- get_dark_sky_window() polar/non-polar edge cases
- DarkSkyClient async wrapper methods
- Naive datetime UTC conversion paths

54 tests total, all passing. Coverage: 53% → 100%.

Closes #1
Add comprehensive tests covering all previously uncovered areas:
- TwilightType.sun_angle_range property
- DarkSkyWindow.time_until_darkness() - all paths
- DarkSkyWindow.time_remaining() - all paths
- DarkSkyWindow.__str__() edge cases
- get_twilight_type() function
- DarkSkyClient async wrapper methods
- Non-polar latitude with missing twilight data
- Naive datetime handling

Closes #1
@Orinks Orinks merged commit da28835 into main Feb 4, 2026
9 checks passed
@Orinks Orinks deleted the test/darksky-coverage branch February 4, 2026 02:03
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.

Improve darksky.py test coverage from 53% to 80%+

1 participant