def testEquilatero(self): filepath1 = 'equi1.txt' Answer = Tri_from_file(filepath1) self.assertEqual(Answer, 'Equilátero') filepath2 = 'equi2.txt' Answer2 = Tri_from_file(filepath2) self.assertEqual(Answer2, 'Equilátero')
def testIsoceles(self): filepath1 = 'iso1.txt' Answer = Tri_from_file(filepath1) self.assertEqual(Answer, 'Isóceles') filepath2 = 'iso2.txt' Answer2 = Tri_from_file(filepath2) self.assertEqual(Answer2, 'Isóceles')
def testNoTri(self): filepath = 'notri1.txt' Answer = Tri_from_file(filepath) self.assertEqual(Answer, 'No triángulo') filepath = 'notri2.txt' Answer2 = Tri_from_file(filepath) self.assertEqual(Answer2, 'No triángulo') filepath = 'notri3.txt' Answer3 = Tri_from_file(filepath) self.assertEqual(Answer3, 'No triángulo')
def testEscaleno(self): esperado = "Escaleno" with mock.patch('primer_parcial.open') as mock_open: for m in [v for i,v in self.mocks.items() if "esca" in i]: mock_open.return_value.__enter__.return_value.read.return_value = m real = Tri_from_file("mock") assert esperado == real
def test_is_escaleno(): expected = "Es Escaleno" real = Tri_from_file("is_escaleno.txt") assert expected == real
def test_is_isoceles2(): expected = "Es iscoceles" real = Tri_from_file("is_isoceles2.txt") assert expected == real
def test_is_equilatero(): expected = "Es equilatero" real = Tri_from_file("is_equilatero.txt") assert expected == real
def test_no_triangulo3(): expected = "No es triangulo" real = Tri_from_file("no_triangulo3.txt") assert expected == real
def testEscaleno(self): self.assertEqual(Tri_from_file(self.esca1.name), 'Escaleno')
def testIsoceles(self): self.assertEqual(Tri_from_file(self.iso1.name), 'Isósceles') self.assertEqual(Tri_from_file(self.iso2.name), 'Isósceles')
def testNoTri(self): self.assertEqual(Tri_from_file(self.notri1.name), 'No triángulo') self.assertEqual(Tri_from_file(self.notri2.name), 'No triángulo') self.assertEqual(Tri_from_file(self.notri3.name), 'No triángulo')
def testEquilatero(self): self.assertEqual(Tri_from_file(self.equi1.name), 'Equilátero') self.assertEqual(Tri_from_file(self.equi2.name), 'Equilátero')
def testEscaleno(self): filepath = 'esca1.txt' Answer = Tri_from_file(filepath) self.assertEqual(Answer, 'Escaleno')