26c12469bc
QCQA Additions * tested on batch 10, small fixes + change to s3 output * Merged main into QCQA_Additions * unit tests for qc qa helpers * static error fix * another static fix * static fix again * fixed None check * static fix none * Merged main into QCQA_Additions * Small changes based on Katon's review Approved-by: Katon Minhas
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
import pytest
|
|
import sys
|
|
sys.path.append('src')
|
|
from qa_qc_helpers 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 |