Skip to content

Commit

Permalink
tests + setup fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
sergioburdisso committed Nov 12, 2019
1 parent ab9e8be commit a7fad94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@
'Topic :: Scientific/Engineering :: Visualization',
'Operating System :: OS Independent']

with open('README.md', encoding=__encode__) as readme:

__cwd__ = path.abspath(path.dirname(__file__))
__readme_file__ = path.join(__cwd__, 'README.md')
with open(__readme_file__, encoding=__encode__) as readme:
LONG_DESCRIPTION = readme.read()

with open('requirements.txt') as requirements:
__requirements_file__ = path.join(__cwd__, 'requirements.txt')
with open(__requirements_file__, encoding=__encode__) as requirements:
INSTALL_REQS = requirements.read().splitlines()


_version_re__ = r"__version__\s*=\s*['\"]([^'\"]+)['\"]"
__cwd__ = path.abspath(path.dirname(__file__))
__init_file__ = path.join(__cwd__, '%s/__init__.py' % DISTNAME)
with open(__init_file__, encoding=__encode__) as __init__py:
VERSION = re.search(_version_re__, __init__py.read()).group(1)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pyss3.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def argmax(lst):
return max(range(len(lst)), key=lst.__getitem__)


def perform_tests_with(clf, cv):
def perform_tests_with(clf, cv_test):
"""Perform some tests with the given classifier."""
assert clf.get_category_index("SpOrTs") == clf.get_category_index("sports")

Expand All @@ -91,7 +91,7 @@ def perform_tests_with(clf, cv):

y_pred = clf.predict_proba(x_test)
assert y_test == [clf.get_category_name(argmax(cv)) for cv in y_pred]
assert [round(p, 5) for p in y_pred[0]] == cv
assert [round(p, 5) for p in y_pred[0]] == cv_test

y_pred = clf.predict_proba(["bla bla bla"])
assert y_pred[0] == [0] * len(clf.get_categories())
Expand Down

0 comments on commit a7fad94

Please sign in to comment.