Skip to content

Commit 67923dc

Browse files
authored
Test more numpy versions (#108)
* 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?
1 parent 86b5195 commit 67923dc

4 files changed

Lines changed: 17 additions & 24 deletions

File tree

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ env:
1717
- DISTRIB="conda" PYTHON_VERSION="3.5"
1818
- DISTRIB="conda" PYTHON_VERSION="3.6"
1919
- DISTRIB="conda" PYTHON_VERSION="3.7" DOCPUSH="true"
20+
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.15"
21+
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.14"
22+
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.13"
23+
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.12"
24+
- DISTRIB="conda" PYTHON_VERSION="3.7" NPY_VERSION="1.11"
2025

2126
install:
2227
- source ci_scripts/install.sh
@@ -38,4 +43,4 @@ deploy:
3843
on:
3944
branch: master
4045
condition: $doc_result = "success"
41-
local_dir: docs/$TRAVIS_BRANCH
46+
local_dir: docs/$TRAVIS_BRANCH

ConfigSpace/conditions.pyx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,11 @@ cdef class AbstractCondition(ConditionComponent):
101101
cdef public DTYPE_t vector_value
102102

103103
def __init__(self, child: Hyperparameter, parent: Hyperparameter) -> None:
104-
if not isinstance(child, Hyperparameter):
105-
raise ValueError("Argument 'child' is not an instance of "
106-
"HPOlibConfigSpace.hyperparameter.Hyperparameter.")
107-
if not isinstance(parent, Hyperparameter):
108-
raise ValueError("Argument 'parent' is not an instance of "
109-
"HPOlibConfigSpace.hyperparameter.Hyperparameter.")
110104
if child == parent:
111-
raise ValueError("The child and parent hyperparameter must be "
112-
"different hyperparameters.")
105+
raise ValueError(
106+
"The child and parent hyperparameter must be different "
107+
"hyperparameters."
108+
)
113109
self.child = child
114110
self.parent = parent
115111
self.child_vector_id = -1

ci_scripts/install.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ popd
2828
conda create -n testenv --yes python=$PYTHON_VERSION pip
2929
source activate testenv
3030

31-
pip install pip --upgrade
32-
pip install numpy pytest pytest-cov codecov typing cython
31+
if [[ ! -z "$NPY_VERSION" ]]; then
32+
conda install -y numpy=$NPY_VERSION pytest pytest-cov cython
33+
else
34+
conda install -y numpy pytest pytest-cov cython
35+
fi
36+
pip install codecov typing
3337

34-
python setup.py install
38+
python setup.py install

test/test_forbidden.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,6 @@ def test_forbidden_equals_clause(self):
4949
hp2 = UniformIntegerHyperparameter("child", 0, 10)
5050
hp3 = CategoricalHyperparameter("grandchild", ["hot", "cold"])
5151

52-
self.assertRaisesRegexp(
53-
TypeError,
54-
"Argument 'hyperparameter' has incorrect type \(expected ConfigSpace.hyperparameters.Hyperparameter, got str\)",
55-
ForbiddenEqualsClause, "HP1", 1,
56-
)
57-
5852
self.assertRaisesRegexp(
5953
ValueError,
6054
"Forbidden clause must be instantiated with a legal hyperparameter value for "
@@ -117,12 +111,6 @@ def test_in_condition(self):
117111
hp3 = UniformIntegerHyperparameter("child2", 0, 10)
118112
hp4 = CategoricalHyperparameter("grandchild", ["hot", "cold", "warm"])
119113

120-
self.assertRaisesRegexp(
121-
TypeError,
122-
"Argument 'hyperparameter' has incorrect type \(expected ConfigSpace.hyperparameters.Hyperparameter, got str\)",
123-
ForbiddenInClause, "HP1", 1,
124-
)
125-
126114
self.assertRaisesRegexp(
127115
ValueError,
128116
"Forbidden clause must be instantiated with a "

0 commit comments

Comments
 (0)