Add regression test for GetData timeout parsing (#9)#61
Merged
Conversation
Issue #9 reported that a GetData timeout ("result= (timeout)") raised AGINoResultError. It was fixed in 12c4bd7 (2014) by making the value group optional in the KV regex, but the migrated issue was never closed and the behavior was untested. Add regression tests pinning it: the empty-value-with-data parse, and GetData.process_response returning ("", True) on timeout and ("<digits>", False) otherwise. Closes #9
Cover the common real-world GetData timeout where a caller enters some digits before the inter-digit timer expires. Asterisk replies "result=12 (timeout)", and process_response must return both the collected digits and the timeout flag. Pins the value/data split that the existing empty-value and no-timeout cases do not exercise together. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
Closes #9
Summary
Issue #9 reported that a
GetDatatimeout raisedAGINoResultError. Asterisk repliesresult= (timeout)(empty value, then the parenthetical), and the old KV regex required a non-empty value.It was already fixed in 12c4bd7 (2014, Neil Tallim, "Fix for i9") by making the value group optional. The issue was migrated from Google Code and never closed, and the behavior had no test. This adds regression coverage so it cannot silently break again.
Tests (tests/test_agi_core.py)
test_getdata_timeout_result_parses_without_error—200 result= (timeout)parses to value""/ data"timeout", noAGINoResultError.test_getdata_process_response_flags_timeout—GetData.process_responsereturns("", True)on timeout.test_getdata_process_response_returns_digits— returns("1234", False)for normal input.No code change (the fix predates this by ~12 years) and no changelog entry (nothing user-facing changed in this release). Suite: 40 passed.
🤖 Generated with Claude Code