Files
doczyai-pipelines/fieldExtraction/tests/qa_qc/state_test.py
T
Alex Galarce 53b38ea15c Merged in refactor/split-investment-and-client (pull request #347)
Refactor/split investment and client

* refactor: clean up tests

* Renamed tests/qcqa to tests/qa_qc for consistency

* comment out faulty test - see docstring note at top

* split to client/investment

* add __init__.py to investment and client to avoid mypy confusion

* fix imports

* update imports for consistency across investment module

* move back to one config

* try changing import to relative

* add init.py to src

* try relative import

* try one more sys.path.append

* fix path for client main

* fix imports in file_processing

* make prompts common

* move keywords out to `src`

* move smart_chunking_funcs to `src`

* fix mypy error

* start moving to explicit imports

* remove old keywords and fix imports for keywords and prompts

* change all imports to full paths

* fix unit tests

* add readme for new way of running things

* isort after all that import work

* remove unused sys.path.append from some tests


Approved-by: Katon Minhas
2025-01-08 21:59:47 +00:00

31 lines
1.0 KiB
Python

import pytest
from src.qa_qc.qa_qc_utils import state_check
def test_state_check_valid_abbreviations():
# Test with valid state abbreviations
assert state_check("CA") == ("California", True)
assert state_check("NY") == ("New York", True)
def test_state_check_valid_full_names():
# Test with valid state full names
assert state_check("California") == ("California", True)
assert state_check("new york") == ("New York", True)
def test_state_check_invalid_input():
# Test with invalid input
assert state_check("ABC") == ("ABC", False)
assert state_check("Invalid State") == ("Invalid State", False)
def test_state_check_non_string_input():
# Test with non-string input
assert state_check(123) == ("123", False)
assert state_check(True) == ("True", False)
def test_state_check_non_convertible_input():
# Test with input that cannot be converted to string
def raise_type_error():
raise TypeError("Cannot convert to string")
assert state_check(raise_type_error)[1] == False