Skip to content

Instantly share code, notes, and snippets.

@colltoaction
Created July 3, 2012 16:31
Show Gist options
  • Save colltoaction/3040847 to your computer and use it in GitHub Desktop.
Save colltoaction/3040847 to your computer and use it in GitHub Desktop.
Una función en python para mostrar cómo testear una función de forma sencilla
def funcion_que_prueba_la_suma():
suma = 1 + 2
assert suma == 3, 'La suma no funciona correctamente, su resultado fue ' + str(suma) + ', distinto de 3'
# si el assert no corta la ejecución, entonces funcionó bien
print 'La suma funciona correctamente'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment