Last active
August 29, 2015 13:56
-
-
Save blaix/8790733 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test_returns_2_when_x_is_1_and_y_is_1(self): | |
self.assertEqual(2, sum(1, 2)) | |
def test_returns_1_when_x_is_2_and_y_is_neg1(self): | |
self.assertEqual(1, sum(2, -1)) | |
# etc.... | |
# versus: | |
def test_adds_two_integers(self): | |
self.assertEqual(2, sum(1, 2)) | |
self.assertEqual(1, sum(2, -1)) | |
# etc... | |
# you may have heard "only assert one thing" | |
# that doesn't always mean only have one literal assertion call in your test | |
# it means only have one logical assertion | |
# i.e. test the smallest unit of logic that matters | |
# that sometimes requires multiple assert calls for very low-level functions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment