From 2d300490f74492f39be660979b5b1ccdbd59a7e4 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 17 Mar 2013 17:47:28 -0700 Subject: gras: tweaks to the python unit test --- tests/block_props_test.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'tests/block_props_test.py') diff --git a/tests/block_props_test.py b/tests/block_props_test.py index 6c502a3..9458860 100644 --- a/tests/block_props_test.py +++ b/tests/block_props_test.py @@ -16,6 +16,8 @@ class MyBlock(gras.Block): return self.foo def set_foo(self, new_foo): + print "new_foo", new_foo + new_foo + 0 #throws if its not a number self.foo = new_foo class BlockPropsTest(unittest.TestCase): @@ -36,18 +38,14 @@ class BlockPropsTest(unittest.TestCase): #property does not exist threw = False try: my_block.get("bar") - except Exception as ex: - print ex - threw = True - self.assertFalse(threw) + except: threw = True + self.assertTrue(threw) #wrong type for property threw = False - try: my_block.set("foo", float(42)) - except Exception as ex: - print ex - threw = True - self.assertFalse(threw) + try: my_block.set("foo", None) + except: threw = True + self.assertTrue(threw) if __name__ == '__main__': unittest.main() -- cgit