diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/context.py b/tests/context.py new file mode 100644 index 0000000..7ae38a1 --- /dev/null +++ b/tests/context.py @@ -0,0 +1,3 @@ +from utils.fix_string import string_test, string_to_float +from utils.mann_kendall import mk_test + diff --git a/tests/test_fix_string.py b/tests/test_fix_string.py new file mode 100644 index 0000000..189e724 --- /dev/null +++ b/tests/test_fix_string.py @@ -0,0 +1,19 @@ +import pytest + +from .context import string_test, string_to_float + + +def test_string_to_float(): + value = "< 2" + string = 'test<' + assert 2 == string_to_float(value) + assert type(string_to_float(value)) == float + with pytest.raises(ValueError): + string_to_float(string) + + +def test_string_to_test(): + value = "2" + string = 'test' + assert None == string_test(value) + assert 'test' == string_test(string)