def test_soma(): assert soma(1, 2) == 3 assert soma('1', '3') == 4 assert soma('2', 4) == 6 assert soma(5) == 10 assert soma('7') == 14 assert soma('um') == False assert soma('-1') == -2 assert soma(-1, '-2') == -3 assert soma(15.2, '-7.1') == 8.1 assert soma(7.2, 'j') == False
def test_Soma(self): self.assertEqual(soma(0, 0), 0) self.assertEqual(soma(0, 1), 1) self.assertEqual(soma(1, 0), 1) self.assertEqual(soma(10, 0), 10) self.assertEqual(soma(10, 10), 20) self.assertEqual(soma(100, 1000), 1100) self.assertEqual(soma(7, 7), 14)
def test_sum(self): # Arrange (Organiza) # Action (Ação) result = soma(2,2) # Assetion (Afirmações) self.assertEqual(result,4)
def calculadora(a, b, operacao): if operacao == "+": print(s.soma(a,b)) elif operacao == "-": print(sub.sub(a,b))
from soma import soma import sys a, b = [int(i) for i in sys.argv[1:3]] print("Vou calcular a média agora...") print(soma(a, b)) print("Executei no programa principal")
from soma import soma print('Executado no yyy') print('nome do arquivo') print(__name__) print(soma(25, 37))
# -*- coding: utf-8 -*- """ Created on Wed Jun 26 11:19:08 2019 @author: 05873472955 """ from soma import soma #soma 1 com 4 e mostra o resultado! print(soma(1,4))
import pot import fat print("Selecione o tipo de operação desejada") print() print("1) Soma") print("2) Subtração") print("3) Potenciação") print("4) Fatorial") print() try: opcao = int(input("Opção: ")) except: print("Opção incorreta") if opcao == 1: soma.soma() elif opcao == 2: subtrac.subtrac() elif opcao == 3: pot.pot() elif opcao == 4: fat.fat() else: print("Opção inválida")
from soma import soma from classificaTriangulo import ehTriangulo print(soma(3, 4)) print(ehTriangulo(2, 2, 4))
def main(): a = int(input('valor a: ')) b = int(input('valor b: ')) print(soma(a, b))
# -*- coding: UTF-8 -*- import soma if __name__ == "__main__": print(soma.soma(1, 2))
def test_soma(self): assert soma(0, 0) == 0
def test_soma0(): assert soma.soma(0, 2) == 2
def test_soma2(): assert soma.soma(-1, 5) == 4
def test_soma1(): assert soma.soma(1, 2) == 3
def test_soma (self): self.assertEqual(soma(1,10), 55) self.assertEqual(soma(1,1000), 500500)