From: zooko Date: Mon, 15 Jun 2009 22:19:45 +0000 (+0530) Subject: tests: cleaner tests by writing "self.fail(why)" instead of "raise why" X-Git-Url: https://git.rkrishnan.org/pf/content/en/seg/biz/about.html?a=commitdiff_plain;h=25e44559b51c63994649b3d2214f0fed43591937;p=tahoe-lafs%2Fzfec.git tests: cleaner tests by writing "self.fail(why)" instead of "raise why" Ignore-this: 2e798985cb73984938e24b403e78c73c darcs-hash:90cfc7d1ae8f1684a4f2b635006574ee9ebda76e --- diff --git a/zfec/zfec/test/test_zfec.py b/zfec/zfec/test/test_zfec.py index 5fd9173..5b40d0a 100755 --- a/zfec/zfec/test/test_zfec.py +++ b/zfec/zfec/test/test_zfec.py @@ -155,21 +155,21 @@ class ZFecTest(unittest.TestCase): except TypeError, e: assert "First argument was not a sequence" in str(e), e else: - raise "Should have gotten TypeError for wrong type of second argument." + self.fail("Should have gotten TypeError for wrong type of second argument.") try: decer.decode(["a", "b", ], ["c", "d",]) except zfec.Error, e: assert "Precondition violation: second argument is required to contain int" in str(e), e else: - raise "Should have gotten zfec.Error for wrong type of second argument." + self.fail("Should have gotten zfec.Error for wrong type of second argument.") try: decer.decode(["a", "b", ], 98) # not a sequence at all except TypeError, e: assert "Second argument was not a sequence" in str(e), e else: - raise "Should have gotten TypeError for wrong type of second argument." + self.fail("Should have gotten TypeError for wrong type of second argument.") class EasyFecTest(unittest.TestCase): def test_small(self): @@ -192,21 +192,21 @@ class EasyFecTest(unittest.TestCase): except TypeError, e: assert "First argument was not a sequence" in str(e), e else: - raise "Should have gotten TypeError for wrong type of second argument." + self.fail("Should have gotten TypeError for wrong type of second argument.") try: decer.decode("ab", ["c", "d",], 0) except zfec.Error, e: assert "Precondition violation: second argument is required to contain int" in str(e), e else: - raise "Should have gotten zfec.Error for wrong type of second argument." + self.fail("Should have gotten zfec.Error for wrong type of second argument.") try: decer.decode("ab", 98, 0) # not a sequence at all except TypeError, e: assert "Second argument was not a sequence" in str(e), e else: - raise "Should have gotten TypeError for wrong type of second argument." + self.fail("Should have gotten TypeError for wrong type of second argument.") class FileFec(unittest.TestCase): def test_filefec_header(self):