Created
August 24, 2010 02:56
-
-
Save justinabrahms/546834 to your computer and use it in GitHub Desktop.
This file contains 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
class TestRound(object): | |
def _check_rounding(self, test, expected): | |
assert round(test) == expected | |
def test_rounding(self): | |
for x, y in [(1, 1), | |
(1.9, 2)]: | |
yield self._check_rounding, x, y | |
# VERSUS | |
class TestRound(unittest.TestCase): | |
def test_rounding_same(self): | |
self.assertEquals(round(1), 1) | |
def test_rounding_one_dot_nine_to_two(self): | |
self.assertEquals(round(1.9), 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment