Skip to content

Commit 12f8b5b

Browse files
committed
test: update for changes to viya & pandas
1 parent 48ec416 commit 12f8b5b

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

tests/integration/test_model_repository.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ def test_copy_astore(self):
5454
"""Copy the ASTORE to filesystem for MAS"""
5555
job = mr.copy_analytic_store(self.MODEL_NAME)
5656

57-
assert job.state == "pending"
57+
# Later versions of Viya 4 seem to have dropped the "state" attribute.
58+
if hasattr(job, "state"):
59+
assert job.state == "pending"
5860

5961
def test_model_publish(self, cache):
6062
"""Publish the imported model to MAS"""

tests/integration/test_tasks.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ def sklearn_logistic_model():
3434
iris = pd.DataFrame(raw.data, columns=raw.feature_names)
3535
iris = iris.join(pd.DataFrame(raw.target))
3636
iris.columns = ["SepalLength", "SepalWidth", "PetalLength", "PetalWidth", "Species"]
37-
iris["Species"] = iris["Species"].astype("category")
38-
iris.Species.cat.categories = raw.target_names
37+
iris["Species"] = iris["Species"].astype("category").cat.rename_categories(raw.target_names)
3938

4039
with warnings.catch_warnings():
4140
warnings.simplefilter("ignore")
@@ -205,7 +204,7 @@ def test_register_model(self, sklearn_linear_model):
205204
assert "prediction" == model.function.lower()
206205
assert "Linear regression" == model.algorithm
207206
assert "Python" == model.trainCodeType
208-
assert "ds2MultiType" == model.scoreCodeType
207+
assert model.scoreCodeType in ("ds2MultiType", "python")
209208

210209
assert len(model.inputVariables) == 13
211210
assert len(model.outputVariables) == 1

tests/integration/test_write_json_files.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def _classification_model(data, target):
1919
from sklearn.model_selection import train_test_split
2020
from sklearn.tree import DecisionTreeClassifier
2121

22-
data = pd.get_dummies(data, drop_first=True).fillna(data.mean())
22+
data = pd.get_dummies(data, drop_first=True)
23+
data.fillna(data.mean(), inplace=True)
2324
x_train, x_test, y_train, y_test = train_test_split(
2425
data.drop(columns=target), data[target], test_size=0.3
2526
)

0 commit comments

Comments
 (0)