Skip to content

Commit 772bb00

Browse files
test: replace deprecated methods
assertRaisesRegexp and assertEquals were renamed in version 3.2 [1]. 1. https://docs.python.org/3/library/unittest.html#deprecated-aliases Part of #250
1 parent a400294 commit 772bb00

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

test/suites/test_dml.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def test_03_delete(self):
124124
self.assertSequenceEqual(self.con.delete('space_1', [20]), [])
125125
self.assertSequenceEqual(self.con.select('space_1', [20], index='primary'), [])
126126
# Check that <index_id> field has no meaning, yet.
127-
with self.assertRaisesRegexp(tarantool.DatabaseError,
127+
with self.assertRaisesRegex(tarantool.DatabaseError,
128128
'(19, .*)'):
129129
self.con.delete('space_1', [1, 'tuple_21'])
130130
self.assertSequenceEqual(self.con.select('space_1', [21], index='primary'), [[21, 1, 'tuple_21']])
@@ -134,7 +134,7 @@ def test_04_replace(self):
134134
self.assertSequenceEqual(self.con.replace('space_1', [2, 2, 'tuple_3']), [[2, 2, 'tuple_3']])
135135
self.assertSequenceEqual(self.con.select('space_1', 2), [[2, 2, 'tuple_3']])
136136
# Check replace that isn't Ok.
137-
with self.assertRaisesRegexp(tarantool.DatabaseError,
137+
with self.assertRaisesRegex(tarantool.DatabaseError,
138138
'(39, .*)'):
139139
self.assertSequenceEqual(self.con.replace('space_1', [2, 2]), [[2, 2, 'tuple_2']])
140140

@@ -168,9 +168,9 @@ def test_07_call_16(self):
168168
self.assertSequenceEqual(con.call('json.decode', '[123, 234, 345]'), [[123, 234, 345]])
169169
self.assertSequenceEqual(con.call('json.decode', ['[123, 234, 345]']), [[123, 234, 345]])
170170
self.assertSequenceEqual(con.call('json.decode', ('[123, 234, 345]',)), [[123, 234, 345]])
171-
with self.assertRaisesRegexp(tarantool.DatabaseError, '(32, .*)'):
171+
with self.assertRaisesRegex(tarantool.DatabaseError, '(32, .*)'):
172172
con.call('json.decode')
173-
with self.assertRaisesRegexp(tarantool.DatabaseError, '(32, .*)'):
173+
with self.assertRaisesRegex(tarantool.DatabaseError, '(32, .*)'):
174174
con.call('json.decode', '{[1, 2]: "world"}')
175175
ans = con.call('fiber.time')
176176
self.assertEqual(len(ans), 1)
@@ -194,9 +194,9 @@ def test_07_call_17(self):
194194
self.assertSequenceEqual(con.call('json.decode', '[123, 234, 345]'), [[123, 234, 345]])
195195
self.assertSequenceEqual(con.call('json.decode', ['[123, 234, 345]']), [[123, 234, 345]])
196196
self.assertSequenceEqual(con.call('json.decode', ('[123, 234, 345]',)), [[123, 234, 345]])
197-
with self.assertRaisesRegexp(tarantool.DatabaseError, '(32, .*)'):
197+
with self.assertRaisesRegex(tarantool.DatabaseError, '(32, .*)'):
198198
con.call('json.decode')
199-
with self.assertRaisesRegexp(tarantool.DatabaseError, '(32, .*)'):
199+
with self.assertRaisesRegex(tarantool.DatabaseError, '(32, .*)'):
200200
con.call('json.decode', '{[1, 2]: "world"}')
201201
ans = con.call('fiber.time')
202202
self.assertEqual(len(ans), 1)

test/suites/test_pool.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,11 @@ def test_16_is_closed(self):
520520
user='test',
521521
password='test',)
522522

523-
self.assertEquals(self.pool.is_closed(), False)
523+
self.assertEqual(self.pool.is_closed(), False)
524524

525525
self.pool.close()
526526

527-
self.assertEquals(self.pool.is_closed(), True)
527+
self.assertEqual(self.pool.is_closed(), True)
528528

529529
def tearDown(self):
530530
if hasattr(self, 'pool'):

test/suites/test_schema.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -104,30 +104,30 @@ def test_00_authenticate(self):
104104
self.assertEqual(self.con.authenticate('test', 'test')._data, None)
105105

106106
def test_01_space_bad(self):
107-
with self.assertRaisesRegexp(tarantool.SchemaError,
107+
with self.assertRaisesRegex(tarantool.SchemaError,
108108
'There\'s no space.*'):
109109
self.sch.get_space(0)
110-
with self.assertRaisesRegexp(tarantool.SchemaError,
110+
with self.assertRaisesRegex(tarantool.SchemaError,
111111
'There\'s no space.*'):
112112
self.sch.get_space(0)
113-
with self.assertRaisesRegexp(tarantool.SchemaError,
113+
with self.assertRaisesRegex(tarantool.SchemaError,
114114
'There\'s no space.*'):
115115
self.sch.get_space('bad_name')
116116

117117
def test_02_index_bad(self):
118-
with self.assertRaisesRegexp(tarantool.SchemaError,
118+
with self.assertRaisesRegex(tarantool.SchemaError,
119119
'There\'s no space.*'):
120120
self.sch.get_index(0, 'primary')
121-
with self.assertRaisesRegexp(tarantool.SchemaError,
121+
with self.assertRaisesRegex(tarantool.SchemaError,
122122
'There\'s no space.*'):
123123
self.sch.get_index('bad_space', 'primary')
124-
with self.assertRaisesRegexp(tarantool.SchemaError,
124+
with self.assertRaisesRegex(tarantool.SchemaError,
125125
'There\'s no index.*'):
126126
self.sch.get_index(280, 'bad_index')
127-
with self.assertRaisesRegexp(tarantool.SchemaError,
127+
with self.assertRaisesRegex(tarantool.SchemaError,
128128
'There\'s no index.*'):
129129
self.sch.get_index(280, 'bad_index')
130-
with self.assertRaisesRegexp(tarantool.SchemaError,
130+
with self.assertRaisesRegex(tarantool.SchemaError,
131131
'There\'s no index.*'):
132132
self.sch.get_index(280, 3)
133133

0 commit comments

Comments
 (0)