def test_calculo_porcentagem_entre_0_e_100_cenario_1(): assert calculo_porcentagem_entre_0_e_100(10, 10) == 1.0
def test_calculo_porcentagem_entre_0_e_100_cenario_2(): with pytest.raises(ValueError) as error: calculo_porcentagem_entre_0_e_100(10, 200) assert str(error.value) == 'Porcentagem precisa estar entre 0 e 100'
def test_wrong_cenario_2(self): """ Porcentagem abaixo do permitido """ with pytest.raises(ValueError) as error: porcentagem = calculo_porcentagem_entre_0_e_100(valor=100, porcentagem=-1) assert str(error.value) == 'Porcentagem precisa estar entre 0 e 100'
def test_values_cenario_1(self, valor, porcentagem, resultado): calculo = calculo_porcentagem_entre_0_e_100(valor, porcentagem) assert calculo == pytest.approx(resultado, 0.1)
def test_exercicio07_cenario_2(): assert calculo_porcentagem_entre_0_e_100(100, 25) == 25
def test_exercicio07_cenario_1(): with pytest.raises(ValueError) as error: calculo_porcentagem_entre_0_e_100(100, 0) assert str(error.value) == "Porcentagem precisa estar entre 0 e 100"
def test_exercicio07_cenario_3(): assert calculo_porcentagem_entre_0_e_100(100, 50) == 50