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
26 lines
816 B
Python
26 lines
816 B
Python
import pytest
|
|
import sys
|
|
sys.path.append('src')
|
|
from qa_qc_helpers 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 |