summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-08-26 12:30:33 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2013-08-26 12:30:33 -0400
commit99732dd29bd69a4a3808bfaa86c8e378d7a5e28b (patch)
treee463b1cc57deb230c9918806baf4f2bec8a9fa0f /test
parent938a8eb4039ba02056a07a49791ce3453ed446fa (diff)
downloadsqlalchemy-99732dd29bd69a4a3808bfaa86c8e378d7a5e28b.tar.gz
correct for missing fail() methods which were lost when we removed unittest.TestCase
Diffstat (limited to 'test')
-rw-r--r--test/ext/test_associationproxy.py45
1 files changed, 20 insertions, 25 deletions
diff --git a/test/ext/test_associationproxy.py b/test/ext/test_associationproxy.py
index b1018b50d..d46b08f6d 100644
--- a/test/ext/test_associationproxy.py
+++ b/test/ext/test_associationproxy.py
@@ -422,11 +422,10 @@ class SetTest(_CollectionOperations):
self.assert_(p1.children == set(['a', 'b', 'c']))
- try:
- p1.children.remove('d')
- self.fail()
- except KeyError:
- pass
+ assert_raises(
+ KeyError,
+ p1.children.remove, "d"
+ )
self.assert_(len(p1.children) == 3)
p1.children.discard('d')
@@ -598,12 +597,11 @@ class CustomObjectTest(_CollectionOperations):
# We didn't provide an alternate _AssociationList implementation
# for our ObjectCollection, so indexing will fail.
+ assert_raises(
+ TypeError,
+ p.children.__getitem__, 1
+ )
- try:
- v = p.children[1]
- self.fail()
- except TypeError:
- pass
class ProxyFactoryTest(ListTest):
def setup(self):
@@ -718,11 +716,10 @@ class ScalarTest(fixtures.TestBase):
p = Parent('p')
# No child
- try:
- v = p.foo
- self.fail()
- except:
- pass
+ assert_raises(
+ AttributeError,
+ getattr, p, "foo"
+ )
p.child = Child(foo='a', bar='b', baz='c')
@@ -744,18 +741,16 @@ class ScalarTest(fixtures.TestBase):
p.child = None
# No child again
- try:
- v = p.foo
- self.fail()
- except:
- pass
+ assert_raises(
+ AttributeError,
+ getattr, p, "foo"
+ )
# Bogus creator for this scalar type
- try:
- p.foo = 'zzz'
- self.fail()
- except TypeError:
- pass
+ assert_raises(
+ TypeError,
+ setattr, p, "foo", "zzz"
+ )
p.bar = 'yyy'