MCPcopy Create free account
hub / github.com/SegataLab/lefse / funcIsValidBoundedIntegerChar

Method funcIsValidBoundedIntegerChar

lefsebiom/ValidateData.py:330–372  ·  view source on GitHub ↗

Validates a parameter as a valid characater that represents an integer inclusively bounded by two given values. :param parameterValue: Value to be evaluated. :type Unknown :param iValueOne: One bound for the value. :type Integer :param iValueTwo: The

(parameterValue, iValueOne, iValueTwo)

Source from the content-addressed store, hash-verified

328 #Tested 15
329 @staticmethod
330 def funcIsValidBoundedIntegerChar(parameterValue, iValueOne, iValueTwo):
331 """
332 Validates a parameter as a valid characater that represents an integer inclusively bounded by two given values.
333
334 :param parameterValue: Value to be evaluated.
335 :type Unknown
336 :param iValueOne: One bound for the value.
337 :type Integer
338 :param iValueTwo: The other bound for the data.
339 :type Integer
340 :return Boolean: True indicates the parameter is a valid value.
341 :type Boolean
342 """
343
344 #Check to make sure is a valid string
345 if not ValidateData.funcIsValidString(parameterValue):
346 return False
347
348 #Check to make sure is a valid integer
349 if not ValidateData.funcIsValidInteger(iValueOne):
350 return False
351
352 #Check to make sure is a valid integer
353 if not ValidateData.funcIsValidInteger(iValueTwo):
354 return False
355
356 #Try to convert to decimal
357 try:
358 intConversion = int(parameterValue)
359 if(iValueOne < iValueTwo):
360 if ((intConversion >= iValueOne) and (intConversion <= iValueTwo)):
361 return True
362 return False
363 if(iValueTwo < iValueOne):
364 if ((intConversion >= iValueTwo) and (intConversion <= iValueOne)):
365 return True
366 return False
367 if(iValueOne == iValueTwo):
368 if (intConversion == iValueOne):
369 return True
370 return False
371 except:
372 return False
373
374 #Tested 9
375 @staticmethod

Callers

nothing calls this directly

Calls 2

funcIsValidStringMethod · 0.80
funcIsValidIntegerMethod · 0.80

Tested by

no test coverage detected