Skip to content

test(darksky): improve test coverage from 53% to 90%#2

Closed
Orinks wants to merge 1 commit intomainfrom
improve-darksky-coverage
Closed

test(darksky): improve test coverage from 53% to 90%#2
Orinks wants to merge 1 commit intomainfrom
improve-darksky-coverage

Conversation

@Orinks
Copy link
Owner

@Orinks Orinks commented Feb 2, 2026

Summary

Improves test coverage for darksky.py from 53% to 90%, exceeding the 80% target from #1.

Tests Added

TwilightType Tests

  • sun_angle_range property for all twilight types

DarkSkyWindow Tests

  • time_until_darkness() - all code paths (before darkness, during darkness, no data)
  • time_remaining() - all code paths (before, during, after darkness, no data)
  • __str__() - 'no data available' edge case

Function Tests

  • get_twilight_type() - all return values (DAY, CIVIL, NAUTICAL, ASTRONOMICAL, NIGHT)
  • get_dark_sky_window() - non-polar latitude with missing twilight data

DarkSkyClient Async Tests

  • get_dark_sky_window() async wrapper
  • is_astronomical_darkness() async wrapper
  • close() async no-op

Coverage Results

Name                            Stmts   Miss Branch BrPart  Cover
src/accessisky/api/darksky.py     100      7     40      7    90%

Closes #1

Addresses #1 - Added comprehensive tests for:
- TwilightType.sun_angle_range property
- DarkSkyWindow.time_until_darkness() all code paths
- DarkSkyWindow.time_remaining() all code paths
- DarkSkyWindow.__str__() 'no data' edge case
- get_twilight_type() all return values
- DarkSkyClient async wrapper methods
- get_dark_sky_window() non-polar missing twilight data

Coverage: 53% → 90% (exceeds 80% target)
@Orinks Orinks force-pushed the improve-darksky-coverage branch from bc5825d to c620cd8 Compare February 2, 2026 21:05
@Orinks Orinks changed the title test: improve darksky.py coverage from 53% to 100% test(darksky): improve test coverage from 53% to 90% Feb 2, 2026
@Orinks
Copy link
Owner Author

Orinks commented Feb 5, 2026

Closing as superseded by #3 which achieved 100% coverage.

@Orinks Orinks closed this Feb 5, 2026
@Orinks Orinks deleted the improve-darksky-coverage branch February 5, 2026 01:47
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