def testNegativeValues(self): ratio = self.__buildRatio([-1, -2, -1]) self.assertTrue(ratio.getValueAbsolute(-1) == None) self.assertTrue(ratio.getValueAbsolute(0) == None) self.assertTrue(ratio.getValueAbsolute(1) == -1) self.assertTrue(ratio.getValueAbsolute(2) == 0.5) self.assertTrue(ratio.getValueAbsolute(3) == None) self.assertTrue(ratio.getValue(1) == ratio.getValueAbsolute(1)) self.assertTrue(ratio.getValue() == ratio.getValueAbsolute(2))
def testSimple(self): ratio = self.__buildRatio([1, 2, 1]) self.assertTrue(ratio.getValueAbsolute(-1) == None) self.assertTrue(ratio.getValueAbsolute(0) == None) self.assertTrue(ratio.getValueAbsolute(1) == 1) self.assertTrue(ratio.getValueAbsolute(2) == -0.5) self.assertTrue(ratio.getValueAbsolute(3) == None) self.assertTrue(ratio.getValue(1) == ratio.getValueAbsolute(1)) self.assertTrue(ratio.getValue() == ratio.getValueAbsolute(2))