Skip to content

Instantly share code, notes, and snippets.

@justinabrahms
Created August 24, 2010 02:56
Show Gist options
  • Save justinabrahms/546834 to your computer and use it in GitHub Desktop.
Save justinabrahms/546834 to your computer and use it in GitHub Desktop.
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