Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def testWrongListType(self):
self.assertRaises(TypeError, minimalmodbus._checkFunctioncode, 4, 4)
self.assertRaises(TypeError, minimalmodbus._checkFunctioncode, 4, 'ABC')
self.assertRaises(TypeError, minimalmodbus._checkFunctioncode, 4, (4, 5))
self.assertRaises(ValueError, minimalmodbus._checkFunctioncode, 4, [4, -23])
self.assertRaises(ValueError, minimalmodbus._checkFunctioncode, 4, [4, 128])
self.assertRaises(TypeError, minimalmodbus._checkFunctioncode, 4, [4, '5'])
self.assertRaises(TypeError, minimalmodbus._checkFunctioncode, 4, [4, None])
self.assertRaises(TypeError, minimalmodbus._checkFunctioncode, 4, [4, [5]])
self.assertRaises(TypeError, minimalmodbus._checkFunctioncode, 4, [4.0, 5])
def testCorrectFunctioncode(self):
minimalmodbus._checkFunctioncode( 4, [4, 5] )
def testCorrectFunctioncodeNoRange(self):
minimalmodbus._checkFunctioncode( 4, None )
minimalmodbus._checkFunctioncode( 75, None )
def testCorrectFunctioncodeNoRange(self):
minimalmodbus._checkFunctioncode( 4, None )
minimalmodbus._checkFunctioncode( 75, None )