def test_constructor(self): w = ColorGradientSelection(thresholds=(0.1, 0.9)) self.assertEqual(w.thresholds(), (0.1, 0.9)) w = ColorGradientSelection(thresholds=(-0.1, 1.1)) self.assertEqual(w.thresholds(), (0.0, 1.0)) w = ColorGradientSelection(thresholds=(1.0, 0.0)) self.assertEqual(w.thresholds(), (1.0, 1.0))
def test_thresholds(self): w = ColorGradientSelection() w.setThresholds(0.2, 0.8) self.assertEqual(w.thresholds(), (0.2, 0.8)) w.setThresholds(0.5, 0.5) self.assertEqual(w.thresholds(), (0.5, 0.5)) w.setThresholds(0.5, np.nextafter(0.5, 0)) self.assertEqual(w.thresholds(), (0.5, 0.5)) w.setThresholds(-1, 2) self.assertEqual(w.thresholds(), (0., 1.)) w.setThresholds(0.1, 0.0) self.assertEqual(w.thresholds(), (0.1, 0.1)) w.setThresholdLow(0.2) self.assertEqual(w.thresholds(), (0.2, 0.2)) self.assertEqual(w.thresholdLow(), 0.2) w.setThresholdHigh(0.1) self.assertEqual(w.thresholdHigh(), 0.1) self.assertEqual(w.thresholds(), (0.1, 0.1))