source: orange/Orange/testing/unit/tests/test_knn.py @ 9724:318e91106d47

Revision 9724:318e91106d47, 745 bytes checked in by markotoplak, 2 years ago (diff)

Renames in Orange.distance.

Line 
1import unittest
2import Orange
3from Orange.misc import testing
4from Orange.misc.testing import datasets_driven, test_on_data
5from Orange.classification import knn
6from Orange.distance import Euclidean
7
8
9@testing.datasets_driven(datasets=testing.CLASSIFICATION_DATASETS + \
10                         testing.REGRESSION_DATASETS)
11class TestKNNLearner(testing.LearnerTestCase):
12    def setUp(self):
13        self.learner = knn.kNNLearner(distance_constructor=Euclidean())
14   
15    @testing.test_on_data
16    def test_learner_on(self, dataset):
17        testing.LearnerTestCase.test_learner_on(self, dataset)
18        instance = dataset.random_instance()
19        self.assertEqual(len(self.classifier.find_nearest(3, instance)), 3)
20       
21   
22   
23   
Note: See TracBrowser for help on using the repository browser.