Skip to content

Commit

Permalink
Add basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nikdoof committed Apr 1, 2024
1 parent 5d8d1ea commit 09b52cd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.PHONY: tests
tests:
python3 -m pytest

.PHONY: lint
lint:
python3 -m ruff check --output-format=github --select=E9,F63,F7,F82 --target-version=py39 .
python3 -m ruff check --output-format=github --target-version=py39 .
20 changes: 20 additions & 0 deletions tests/test_funcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import tildejsongen

def test_str2bool():
assert tildejsongen.str2bool('yes') is True
assert tildejsongen.str2bool('true') is True
assert tildejsongen.str2bool('t') is True
assert tildejsongen.str2bool('1') is True
assert tildejsongen.str2bool('on') is True

assert tildejsongen.str2bool('no') is False
assert tildejsongen.str2bool('false') is False
assert tildejsongen.str2bool('f') is False
assert tildejsongen.str2bool('0') is False
assert tildejsongen.str2bool('off') is False

assert tildejsongen.str2bool('ys') is False
assert tildejsongen.str2bool('truex') is False
assert tildejsongen.str2bool('z') is False
assert tildejsongen.str2bool('3') is False
assert tildejsongen.str2bool('maybe') is False

0 comments on commit 09b52cd

Please sign in to comment.