From 25e44559b51c63994649b3d2214f0fed43591937 Mon Sep 17 00:00:00 2001 From: zooko <zooko@zooko.com> Date: Tue, 16 Jun 2009 03:49:45 +0530 Subject: [PATCH] tests: cleaner tests by writing "self.fail(why)" instead of "raise why" Ignore-this: 2e798985cb73984938e24b403e78c73c darcs-hash:90cfc7d1ae8f1684a4f2b635006574ee9ebda76e --- zfec/zfec/test/test_zfec.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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): -- 2.45.2