Add test data
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
coverage.xml
|
||||||
|
.coverage
|
||||||
11
setup.cfg
11
setup.cfg
@@ -9,5 +9,16 @@ skip = .venv,.tox
|
|||||||
extend-ignore = E203,E501
|
extend-ignore = E203,E501
|
||||||
extend-exclude = .venv
|
extend-exclude = .venv
|
||||||
|
|
||||||
|
[tool:pytest]
|
||||||
|
addopts =
|
||||||
|
--cov-report term-missing --cov-branch --cov-report xml --cov-report term
|
||||||
|
--cov=tests.code -vv --strict-markers -rfE
|
||||||
|
|
||||||
|
filterwarnings =
|
||||||
|
error
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
no_implicit_optional = True
|
no_implicit_optional = True
|
||||||
|
|
||||||
|
[mypy-django.*,importlib_metadata.*,psycopg2.*,aiopg.*]
|
||||||
|
ignore_missing_imports = True
|
||||||
|
|||||||
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
10
tests/code.py
Normal file
10
tests/code.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
def code(arg: Optional[bool]) -> str:
|
||||||
|
if arg is None:
|
||||||
|
return "a"
|
||||||
|
elif arg is True:
|
||||||
|
return "b"
|
||||||
|
else:
|
||||||
|
return "c"
|
||||||
2
tests/requirements.txt
Normal file
2
tests/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
pytest
|
||||||
|
pytest-cov
|
||||||
8
tests/test_code.py
Normal file
8
tests/test_code.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import pytest
|
||||||
|
|
||||||
|
from . import code
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("arg, expected", [(None, "a")])
|
||||||
|
def test_code(arg, expected):
|
||||||
|
assert code.code(arg) == expected
|
||||||
Reference in New Issue
Block a user