Add tests for uncovered exception and edge-case branches - #69
Merged
Conversation
Cover five previously untested paths:
- `_get_position_time`: parse_datetime returns None (fallback to raw value)
- `_get_position_time`: parse_datetime raises ValueError (fallback to raw value)
- `_get_mode` / `_get_mode_attrs`: device.mode is None → returns None / {}
- `PetTracerDeviceTracker.available`: returns False when device absent from coordinator
- `async_step_reauth_confirm`: unknown exception → errors["base"] = "unknown"
Also assert `last_contact` key in device tracker attributes test.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The test suite now covers all major branches including exception fallbacks and edge cases, making 90% a meaningful and achievable bar. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Merged
kylegordon
added a commit
that referenced
this pull request
Aug 16, 2026
## What's Changed * Add tests for uncovered exception and edge-case branches by @kylegordon in #69 * chore(deps): update pytest-homeassistant-custom-component requirement from >=0.13.342 to >=0.13.345 by @dependabot[bot] in #71 * chore(deps): update pytest-homeassistant-custom-component requirement from >=0.13.345 to >=0.13.346 by @dependabot[bot] in #72 * chore(deps): update pytest-homeassistant-custom-component requirement from >=0.13.346 to >=0.13.348 by @dependabot[bot] in #74 * chore(deps): update pytest-homeassistant-custom-component requirement from >=0.13.348 to >=0.13.350 by @dependabot[bot] in #75 * chore(deps): bump actions/setup-python from 6 to 7 by @dependabot[bot] in #73 * chore(deps): update pytest-homeassistant-custom-component requirement from >=0.13.350 to >=0.13.354 by @dependabot[bot] in #76 * gh aw daily-repo by @kylegordon in #77 * Add agentic workflow grumpy-reviewer by @kylegordon in #78 * Make entity naming and entity_id independent of pet name by @kylegordon in #80 * Pin Copilot CLI version in grumpy-reviewer to avoid toolcache ENOENT by @kylegordon in #84 **Full Changelog**: v1.0.8...v1.0.9 Co-authored-by: kylegordon <231528+kylegordon@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_get_position_timefallback paths (test_sensor.py): covers the two branches whereparse_datetimereturnsNoneor raisesValueError/TypeError— both fall back to returningdevice.lastPos.timeMeasuredirectly_get_mode/_get_mode_attrswithNonemode (test_sensor.py): verifies the sensor returnsNoneand{}whendevice.mode is NonePetTracerDeviceTracker.availablereturningFalse(test_device_tracker.py): verifies the tracker reports unavailable when its device is no longer present in coordinator datatest_config_flow.py): coversasync_step_reauth_confirm'sexcept Exceptionbranch (the equivalent user-step path was already tested)last_contactattribute (test_device_tracker.py): adds assertion to existing attributes test to verify the key is presentTest plan
🤖 Generated with Claude Code