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