test: add tests for accesslimit_count behavior; refactor entity helpers #553
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
Add test coverage for accesslimit_count functionality as requested in PR #551 review, plus refactor entity.py helper methods.
Proposed change
Tests
test_number.py:
test_number_entity_converts_float_to_int_for_accesslimit_count: Verifies that float values from NumberEntity frontend are properly converted to integers when stored in the code slottest_coordinator_events.py:
test_lock_unlocked_decrements_accesslimit_count: Verifies the count is decremented when a lock is unlocked with a code slottest_lock_unlocked_decrements_parent_lock_accesslimit_count: Verifies parent lock's count is decremented for child locks not overriding parenttest_lock_unlocked_does_not_decrement_when_count_zero: Verifies count doesn't go negativeRefactoring
entity.py:
_get_code_slots_numand_get_day_of_week_numinto single_get_x_nummethodLiteraltype for property_name parameter for type safety__init__by removing redundant guard checks (already handled in helper method)coordinator.py:
accesslimit_countvariable for consistency (PR fix: accesslimit_count not decrementing on lock use #551 review comment)Type of change
Additional information