2018-11-05 23:38:41 +00:00
|
|
|
import pytest
|
2018-10-22 10:51:03 +00:00
|
|
|
|
2018-11-05 23:38:41 +00:00
|
|
|
|
|
|
|
def test_scikit_learn(selenium_standalone, request):
|
2018-10-22 10:51:03 +00:00
|
|
|
selenium = selenium_standalone
|
2018-11-05 23:38:41 +00:00
|
|
|
if selenium.browser == 'chrome':
|
|
|
|
request.applymarker(pytest.mark.xfail(
|
|
|
|
run=False, reason='chrome not supported'))
|
2018-10-22 10:51:03 +00:00
|
|
|
selenium.load_package("scikit-learn")
|
|
|
|
assert selenium.run("""
|
|
|
|
import numpy as np
|
|
|
|
import sklearn
|
|
|
|
from sklearn.linear_model import LogisticRegression
|
|
|
|
|
|
|
|
rng = np.random.RandomState(42)
|
|
|
|
X = rng.rand(100, 20)
|
|
|
|
y = rng.randint(5, size=100)
|
|
|
|
|
|
|
|
estimator = LogisticRegression(solver='liblinear')
|
|
|
|
estimator.fit(X, y)
|
|
|
|
print(estimator.predict(X))
|
|
|
|
estimator.score(X, y)
|
|
|
|
""") > 0
|