test: initial

This commit is contained in:
mhchia
2024-01-22 17:33:02 +08:00
parent 56e2f3cdb1
commit 0ee31303c0
3 changed files with 66 additions and 1 deletions

56
poetry.lock generated
View File

@@ -271,6 +271,14 @@ zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""}
docs = ["sphinx (>=3.5)", "sphinx (<7.2.5)", "jaraco.packaging (>=9.3)", "rst.linker (>=1.9)", "furo", "sphinx-lint", "jaraco.tidelift (>=1.4)"]
testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-ruff", "zipp (>=3.17)", "pytest-black (>=0.3.7)", "pytest-mypy (>=0.9.1)"]
[[package]]
name = "iniconfig"
version = "2.0.0"
description = "brain-dead simple config-ini parsing"
category = "dev"
optional = false
python-versions = ">=3.7"
[[package]]
name = "ipykernel"
version = "6.27.1"
@@ -671,6 +679,18 @@ python-versions = ">=3.8"
docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx-autodoc-typehints (>=1.24)", "sphinx (>=7.1.1)"]
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest-cov (>=4.1)", "pytest-mock (>=3.11.1)", "pytest (>=7.4)"]
[[package]]
name = "pluggy"
version = "1.3.0"
description = "plugin and hook calling mechanisms for python"
category = "dev"
optional = false
python-versions = ">=3.8"
[package.extras]
dev = ["pre-commit", "tox"]
testing = ["pytest", "pytest-benchmark"]
[[package]]
name = "prompt-toolkit"
version = "3.0.41"
@@ -751,6 +771,25 @@ python-versions = ">=3.6.8"
[package.extras]
diagrams = ["railroad-diagrams", "jinja2"]
[[package]]
name = "pytest"
version = "7.4.4"
description = "pytest: simple powerful testing with Python"
category = "dev"
optional = false
python-versions = ">=3.7"
[package.dependencies]
colorama = {version = "*", markers = "sys_platform == \"win32\""}
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
iniconfig = "*"
packaging = "*"
pluggy = ">=0.12,<2.0"
tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
[package.extras]
testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
[[package]]
name = "python-dateutil"
version = "2.8.2"
@@ -861,6 +900,14 @@ python-versions = ">=3.8"
[package.dependencies]
mpmath = ">=0.19"
[[package]]
name = "tomli"
version = "2.0.1"
description = "A lil' TOML parser"
category = "dev"
optional = false
python-versions = ">=3.7"
[[package]]
name = "torch"
version = "2.1.1"
@@ -973,7 +1020,7 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-ena
[metadata]
lock-version = "1.1"
python-versions = "^3.9"
content-hash = "03cd7c0d02c4808c77b5a68746bb6b1ebbc014edabea0ed29e9d490e07863029"
content-hash = "cf9482db6e504a38e3044e26a6b145e6fb4295936e19a6226e9b6dcbc2ba3270"
[metadata.files]
appnope = []
@@ -998,6 +1045,7 @@ fsspec = []
idna = []
importlib-metadata = []
importlib-resources = []
iniconfig = []
ipykernel = []
ipython = []
jedi = []
@@ -1033,6 +1081,7 @@ parso = []
pexpect = []
pillow = []
platformdirs = []
pluggy = []
prompt-toolkit = []
protobuf = []
psutil = []
@@ -1044,6 +1093,7 @@ pycparser = [
]
pygments = []
pyparsing = []
pytest = []
python-dateutil = []
pywin32 = []
pyzmq = []
@@ -1056,6 +1106,10 @@ six = [
stack-data = []
statistics = []
sympy = []
tomli = [
{file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"},
{file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"},
]
torch = []
tornado = []
traitlets = []

View File

@@ -18,6 +18,7 @@ click = "^8.1.7"
[tool.poetry.dev-dependencies]
ipykernel = "^6.27.1"
pytest = "^7.4.4"
[tool.poetry.scripts]
zkstats-cli = "zkstats.cli:main"

10
tests/test_core.py Normal file
View File

@@ -0,0 +1,10 @@
import pytest
# FIXME: it's just a template to be replaced with real tests later
@pytest.mark.parametrize("test_input,expected", [
("3+5", 8),
("2+4", 6),
("6*9", 54),
])
def test_eval(test_input, expected):
assert eval(test_input) == expected