Skip to content

Instantly share code, notes, and snippets.

@hcosta
Created December 20, 2018 13:35
Show Gist options
  • Save hcosta/35da383fb2368c24d595c57b7c055afd to your computer and use it in GitHub Desktop.
Save hcosta/35da383fb2368c24d595c57b7c055afd to your computer and use it in GitHub Desktop.
import unittest
from calculator import Calculator
class TestMyCalculator(unittest.TestCase):
def setUp(self):
self.calc = Calculator()
def test_initial_value(self):
self.assertEqual(0, self.calc.value)
# Creamos un nuevo test para comprobar una suma
def test_add_method(self):
# Ejecutamos el método
self.calc.add(1, 3)
# Comprobamos si el valor es el que esperamos
self.assertEqual(4, self.calc.value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment