예제 #1
0
    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, "")
예제 #2
0
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()
예제 #3
0
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()
예제 #4
0
def test_05():
    assert lambda_handler(e,'') == "Função inválida."
예제 #5
0
def test_04():
    assert lambda_handler(d,'') == "Nome da função inválido. Usar 'def desafio1(...)'"
예제 #6
0
def test_03():
    assert lambda_handler(c,'') == "a c"
예제 #7
0
def test_02():
    assert lambda_handler(b,'') == ''
예제 #8
0
def test_01():
    assert (lambda_handler(a,'')) == "a b c"