Files
doczyai-pipelines/fieldExtraction/tests/qa_qc/yn_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

26 lines
792 B
Python

import pytest
from src.qa_qc.qa_qc_utils import yn_check
def test_yn_check_with_valid_string_input():
# Test with valid string inputs
assert yn_check("Y") == ("Y", True)
assert yn_check("N") == ("N", True)
def test_yn_check_with_invalid_string_input():
# Test with invalid string inputs
assert yn_check("a") == ("a", False)
assert yn_check("yes") == ("yes", False)
def test_yn_check_with_non_string_input():
# Test with non-string inputs
assert yn_check(1) == ("1", False)
assert yn_check(True) == ("True", False)
def test_yn_check_with_non_convertible_input():
# Test with inputs that cannot be converted to string
def raise_type_error():
raise TypeError("Cannot convert to string")
assert yn_check(raise_type_error)[1] == False