Changeset 10964:d65c874966b9 in orange


Ignore:
Timestamp:
08/16/12 11:32:40 (20 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Test that the returned distribution has the proper variable (class_var).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/testing/testing.py

    r10658 r10964  
    375375        classifier = self.learner(learn) 
    376376 
    377         # Test for classVar  
     377        # Test for classVar 
    378378        self.assertTrue(hasattr(classifier, "class_var")) 
    379         self.assertTrue(classifier.class_var is not None) 
     379        self.assertIs(classifier.class_var, dataset.domain.class_var) 
    380380 
    381381        res = _testing.test_on_data([classifier], test) 
    382382 
    383383        for ex in test: 
    384             self.assertIsInstance(classifier(ex, Orange.core.GetValue), Orange.core.Value) 
    385             self.assertIsInstance(classifier(ex, Orange.core.GetProbabilities), Orange.core.Distribution) 
     384            self.assertIsInstance(classifier(ex, Orange.core.GetValue), 
     385                                  Orange.core.Value) 
     386            self.assertIsInstance(classifier(ex, Orange.core.GetProbabilities), 
     387                                  Orange.core.Distribution) 
    386388 
    387389            value, dist = classifier(ex, Orange.core.GetBoth) 
     
    389391            self.assertIsInstance(value, Orange.core.Value) 
    390392            self.assertIsInstance(dist, Orange.core.Distribution) 
     393 
     394            self.assertIs(dist.variable, classifier.class_var) 
    391395 
    392396            if isinstance(dist, Orange.core.ContDistribution): 
Note: See TracChangeset for help on using the changeset viewer.