Skip to content

Commit

Permalink
Test more numpy versions (#108)
Browse files Browse the repository at this point in the history
* TST: other numpy versions

* fix bash syntax

* fix bash syntax

* improve exception type

* drop numpy 1.10 tests again because anaconda does not support them

* Undo too-eager exception changes

* remove unnecessary type checks

* fix test issue

* potentially fix broken unit test?
  • Loading branch information
mfeurer authored Jan 28, 2019
1 parent 86b5195 commit 67923dc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 24 deletions.
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ env:
- DISTRIB="conda" PYTHON_VERSION="3.5"
- DISTRIB="conda" PYTHON_VERSION="3.6"
- DISTRIB="conda" PYTHON_VERSION="3.7" DOCPUSH="true"
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.15"
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.14"
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.13"
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.12"
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.11"

install:
- source ci_scripts/install.sh
Expand All @@ -38,4 +43,4 @@ deploy:
on:
branch: master
condition: $doc_result = "success"
local_dir: docs/$TRAVIS_BRANCH
local_dir: docs/$TRAVIS_BRANCH
12 changes: 4 additions & 8 deletions ConfigSpace/conditions.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,11 @@ cdef class AbstractCondition(ConditionComponent):
cdef public DTYPE_t vector_value

def __init__(self, child: Hyperparameter, parent: Hyperparameter) -> None:
if not isinstance(child, Hyperparameter):
raise ValueError("Argument 'child' is not an instance of "
"HPOlibConfigSpace.hyperparameter.Hyperparameter.")
if not isinstance(parent, Hyperparameter):
raise ValueError("Argument 'parent' is not an instance of "
"HPOlibConfigSpace.hyperparameter.Hyperparameter.")
if child == parent:
raise ValueError("The child and parent hyperparameter must be "
"different hyperparameters.")
raise ValueError(
"The child and parent hyperparameter must be different "
"hyperparameters."
)
self.child = child
self.parent = parent
self.child_vector_id = -1
Expand Down
10 changes: 7 additions & 3 deletions ci_scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ popd
conda create -n testenv --yes python=$PYTHON_VERSION pip
source activate testenv

pip install pip --upgrade
pip install numpy pytest pytest-cov codecov typing cython
if [[ ! -z "$NPY_VERSION" ]]; then
conda install -y numpy=$NPY_VERSION pytest pytest-cov cython
else
conda install -y numpy pytest pytest-cov cython
fi
pip install codecov typing

python setup.py install
python setup.py install
12 changes: 0 additions & 12 deletions test/test_forbidden.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ def test_forbidden_equals_clause(self):
hp2 = UniformIntegerHyperparameter("child", 0, 10)
hp3 = CategoricalHyperparameter("grandchild", ["hot", "cold"])

self.assertRaisesRegexp(
TypeError,
"Argument 'hyperparameter' has incorrect type \(expected ConfigSpace.hyperparameters.Hyperparameter, got str\)",
ForbiddenEqualsClause, "HP1", 1,
)

self.assertRaisesRegexp(
ValueError,
"Forbidden clause must be instantiated with a legal hyperparameter value for "
Expand Down Expand Up @@ -117,12 +111,6 @@ def test_in_condition(self):
hp3 = UniformIntegerHyperparameter("child2", 0, 10)
hp4 = CategoricalHyperparameter("grandchild", ["hot", "cold", "warm"])

self.assertRaisesRegexp(
TypeError,
"Argument 'hyperparameter' has incorrect type \(expected ConfigSpace.hyperparameters.Hyperparameter, got str\)",
ForbiddenInClause, "HP1", 1,
)

self.assertRaisesRegexp(
ValueError,
"Forbidden clause must be instantiated with a "
Expand Down

0 comments on commit 67923dc

Please sign in to comment.