def start (): runTests() listNumbers = initialiseList() print ("Which UI would you like to use? command-based / menu-based?\nType 'command' or 'menu':") answer = '' while answer != 'command' and answer != 'menu': answer = input('\t > ') if answer == 'command': UI_executeCommmands(listNumbers) elif answer == 'menu': UI_menuExecuteCommands(listNumbers) else: print('Invalid answer!')
def test_filterByModulo(): listNumbers = initialiseList() listModulo = filterByModulo(listNumbers, '<', 2) assert len(listModulo) == 2 and listModulo == [[1, 1], [0, 0]]
def test_filterByRealBetweenPositions(): listNumbers = initialiseList() listReal = filterByRealBetweenPositions(listNumbers, 0, 8) assert len(listReal) == 1 and listReal == [[0, 0]]
def test_filterByReal(): listNumbers = initialiseList() listReal = filterByReal(listNumbers) assert len(listReal) == 2 and listReal == [[0, 0], [15, 0]]
def test_replace(): listNumbers = initialiseList() replace(listNumbers, [0, 0], [-1, -1]) assert len(listNumbers) == 10 and listNumbers[1] == [-1, -1]
def test_removeBetweenPositions(): listNumbers = initialiseList() removeBetweenPositions(listNumbers, 1, 5) assert len(listNumbers) == 5 and listNumbers[1] == [-4, 11]
def test_removePosition(): listNumbers = initialiseList() removePosition(listNumbers, 2) assert len(listNumbers) == 9 and listNumbers[2] == [-12, -9]
def test_productBetweenPositions(): listNumbers = initialiseList() assert productBetweenPositions(listNumbers, 7, 9) == [720, 210]
def test_sumBetweenPositions(): listNumbers = initialiseList() assert sumBetweenPositions(listNumbers, 0, 2) == [20, -9]