Spaces:
Build error
Build error
File size: 1,776 Bytes
51ff9e5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
from openhands.resolver.utils import extract_issue_references
def test_extract_issue_references():
# Test basic issue reference
assert extract_issue_references('Fixes #123') == [123]
# Test multiple issue references
assert extract_issue_references('Fixes #123, #456') == [123, 456]
# Test issue references in code blocks should be ignored
assert extract_issue_references("""
Here's a code block:
```python
# This is a comment with #123
def func():
pass # Another #456
```
But this #789 should be extracted
""") == [789]
# Test issue references in inline code should be ignored
assert extract_issue_references(
'This `#123` should be ignored but #456 should be extracted'
) == [456]
assert extract_issue_references(
'This `#123` should be ignored but #456 should be extracted'
) == [456]
# Test issue references in URLs should be ignored
assert extract_issue_references(
'Check http://example.com/#123 but #456 should be extracted'
) == [456]
assert extract_issue_references(
'Check http://example.com/#123 but #456 should be extracted'
) == [456]
# Test issue references in markdown links should be extracted
assert extract_issue_references('[Link to #123](http://example.com) and #456') == [
123,
456,
]
assert extract_issue_references('[Link to #123](http://example.com) and #456') == [
123,
456,
]
# Test issue references with text around them
assert extract_issue_references('Issue #123 is fixed and #456 is pending') == [
123,
456,
]
assert extract_issue_references('Issue #123 is fixed and #456 is pending') == [
123,
456,
]
|