Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests to work with DomainTransformationError #244

Merged
merged 1 commit into from
Nov 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions orangecontrib/spectroscopy/tests/test_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,13 @@ def test_predict_same_domain(self):
def test_predict_samename_domain(self):
train, test = separate_learn_test(self.collagen)
test = destroy_atts_conversion(test)
aucdestroyed = AUC(TestOnTestData(train, test, [LogisticRegressionLearner()]))
self.assertTrue(0.45 < aucdestroyed < 0.55)
try:
from Orange.data.table import DomainTransformationError
with self.assertRaises(DomainTransformationError):
LogisticRegressionLearner()(train)(test)
except ImportError: # until Orange 3.19
aucdestroyed = AUC(TestOnTestData(train, test, [LogisticRegressionLearner()]))
self.assertTrue(0.45 < aucdestroyed < 0.55)

def test_predict_samename_domain_interpolation(self):
train, test = separate_learn_test(self.collagen)
Expand All @@ -69,8 +74,13 @@ def test_predict_samename_domain_interpolation(self):
def test_predict_different_domain(self):
train, test = separate_learn_test(self.collagen)
test = Interpolate(points=getx(test) - 1)(test) # other test domain
aucdestroyed = AUC(TestOnTestData(train, test, [LogisticRegressionLearner()]))
self.assertTrue(0.45 < aucdestroyed < 0.55)
try:
from Orange.data.table import DomainTransformationError
with self.assertRaises(DomainTransformationError):
LogisticRegressionLearner()(train)(test)
except ImportError: # until Orange 3.19
aucdestroyed = AUC(TestOnTestData(train, test, [LogisticRegressionLearner()]))
self.assertTrue(0.45 < aucdestroyed < 0.55)

def test_predict_different_domain_interpolation(self):
train, test = separate_learn_test(self.collagen)
Expand Down