Repository navigation
feat: warn if unexpected-error-in-is_valid_syntax #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jkowalleck
merged 8 commits into
main
from
feat/warn-if-unexpected-error-in-is_valid_syntax
Jul 20, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5d99494
feat: warn if unexpected-error-in-is_valid_syntax
jkowalleck 290c0dc
docs
jkowalleck 0a3e845
test: add test for RuntimeWarning in is_valid_syntax
Copilot 3bf3fd9
Merge branch 'feat/warn-if-unexpected-error-in-is_valid_syntax' of gi…
jkowalleck 466bfdf
tests
jkowalleck 7122fa9
dings
jkowalleck 0d20e77
Merge remote-tracking branch 'origin/main' into feat/warn-if-unexpect…
jkowalleck e324137
dings
jkowalleck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # Copyright (c) 2026 Jan Kowalleck - modifications and maintenance | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| import pytest | ||
| from unittest.mock import patch | ||
|
|
||
| from lark import exceptions | ||
|
|
||
| import rfc3987_syntax2.syntax_helpers as sut | ||
|
|
||
|
|
||
| def _raise_lark_error(*args: object, **kwargs: object) -> None: | ||
| raise exceptions.LarkError("unexpected test error") | ||
|
|
||
|
|
||
| def test_is_valid_syntax_warns_on_unexpected_lark_error() -> None: | ||
| with patch.object(sut, "parse", side_effect=_raise_lark_error): | ||
| with pytest.warns(RuntimeWarning, match=r"Unexpected LarkError"): | ||
| result = sut.is_valid_syntax( | ||
| term='unsupported-term', # type: ignore[arg-type] # on purpose | ||
| value="any-value") | ||
| assert result is False |
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.
Uh oh!
There was an error while loading. Please reload this page.