Skip to content

Commit

Permalink
Merge pull request #37 from cthoyt/improve-testing
Browse files Browse the repository at this point in the history
Improve testing
  • Loading branch information
benedekrozemberczki authored Jan 4, 2022
2 parents e653ff1 + d16e7dd commit 9ba200a
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 15 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,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 @@ -196,21 +198,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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ envlist =
lint
flake8
mypy
py

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

[testenv:lint]
deps =
Expand Down

0 comments on commit 9ba200a

Please sign in to comment.