diff --git a/openbb_platform/core/tests/provider/utils/test_validators.py b/openbb_platform/core/tests/provider/utils/test_validators.py new file mode 100644 index 00000000000..48ba7b232de --- /dev/null +++ b/openbb_platform/core/tests/provider/utils/test_validators.py @@ -0,0 +1,22 @@ +"""Test the provider validators.""" + +import pytest +from openbb_core.provider.utils.validators import check_single_value + + +@pytest.mark.parametrize( + "field, value, expected", + [ + ("test", "SYMBOL", "SYMBOL"), + ("test", None, None), + ("test", "", ""), + ("test", "SYMBOL1,SYMBOL2", ValueError), + ("test", "SYMBOL1;SYMBOL2", ValueError), + ], +) +def test_check_single_value(field, value, expected): + if expected == ValueError: + with pytest.raises(ValueError): + check_single_value(field, value) + else: + assert check_single_value(field, value) == expected