Skip to content

Instantly share code, notes, and snippets.

@tebeka
Created June 6, 2011 19:38
Show Gist options
  • Select an option

  • Save tebeka/1010923 to your computer and use it in GitHub Desktop.

Select an option

Save tebeka/1010923 to your computer and use it in GitHub Desktop.
def test_empty():
assert sum([]) == 0
def test_positive():
assert sum([1, 2, 3]) == 6
def test_negative():
assert sum([-1, -2]) == -3
def test_floats():
assert abs(sum([0.1, 0.2]) - 0.3) < 0000.1
def test_start():
assert sum([1, 2], 10) == 13
def test_no_params():
try:
sum()
except TypeError:
pass
def test_bad_params():
try:
sum(["a", "b"])
except TypeError:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment