def test_answer(self): res = lambda_handler("errado", '') self.assertEqual(res, "Função inválida.") args = { 'ndes': '1', 'code': 'def desafio1(n):\n return 0\n # return n\n', 'args': [[1], [2], [3]], 'resp': [0, 0, 0], 'diag': ['a', 'b', 'c'] } res = lambda_handler(args, '') self.assertEqual(res, "")
def test_lambda_correct(): lambdaObj = {} lambdaObj['code'] = f2.read() lambdaObj['ndes'] = 1 lambdaObj['args'] = [[1], [2], [3]] lambdaObj['resp'] = [0, 0, 0] lambdaObj['diag'] = ['a', 'b', 'c'] resp = lambda_handler(lambdaObj, None) assert len(resp) == 0 f2.close()
def test_lambda_wrong(): lambdaObj = {} lambdaObj['code'] = f1.read() lambdaObj['ndes'] = 1 lambdaObj['args'] = [[1], [2], [3]] lambdaObj['resp'] = [0, 0, 0] lambdaObj['diag'] = ['a', 'b', 'c'] resp = lambda_handler(lambdaObj, None) assert resp == 'a b c' f1.close()
def test_05(): assert lambda_handler(e,'') == "Função inválida."
def test_04(): assert lambda_handler(d,'') == "Nome da função inválido. Usar 'def desafio1(...)'"
def test_03(): assert lambda_handler(c,'') == "a c"
def test_02(): assert lambda_handler(b,'') == ''
def test_01(): assert (lambda_handler(a,'')) == "a b c"