Aleš Erjavec avatar Aleš Erjavec committed 94e1207

Fixed 'above_threshold' test condition.

It now tests True for scores equal to threshold (as documented).

Comments (0)

Files changed (2)

Orange/feature/selection.py

     """Return features (without scores) with scores above or
     equal to a specified threshold.
 
-    :param scores: a list such as one returned by
-      :obj:`~Orange.feature.scoring.score_all`
-    :type scores: list
-    :param threshold: threshold for selection
-    :type threshold: float
+    :param list scores:
+        A list such as one returned by :func:`.score_all`
+    :param float threshold: Threshold for selection.
     :rtype: :obj:`list`
 
     """
-    return [x[0] for x in scores if x[1] > threshold]
+    return [f for f, score in scores if score >= threshold]
 
 
 attsAboveThreshold = above_threshold

Orange/testing/unit/tests/test_feature_selection.py

         
     def test_above_threashold(self):
         threshold = self.scores[len(self.scores) / 2][1]
-        above = [item[0] for item in self.scores if item[1] > threshold]
+        above = [item[0] for item in self.scores if item[1] >= threshold]
         
         self.assertEqual(above, 
                          selection.above_threshold(self.scores, threshold)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.