示例#1
0
 def test_edges(self):
     """Test edge cases"""
     x = np.array([0, 1])
     self.assertEqual(npinterval.half_sample_mode(x), 0.5)
     x = np.array([0, 1, 1])
     self.assertEqual(npinterval.half_sample_mode(x), 1)
示例#2
0
 def test_right(self):
     """Test edge case where mode is right-most values"""
     x = np.array([-100, -2, -1, 0, 1, 1.1])
     self.assertEqual(npinterval.half_sample_mode(x), +1.05)
示例#3
0
 def test_central(self):
     """Test edge case where mode is near middle"""
     x = np.array([-100, -2, 0, 0, 1, 1.1])
     self.assertEqual(npinterval.half_sample_mode(x), 0)
示例#4
0
 def test_left(self):
     """Test edge case where mode is left-most values"""
     x = np.array([-1.1, -1, 0, 1, 2, 100])
     self.assertEqual(npinterval.half_sample_mode(x), -1.05)