def okBtn_cb(): #Takes currently inputted values minIV = minIVUserInput.value maxIV = maxIVUserInput.value interval = intervalIVUserInput.value #Runs through validation algorithm isValidated,error = validation.validateInputs(minIV,maxIV,interval,exp.maxRange,exp.minRange) if not isValidated:#If they aren't valid # Show error errorDlg = template.ErrorDlg(error) self.open(errorDlg) else: if int(maxIV) - int(minIV) >= 200: #Set object variables self.isValidated = True self.startTime = int(minIV) self.endTime = int(maxIV) self.timeInterval = int(interval) self.close() else: errorDlg = template.ErrorDlg("Make the range at least 200") self.open(errorDlg)
def test_intervalMatch( self): #Tests that the interval and the max range match # For example, if I kept adding 2 to 75, you wouldn't arrive at 90 # This tests ensures that the numbers align correctly validInputs = v.validateInputs("75", "90", "2", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def okBtn_cb(): #Takes currently inputted values minIV = minIVUserInput.value maxIV = maxIVUserInput.value interval = intervalIVUserInput.value #Runs through validation algorithm self.isValidated, error = validation.validateInputs( minIV, maxIV, interval, exp.maxRange, exp.minRange) if not self.isValidated: #If they aren't valid # Show error errorDlg = template.ErrorDlg(error) self.open(errorDlg) else: #Set object variables if int(maxIV) - int(minIV) > 100: self.isValidated = True self.minIVValue = int(minIV) self.maxIVValue = int(maxIV) self.intervalValue = int(interval) self.close() else: errorDlg = template.ErrorDlg( "Have a range of at least 100") errorDlg.open()
def test_minMoreThanMax( self ): #Tests that the maximum value for the IV is below the minimum value validInputs = v.validateInputs("60", "50", "0", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def test_higherThanRange( self ): #Tests that the IV can't be inputted above the maximum range validInputs = v.validateInputs("90", "160", "10", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def test_lowerThanRange( self): #Tests that IV can't be inputted below the minimum range validInputs = v.validateInputs("-10", "60", "10", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def test_lessThan5Intervals( self): #Tests that there aren't too little intervals validInputs = v.validateInputs("0", "30", "10", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def test_moreThan10Intervals( self): #Tests that there aren't too many intervals validInputs = v.validateInputs("0", "11", "1", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def test_negativeInputs(self): #Tests that negative numbers are rejected validInputs = v.validateInputs("-12", "0", "2", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def test_floatInputs(self): #Tests that floats are rejected validInputs = v.validateInputs("3.2", "4.2", "0.2", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def test_emptyCheck(self): #Tests that the inputs aren't empty validInputs = v.validateInputs("", "", "", self.maxRange, self.minRange) self.assertEqual(validInputs[0], False)
def test_normalInputs( self): #Tests that the normal values are accepted by the algorithm validInputs = v.validateInputs("10", "100", "10", self.maxRange, self.minRange) self.assertEqual(validInputs[0], True)