Replace deprecated assertRaisesRegexp

The assertRaisesRegexp method has been deprecated since it was renamed
to assertRaisesRegex in Python 3.2.

https://docs.python.org/3/library/unittest.html#deprecated-aliases

Change-Id: I4d19f3e0314f912e83d931bf061d0eacb13987f4
This commit is contained in:
l Luis 2021-11-10 17:06:37 +08:00 committed by likui
parent 0ea8f1b05d
commit db84950f55
1 changed files with 4 additions and 4 deletions

View File

@ -55,22 +55,22 @@ class TestAllocation(base.BaseTestCase):
def test_fail_if_incorrect_format(self):
allocations = ['incorrect_format']
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
'Incorrect allocation',
allocation.parse_allocations, allocations)
allocations = ['=,']
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
'2 is required',
allocation.parse_allocations, allocations)
allocations = ['abc=155']
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
'Incorrect allocation',
allocation.parse_allocations, allocations)
allocations = ['abc=155,xyz=999']
self.assertRaisesRegexp(
self.assertRaisesRegex(
ValueError,
'parameter is required',
allocation.parse_allocations, allocations)