Skip to content

Instantly share code, notes, and snippets.

@briancurtin
Created November 22, 2014 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briancurtin/832e59d079c19b978058 to your computer and use it in GitHub Desktop.
Save briancurtin/832e59d079c19b978058 to your computer and use it in GitHub Desktop.
diff --git a/openstack/tests/test_resource.py b/openstack/tests/test_resource.py
index 74d797b..78df0ac 100644
--- a/openstack/tests/test_resource.py
+++ b/openstack/tests/test_resource.py
@@ -88,12 +88,8 @@ class PropTests(base.TestCase):
t = Test()
- try:
- t.attr = "this is not an int"
- except ValueError:
- pass
- else:
- self.fail("Failed to raise ValueErrorwhen given bad value")
+ self.assertRaises(ValueError, setattr, t, "attr",
+ "this is not an int")
def test_set_TypeError(self):
class Type(object):
@@ -105,12 +101,8 @@ class PropTests(base.TestCase):
t = Test()
- try:
- t.attr = "this type takes no args"
- except TypeError:
- pass
- else:
- self.fail("Failed to raise TypeError when given bad type")
+ self.assertRaises(TypeError, setattr, t, "attr",
+ "this type takes no args")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment