I'm looking for a lightweight way to unit test a function without using a library. Would love to hear a few ways to do this. Particular application is writing fast tests for coding interviews!
Something like: def foo(a,b): return a+b
tests = [(10,5), (2,7)]
testResults = [15, 9]
def test():
results = list(map(foo, *tests))
assert results == testResults
Aucun commentaire:
Enregistrer un commentaire