Fix tests under Python 2.6
assertRaises is not a context manager under Py 2.6
This commit is contained in:
parent
2eea58a64c
commit
0de0f0f95a
@ -70,8 +70,7 @@ class DatabaseTestCase(unittest.TestCase):
|
||||
table.insert({'int_id': 124})
|
||||
assert table.find_one(int_id = 123)['int_id'] == 123
|
||||
assert table.find_one(int_id = 124)['int_id'] == 124
|
||||
with self.assertRaises(IntegrityError):
|
||||
table.insert({'int_id': 123})
|
||||
self.assertRaises(IntegrityError, lambda: table.insert({'int_id': 123}))
|
||||
|
||||
def test_create_table_shorthand1(self):
|
||||
pid = "int_id"
|
||||
@ -84,8 +83,7 @@ class DatabaseTestCase(unittest.TestCase):
|
||||
table.insert({'int_id': 124})
|
||||
assert table.find_one(int_id = 123)['int_id'] == 123
|
||||
assert table.find_one(int_id = 124)['int_id'] == 124
|
||||
with self.assertRaises(IntegrityError):
|
||||
table.insert({'int_id': 123})
|
||||
self.assertRaises(IntegrityError, lambda: table.insert({'int_id': 123}))
|
||||
|
||||
def test_create_table_shorthand2(self):
|
||||
pid = "string_id"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user