Exemple #1
0
 def testClosestValSingle(self):
     val = util.closest_val(1., np.array([50.]))
     assert val == 0
Exemple #2
0
 def testValueErrorOnEmptyList(self):
     util.closest_val(1., [])
Exemple #3
0
 def testValueErrorOnEmptyArray(self):
     util.closest_val(1., np.array([]))
Exemple #4
0
 def testClosestValBelowList(self):
     val = util.closest_val(-5., self.list)
     assert val == 0
Exemple #5
0
 def testClosestValAboveList(self):
     val = util.closest_val(20., self.list)
     assert val == 2
Exemple #6
0
 def testClosestValAbove(self):
     val = util.closest_val(20., self.array)
     assert val == 2
Exemple #7
0
 def testClosestValAboveList(self):
     val = util.closest_val(20., self.list)
     assert val == 2
Exemple #8
0
 def testClosestValAbove(self):
     val = util.closest_val(20., self.array)
     assert val == 2
Exemple #9
0
 def testClosestValInternalNegative(self):
     val = util.closest_val(-3.5, -1 * self.array)
     assert val == 1
Exemple #10
0
 def testClosestValInternal(self):
     val = util.closest_val(3.5, self.array)
     assert val == 1
Exemple #11
0
 def testClosestValBelow(self):
     val = util.closest_val(-5., self.array)
     assert val == 0
Exemple #12
0
 def testClosestValSingle(self):
     val = util.closest_val(1., np.array([50.]))
     assert val == 0
Exemple #13
0
 def testValueErrorOnEmptyArray(self):
     util.closest_val(1., np.array([]))
Exemple #14
0
 def testValueErrorOnEmptyList(self):
     util.closest_val(1., [])
Exemple #15
0
 def testClosestValInternal(self):
     val = util.closest_val(3.5, self.array)
     assert val == 1
Exemple #16
0
 def testClosestValInternalList(self):
     val = util.closest_val(3.5, self.list)
     assert val == 1
Exemple #17
0
 def testClosestValBelow(self):
     val = util.closest_val(-5., self.array)
     assert val == 0
Exemple #18
0
 def testClosestValInternalList(self):
     val = util.closest_val(3.5, self.list)
     assert val == 1
Exemple #19
0
 def testClosestValInternalNegative(self):
     val = util.closest_val(-3.5, -1*self.array)
     assert val == 1
Exemple #20
0
 def testClosestValBelowList(self):
     val = util.closest_val(-5., self.list)
     assert val == 0