fix: resolve CI linting and type checking issues
Some checks failed
CI / test (push) Has been cancelled
Some checks failed
CI / test (push) Has been cancelled
This commit is contained in:
36
app/tests/test_patterns.py
Normal file
36
app/tests/test_patterns.py
Normal file
@@ -0,0 +1,36 @@
|
||||
import pytest
|
||||
from cmdparse.patterns import detect_pattern_type, PATTERNS
|
||||
|
||||
|
||||
def test_detect_table_with_pipes():
|
||||
"""Test detection of table format with pipe separators."""
|
||||
text = "| Name | Age |\n| Alice | 30 |"
|
||||
assert detect_pattern_type(text) == 'table'
|
||||
|
||||
|
||||
def test_detect_key_value_colon():
|
||||
"""Test detection of key-value with colon."""
|
||||
text = "key1: value1\nkey2: value2"
|
||||
assert detect_pattern_type(text) == 'key_value_colon'
|
||||
|
||||
|
||||
def test_detect_delimited_tab():
|
||||
"""Test detection of tab-delimited format."""
|
||||
text = "name\tage\tcity\nalice\t30\tnyc"
|
||||
assert detect_pattern_type(text) == 'delimited_tab'
|
||||
|
||||
|
||||
def test_detect_empty():
|
||||
"""Test detection of empty input."""
|
||||
assert detect_pattern_type("") == 'empty'
|
||||
|
||||
|
||||
def test_detect_raw():
|
||||
"""Test detection of raw/unstructured text."""
|
||||
text = "some random text without pattern"
|
||||
assert detect_pattern_type(text) == 'raw'
|
||||
|
||||
|
||||
def test_patterns_not_empty():
|
||||
"""Test that PATTERNS list is not empty."""
|
||||
assert len(PATTERNS) > 0
|
||||
Reference in New Issue
Block a user