Add some tests and remove .coveragerc

This commit is contained in:
2022-11-23 22:14:17 +01:00
parent a535ecc032
commit ee4c7702ca
6 changed files with 15 additions and 28 deletions

View File

@@ -1,21 +0,0 @@
# Configuration for coverage.py
[run]
branch = True
source = bayesclass
include = */bayesclass/*
omit =
*/setup.py
[report]
exclude_lines =
pragma: no cover
def __repr__
if self.debug:
if settings.DEBUG
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
if self.verbose:
show_missing = True

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

@@ -2,6 +2,8 @@ import pytest
import numpy as np import numpy as np
from sklearn.datasets import load_iris from sklearn.datasets import load_iris
from sklearn.preprocessing import KBinsDiscretizer from sklearn.preprocessing import KBinsDiscretizer
from matplotlib.testing.decorators import image_comparison
from matplotlib.testing.conftest import mpl_test_settings
from bayesclass.bayesclass import AODE from bayesclass.bayesclass import AODE
@@ -37,6 +39,17 @@ def test_AODE_default_hyperparameters(data, clf):
] ]
@image_comparison(
baseline_images=["line_dashes_AODE"], remove_text=True, extensions=["png"]
)
def test_AODE_plot(data, clf):
# mpl_test_settings will automatically clean these internal side effects
mpl_test_settings
dataset = load_iris(as_frame=True)
clf.fit(*data, features=dataset["feature_names"])
clf.plot("AODE Iris")
def test_AODE_version(clf): def test_AODE_version(clf):
"""Check AODE version.""" """Check AODE version."""
assert __version__ == clf.version() assert __version__ == clf.version()

View File

@@ -1,7 +0,0 @@
import doctest
import bayesclass
def load_tests(loader, tests, ignore):
tests.addTests(doctest.DocTestSuite(bayesclass))
return tests

View File

@@ -55,6 +55,8 @@ addopts = "--cov --cov-report html --cov-report term-missing --cov-fail-under 95
[tool.coverage.run] [tool.coverage.run]
source = ["bayesclass"] source = ["bayesclass"]
[tool.coverage.report]
show_missing = true
[tool.black] [tool.black]
line-length = 79 line-length = 79