Skip to content

Commit

Permalink
add first tests, use tdd stupid
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielclimb committed Feb 21, 2020
1 parent 22b78f5 commit 5432fbd
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
Empty file added tests/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions tests/context.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from utils.fix_string import string_test, string_to_float
from utils.mann_kendall import mk_test

19 changes: 19 additions & 0 deletions tests/test_fix_string.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 5432fbd

Please sign in to comment.