Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve testing #37

Merged
merged 6 commits into from
Jan 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 9 additions & 5 deletions README.md
Expand Up @@ -179,9 +179,11 @@ We are motivated to constantly make RexMex even better.
RexMex can be installed with the following command after the repo is cloned.

```sh
$ python setup.py install
$ pip install .
```

Use `-e/--editable` when developing.

**Installation via pip**

RexMex can be installed with the following pip command.
Expand All @@ -200,21 +202,23 @@ $ pip install rexmex --upgrade

**Running tests**

Tests can be run with `tox` with the following:

```sh
$ pytest ./tests/unit -cov rexmex/
$ pytest ./tests/integration -cov rexmex/
$ pip install tox
$ tox -e py
```

--------------------------------------------------------------------------------

**Citation**

If you use RexMex in a scientific publication, we would appreciate citations. Please see GitHubs built in citation tool.
If you use RexMex in a scientific publication, we would appreciate citations. Please see GitHub's built-in citation tool.



--------------------------------------------------------------------------------

**License**

- [Apache-2.0 License](https://github.com/AZ-AI/rexmex/blob/master/LICENSE)
- [Apache-2.0 License](https://github.com/AZ-AI/rexmex/blob/master/LICENSE)
4 changes: 3 additions & 1 deletion setup.py
Expand Up @@ -6,8 +6,9 @@
setup_requires = ["pytest-runner"]


tests_require = ["pytest", "pytest-cov", "mock", "unittest"]
tests_require = ["pytest", "pytest-cov"]

extras_require = {"test": tests_require}

keywords = [
"recommender",
Expand Down Expand Up @@ -37,6 +38,7 @@
install_requires=install_requires,
setup_requires=setup_requires,
tests_require=tests_require,
extras_require=extras_require,
classifiers=[
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
Expand Down
18 changes: 9 additions & 9 deletions tests/integration/test_aggregation.py
Expand Up @@ -15,37 +15,37 @@ def test_classification(self):
score_card = ScoreCard(metric_set)

performance_metrics = score_card.generate_report(self.scores)
assert performance_metrics.shape == (1, 11)
assert performance_metrics.shape == (1, len(metric_set))

performance_metrics = score_card.generate_report(self.scores, grouping=["source_group"])
assert performance_metrics.shape == (5, 11)
assert performance_metrics.shape == (5, len(metric_set))

performance_metrics = score_card.generate_report(self.scores, grouping=["source_group", "target_group"])
assert performance_metrics.shape == (20, 11)
assert performance_metrics.shape == (20, len(metric_set))

def test_regression(self):
metric_set = RatingMetricSet()
metric_set.normalize_metrics()
score_card = ScoreCard(metric_set)

performance_metrics = score_card.generate_report(self.scores)
assert performance_metrics.shape == (1, 7)
assert performance_metrics.shape == (1, len(metric_set))

performance_metrics = score_card.generate_report(self.scores, grouping=["source_group"])
assert performance_metrics.shape == (5, 7)
assert performance_metrics.shape == (5, len(metric_set))

performance_metrics = score_card.generate_report(self.scores, grouping=["source_group", "target_group"])
assert performance_metrics.shape == (20, 7)
assert performance_metrics.shape == (20, len(metric_set))

def test_addition(self):
metric_set = RatingMetricSet() + ClassificationMetricSet()
score_card = ScoreCard(metric_set)

performance_metrics = score_card.generate_report(self.scores)
assert performance_metrics.shape == (1, 18)
assert performance_metrics.shape == (1, len(metric_set))

performance_metrics = score_card.generate_report(self.scores, grouping=["source_group"])
assert performance_metrics.shape == (5, 18)
assert performance_metrics.shape == (5, len(metric_set))

performance_metrics = score_card.generate_report(self.scores, grouping=["source_group", "target_group"])
assert performance_metrics.shape == (20, 18)
assert performance_metrics.shape == (20, len(metric_set))
7 changes: 7 additions & 0 deletions tox.ini
Expand Up @@ -8,6 +8,13 @@ envlist =
lint
flake8
mypy
py

[testenv:py]
commands =
pytest --cov rexmex
extras =
test

[testenv:lint]
deps =
Expand Down