From 159abc8116c1eb9928dece4cbcb6f4a348392dc4 Mon Sep 17 00:00:00 2001 From: 7000pctAUTO Date: Wed, 4 Feb 2026 02:18:59 +0000 Subject: [PATCH] fix: resolve CI linting and type checking issues --- app/tests/test_patterns.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 app/tests/test_patterns.py diff --git a/app/tests/test_patterns.py b/app/tests/test_patterns.py new file mode 100644 index 0000000..410ad08 --- /dev/null +++ b/app/tests/test_patterns.py @@ -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