def check(self, parsedInput: list, gameBoard: GameBoard) -> int: if len(parsedInput) != 3: Log('ERROR', 'Turn command - Invalid arguments.') return 84 if isInt(parsedInput[1]) is False or isInt(parsedInput[2]) is False: Log('ERROR', 'Turn command - Invalid size.') return 84 if int(parsedInput[1]) not in range(gameBoard._size)\ or int(parsedInput[2]) not in range(gameBoard._size): Log('ERROR', 'Turn command - Invalid size.') return 84 return 0
def check(self, parsedInput: list) -> int: if len(parsedInput) != 2 or isInt(parsedInput[1]) is False: Log('ERROR', 'Start command - Invalid arguments.') return 84 if int(parsedInput[1]) < 5: Log('ERROR', 'Start command - Invalid size.') return 84 return 0
def checkInput(coords: str) -> int: cs = coords.split(',') if len(cs) != 3: return 84 for c in cs: if isInt(c) is False: return 84 if int(cs[2]) not in [1, 2, 3]: return 84 if int(cs[0]) not in range(gameBoard._size) or int( cs[1]) not in range(gameBoard._size): return 84 return 0
def test_isInt_float_case(): assert isInt('1.2') is False
def test_isInt_letter_case(): assert isInt('a') is False
def test_isInt_normal_case(): assert isInt(2) is True