Skip to content

Commit

Permalink
[test]: add test case for __version__ existence
Browse files Browse the repository at this point in the history
  • Loading branch information
ilias-ant committed Jul 19, 2023
1 parent 2af5e49 commit 577cab9
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,4 @@ dmypy.json
.pyre/

.DS_Store
.python-version
.ipynb_checkpoints/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ are_similar = validate(
# // {
# // "datasets_follow_same_distribution": True,
# // 'mean_roc_auc': 0.5021320833333334,
# // "adversarial_features': [],
# // "adversarial_features': ['id'],
# // }
```
2 changes: 1 addition & 1 deletion advertion/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .validate import validate
from .public import validate
from .version import __version__

__all__ = ["__version__", "validate"]
2 changes: 1 addition & 1 deletion advertion/validate.py → advertion/public.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def validate(
>>> // {
>>> // "datasets_follow_same_distribution": True,
>>> // 'mean_roc_auc': 0.5021320833333334,
>>> // "adversarial_features': [],
>>> // "adversarial_features': ['id'],
>>> // }
"""
Expand Down
16 changes: 14 additions & 2 deletions tests/test_validate.py → tests/test_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import pandas as pd
import pytest

from advertion.validate import validate
from advertion import validate


class TestValidate:
class TestPublic:
def test_validate_and_datasets_follow_same_distribution(self):
seed = 313233

Expand Down Expand Up @@ -111,3 +111,15 @@ def test_validate_and_datasets_do_not_follow_same_distribution_and_mean_roc_auc_
assert verdict["datasets_follow_same_distribution"] is False
assert verdict["mean_roc_auc"] == pytest.approx(0.15, abs=0.1)
assert verdict["adversarial_features"] == []

def test_version_exists(self):

try:

from advertion import __version__

assert isinstance(__version__, str)

except ImportError:

pytest.fail("advertion.__version__ does not exist.")

0 comments on commit 577cab9

Please sign in to comment.