|
5 | 5 |
|
6 | 6 | from cassandra.query import bind_params, ValueSequence |
7 | 7 | from cassandra.query import PreparedStatement, BoundStatement |
8 | | -from cassandra.query import InvalidParameterTypeError |
9 | 8 | from cassandra.cqltypes import Int32Type |
10 | 9 |
|
11 | 10 | try: |
@@ -77,31 +76,22 @@ def test_invalid_argument_type(self): |
77 | 76 |
|
78 | 77 | values = ['nonint', 1] |
79 | 78 |
|
80 | | - try: |
81 | | - bound_statement.bind(values) |
82 | | - except InvalidParameterTypeError as e: |
83 | | - self.assertEqual(e.col_name, 'foo1') |
84 | | - self.assertEqual(e.expected_type, Int32Type) |
85 | | - self.assertEqual(e.actual_type, str) |
86 | | - else: |
87 | | - self.fail('Passed invalid type but exception was not thrown') |
88 | | - |
89 | 79 | try: |
90 | 80 | bound_statement.bind(values) |
91 | 81 | except TypeError as e: |
92 | | - self.assertEqual(e.col_name, 'foo1') |
93 | | - self.assertEqual(e.expected_type, Int32Type) |
94 | | - self.assertEqual(e.actual_type, str) |
| 82 | + self.assertIn('foo1', str(e)) |
| 83 | + self.assertIn('Int32Type', str(e)) |
| 84 | + self.assertIn('str', str(e)) |
95 | 85 | else: |
96 | 86 | self.fail('Passed invalid type but exception was not thrown') |
97 | 87 |
|
98 | 88 | values = [1, ['1', '2']] |
99 | 89 |
|
100 | 90 | try: |
101 | 91 | bound_statement.bind(values) |
102 | | - except InvalidParameterTypeError as e: |
103 | | - self.assertEqual(e.col_name, 'foo2') |
104 | | - self.assertEqual(e.expected_type, Int32Type) |
105 | | - self.assertEqual(e.actual_type, list) |
| 92 | + except TypeError as e: |
| 93 | + self.assertIn('foo2', str(e)) |
| 94 | + self.assertIn('Int32Type', str(e)) |
| 95 | + self.assertIn('list', str(e)) |
106 | 96 | else: |
107 | 97 | self.fail('Passed invalid type but exception was not thrown') |
0 commit comments