mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Stop using deprecated TestCase methods
This commit is contained in:
parent
9cf1b37b54
commit
9a11538b54
16 changed files with 52 additions and 52 deletions
|
@ -1829,7 +1829,7 @@ class SaltReturnAssertsMixIn(object):
|
|||
)
|
||||
|
||||
def assertInSaltReturnRegexpMatches(self, ret, pattern, keys=()):
|
||||
return self.assertRegexpMatches(
|
||||
return self.assertRegex(
|
||||
self.__getWithinSaltReturn(ret, keys), pattern
|
||||
)
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class VirtualboxTestCase(TestCase):
|
|||
self.fail(e.message)
|
||||
|
||||
def assertMachineDoesNotExist(self, name):
|
||||
self.assertRaisesRegexp(Exception, "Could not find a registered machine", self.vbox.findMachine, name)
|
||||
self.assertRaisesRegex(Exception, "Could not find a registered machine", self.vbox.findMachine, name)
|
||||
|
||||
|
||||
@skipIf(salt.utils.virtualbox.HAS_LIBS is False, 'salt-cloud requires virtualbox to be installed')
|
||||
|
|
|
@ -39,4 +39,4 @@ class BotoIAMTest(integration.ModuleCase):
|
|||
ret = self.run_function('boto_iam.get_account_id')
|
||||
# The AWS account ID is a 12-digit number.
|
||||
# http://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html
|
||||
self.assertRegexpMatches(ret, r'^\d{12}$')
|
||||
self.assertRegex(ret, r'^\d{12}$')
|
||||
|
|
|
@ -54,7 +54,7 @@ class LinuxAclModuleTest(integration.ModuleCase,
|
|||
super(LinuxAclModuleTest, self).tearDown()
|
||||
|
||||
def test_version(self):
|
||||
self.assertRegexpMatches(self.run_function('acl.version'), r'\d+\.\d+\.\d+')
|
||||
self.assertRegex(self.run_function('acl.version'), r'\d+\.\d+\.\d+')
|
||||
|
||||
def test_getfacl_w_single_file_without_acl(self):
|
||||
ret = self.run_function('acl.getfacl', arg=[self.myfile])
|
||||
|
|
|
@ -421,7 +421,7 @@ class PipModuleTest(integration.ModuleCase):
|
|||
try:
|
||||
self.assertEqual(ret['retcode'], 0)
|
||||
for package in ('Blinker', 'SaltTesting', 'pep8'):
|
||||
self.assertRegexpMatches(
|
||||
self.assertRegex(
|
||||
ret['stdout'],
|
||||
r'(?:.*)(Successfully installed)(?:.*)({0})(?:.*)'.format(package)
|
||||
)
|
||||
|
|
|
@ -213,7 +213,7 @@ class SaltReturnAssertsMixin(object):
|
|||
)
|
||||
|
||||
def assertInSaltReturnRegexpMatches(self, ret, pattern, keys=()):
|
||||
return self.assertRegexpMatches(
|
||||
return self.assertRegex(
|
||||
self.__getWithinSaltReturn(ret, keys), pattern
|
||||
)
|
||||
|
||||
|
|
|
@ -244,8 +244,8 @@ class BotoLambdaFunctionTestCase(BotoLambdaTestCaseBase, BotoLambdaTestCaseMixin
|
|||
tests Creating a function without code
|
||||
'''
|
||||
with patch.dict(boto_lambda.__salt__, {'boto_iam.get_account_id': MagicMock(return_value='1234')}):
|
||||
with self.assertRaisesRegexp(SaltInvocationError,
|
||||
'Either ZipFile must be specified, or S3Bucket and S3Key must be provided.'):
|
||||
with self.assertRaisesRegex(SaltInvocationError,
|
||||
'Either ZipFile must be specified, or S3Bucket and S3Key must be provided.'):
|
||||
lambda_creation_result = boto_lambda.create_function(
|
||||
FunctionName='testfunction',
|
||||
Runtime='python2.7',
|
||||
|
@ -258,8 +258,8 @@ class BotoLambdaFunctionTestCase(BotoLambdaTestCaseBase, BotoLambdaTestCaseMixin
|
|||
tests Creating a function without code
|
||||
'''
|
||||
with patch.dict(boto_lambda.__salt__, {'boto_iam.get_account_id': MagicMock(return_value='1234')}):
|
||||
with self.assertRaisesRegexp(SaltInvocationError,
|
||||
'Either ZipFile must be specified, or S3Bucket and S3Key must be provided.'):
|
||||
with self.assertRaisesRegex(SaltInvocationError,
|
||||
'Either ZipFile must be specified, or S3Bucket and S3Key must be provided.'):
|
||||
with TempZipFile() as zipfile:
|
||||
lambda_creation_result = boto_lambda.create_function(
|
||||
FunctionName='testfunction',
|
||||
|
@ -400,7 +400,7 @@ class BotoLambdaFunctionTestCase(BotoLambdaTestCaseBase, BotoLambdaTestCaseMixin
|
|||
tests Creating a function without code
|
||||
'''
|
||||
with patch.dict(boto_lambda.__salt__, {'boto_iam.get_account_id': MagicMock(return_value='1234')}):
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
SaltInvocationError,
|
||||
('Either ZipFile must be specified, or S3Bucket '
|
||||
'and S3Key must be provided.')):
|
||||
|
@ -713,7 +713,7 @@ class BotoLambdaEventSourceMappingTestCase(BotoLambdaTestCaseBase, BotoLambdaTes
|
|||
'''
|
||||
tests Deleting a mapping without identifier
|
||||
'''
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
SaltInvocationError,
|
||||
('Either UUID must be specified, or EventSourceArn '
|
||||
'and FunctionName must be provided.')):
|
||||
|
|
|
@ -370,9 +370,9 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
'''
|
||||
Tests checking vpc existence when no filters are provided
|
||||
'''
|
||||
with self.assertRaisesRegexp(SaltInvocationError, 'At least one of the following '
|
||||
'must be provided: vpc_id, vpc_name, '
|
||||
'cidr or tags.'):
|
||||
with self.assertRaisesRegex(SaltInvocationError, 'At least one of the following '
|
||||
'must be provided: vpc_id, vpc_name, '
|
||||
'cidr or tags.'):
|
||||
boto_vpc.exists(**conn_parameters)
|
||||
|
||||
@mock_ec2
|
||||
|
@ -447,7 +447,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
'''
|
||||
Tests getting vpc id but providing no filters
|
||||
'''
|
||||
with self.assertRaisesRegexp(SaltInvocationError, 'At least one of the following must be provided: vpc_id, vpc_name, cidr or tags.'):
|
||||
with self.assertRaisesRegex(SaltInvocationError, 'At least one of the following must be provided: vpc_id, vpc_name, cidr or tags.'):
|
||||
boto_vpc.get_id(**conn_parameters)
|
||||
|
||||
@mock_ec2
|
||||
|
@ -458,7 +458,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
vpc1 = self._create_vpc(name='vpc-test1')
|
||||
vpc2 = self._create_vpc(name='vpc-test2')
|
||||
|
||||
with self.assertRaisesRegexp(CommandExecutionError, 'Found more than one VPC matching the criteria.'):
|
||||
with self.assertRaisesRegex(CommandExecutionError, 'Found more than one VPC matching the criteria.'):
|
||||
boto_vpc.get_id(cidr=u'10.0.0.0/24', **conn_parameters)
|
||||
|
||||
@mock_ec2
|
||||
|
@ -575,7 +575,7 @@ class BotoVpcTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
'''
|
||||
Tests describing vpc without vpc id
|
||||
'''
|
||||
with self.assertRaisesRegexp(SaltInvocationError,
|
||||
with self.assertRaisesRegex(SaltInvocationError,
|
||||
'A valid vpc id or name needs to be specified.'):
|
||||
boto_vpc.describe(vpc_id=None, **conn_parameters)
|
||||
|
||||
|
@ -770,7 +770,7 @@ class BotoVpcSubnetsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
'''
|
||||
Tests checking subnet existence without any filters
|
||||
'''
|
||||
with self.assertRaisesRegexp(SaltInvocationError,
|
||||
with self.assertRaisesRegex(SaltInvocationError,
|
||||
'At least one of the following must be specified: '
|
||||
'subnet id, cidr, subnet_name, tags, or zones.'):
|
||||
boto_vpc.subnet_exists(**conn_parameters)
|
||||
|
@ -1195,7 +1195,7 @@ class BotoVpcDHCPOptionsTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
'''
|
||||
Tests checking dhcp option existence with no filters
|
||||
'''
|
||||
with self.assertRaisesRegexp(SaltInvocationError, 'At least one of the following must be provided: id, name, or tags.'):
|
||||
with self.assertRaisesRegex(SaltInvocationError, 'At least one of the following must be provided: id, name, or tags.'):
|
||||
boto_vpc.dhcp_options_exists(**conn_parameters)
|
||||
|
||||
|
||||
|
@ -1312,7 +1312,7 @@ class BotoVpcNetworkACLTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
'''
|
||||
Tests checking existence of network acl with no filters
|
||||
'''
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
SaltInvocationError,
|
||||
'At least one of the following must be provided: id, name, or tags.'
|
||||
):
|
||||
|
@ -1642,7 +1642,7 @@ class BotoVpcRouteTablesTestCase(BotoVpcTestCaseBase, BotoVpcTestCaseMixin):
|
|||
'''
|
||||
Tests checking route table without filters
|
||||
'''
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
SaltInvocationError,
|
||||
'At least one of the following must be provided: id, name, or tags.'
|
||||
):
|
||||
|
|
|
@ -86,7 +86,7 @@ class SystemdTestCase(TestCase, LoaderModuleMockMixin):
|
|||
'pid': 54321},
|
||||
])
|
||||
with patch.dict(systemd.__salt__, {'cmd.run_all': mock}):
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
CommandExecutionError,
|
||||
'Problem performing systemctl daemon-reload: Who knows why?',
|
||||
systemd.systemctl_reload
|
||||
|
|
|
@ -155,10 +155,10 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin):
|
|||
stdout_xml_snippet = '<?xml version="1.0"?><stream><message type="error">Booya!</message></stream>'
|
||||
sniffer = RunSniffer(stdout=stdout_xml_snippet, retcode=1)
|
||||
with patch.dict('salt.modules.zypper.__salt__', {'cmd.run_all': sniffer}):
|
||||
with self.assertRaisesRegexp(CommandExecutionError, '^Zypper command failure: Booya!$'):
|
||||
with self.assertRaisesRegex(CommandExecutionError, '^Zypper command failure: Booya!$'):
|
||||
zypper.__zypper__.xml.call('crashme')
|
||||
|
||||
with self.assertRaisesRegexp(CommandExecutionError, "^Zypper command failure: Check Zypper's logs.$"):
|
||||
with self.assertRaisesRegex(CommandExecutionError, "^Zypper command failure: Check Zypper's logs.$"):
|
||||
zypper.__zypper__.call('crashme again')
|
||||
|
||||
zypper.__zypper__.noraise.call('stay quiet')
|
||||
|
@ -182,7 +182,7 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin):
|
|||
'retcode': 1,
|
||||
}
|
||||
with patch.dict('salt.modules.zypper.__salt__', {'cmd.run_all': MagicMock(return_value=ref_out)}):
|
||||
with self.assertRaisesRegexp(CommandExecutionError,
|
||||
with self.assertRaisesRegex(CommandExecutionError,
|
||||
"^Zypper command failure: Some handled zypper internal error\nAnother zypper internal error$"):
|
||||
zypper.list_upgrades(refresh=False)
|
||||
|
||||
|
@ -193,7 +193,7 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin):
|
|||
'stderr': ''
|
||||
}
|
||||
with patch.dict('salt.modules.zypper.__salt__', {'cmd.run_all': MagicMock(return_value=ref_out)}):
|
||||
with self.assertRaisesRegexp(CommandExecutionError, "^Zypper command failure: Check Zypper's logs.$"):
|
||||
with self.assertRaisesRegex(CommandExecutionError, "^Zypper command failure: Check Zypper's logs.$"):
|
||||
zypper.list_upgrades(refresh=False)
|
||||
|
||||
def test_list_products(self):
|
||||
|
|
|
@ -228,7 +228,7 @@ class TestGetTemplate(TestCase):
|
|||
fc = MockFileClient()
|
||||
with patch.object(SaltCacheLoader, 'file_client', MagicMock(return_value=fc)):
|
||||
with salt.utils.fopen(filename) as fp_:
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
@ -252,7 +252,7 @@ class TestGetTemplate(TestCase):
|
|||
fc = MockFileClient()
|
||||
with patch.object(SaltCacheLoader, 'file_client', MagicMock(return_value=fc)):
|
||||
with salt.utils.fopen(filename) as fp_:
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
@ -276,7 +276,7 @@ class TestGetTemplate(TestCase):
|
|||
fc = MockFileClient()
|
||||
with patch.object(SaltCacheLoader, 'file_client', MagicMock(return_value=fc)):
|
||||
with salt.utils.fopen(filename) as fp_:
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
@ -376,7 +376,7 @@ class TestGetTemplate(TestCase):
|
|||
def test_render_with_syntax_error(self):
|
||||
template = 'hello\n\n{{ bad\n\nfoo'
|
||||
expected = r'.*---\nhello\n\n{{ bad\n\nfoo <======================\n---'
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
@ -390,7 +390,7 @@ class TestGetTemplate(TestCase):
|
|||
with patch.object(builtins, '__salt_system_encoding__', 'utf-8'):
|
||||
template = u'hello\n\n{{ bad\n\nfoo\ud55c'
|
||||
expected = r'.*---\nhello\n\n{{ bad\n\nfoo\xed\x95\x9c <======================\n---'
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
@ -403,7 +403,7 @@ class TestGetTemplate(TestCase):
|
|||
with patch.object(builtins, '__salt_system_encoding__', 'utf-8'):
|
||||
template = 'hello\n\n{{ bad\n\nfoo\xed\x95\x9c'
|
||||
expected = r'.*---\nhello\n\n{{ bad\n\nfoo\xed\x95\x9c <======================\n---'
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
@ -414,7 +414,7 @@ class TestGetTemplate(TestCase):
|
|||
def test_render_with_undefined_variable(self):
|
||||
template = "hello\n\n{{ foo }}\n\nfoo"
|
||||
expected = r'Jinja variable \'foo\' is undefined'
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
@ -425,7 +425,7 @@ class TestGetTemplate(TestCase):
|
|||
def test_render_with_undefined_variable_utf8(self):
|
||||
template = "hello\xed\x95\x9c\n\n{{ foo }}\n\nfoo"
|
||||
expected = r'Jinja variable \'foo\' is undefined'
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
@ -436,7 +436,7 @@ class TestGetTemplate(TestCase):
|
|||
def test_render_with_undefined_variable_unicode(self):
|
||||
template = u"hello\ud55c\n\n{{ foo }}\n\nfoo"
|
||||
expected = r'Jinja variable \'foo\' is undefined'
|
||||
self.assertRaisesRegexp(
|
||||
self.assertRaisesRegex(
|
||||
SaltRenderError,
|
||||
expected,
|
||||
render_jinja_tmpl,
|
||||
|
|
|
@ -232,14 +232,14 @@ class PyDSLRendererTestCase(CommonTestCaseBoilerplate):
|
|||
self.assertEqual(ret['changes']['stdout'], 'this is state G')
|
||||
|
||||
def test_multiple_state_func_in_state_mod(self):
|
||||
with self.assertRaisesRegexp(PyDslError, 'Multiple state functions'):
|
||||
with self.assertRaisesRegex(PyDslError, 'Multiple state functions'):
|
||||
self.render_sls(textwrap.dedent('''
|
||||
state('A').cmd.run('echo hoho')
|
||||
state('A').cmd.wait('echo hehe')
|
||||
'''))
|
||||
|
||||
def test_no_state_func_in_state_mod(self):
|
||||
with self.assertRaisesRegexp(PyDslError, 'No state function specified'):
|
||||
with self.assertRaisesRegex(PyDslError, 'No state function specified'):
|
||||
self.render_sls(textwrap.dedent('''
|
||||
state('B').cmd.require(cmd='hoho')
|
||||
'''))
|
||||
|
|
|
@ -1797,13 +1797,13 @@ class DockerTranslateHelperTestCase(TestCase):
|
|||
# Passing a port range
|
||||
self.assertEqual(translate_funcs._get_port_range('2222-2223'), (2222, 2223))
|
||||
# Error case: port range start is greater than end
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
ValueError,
|
||||
r'Start of port range \(2222\) cannot be greater than end of '
|
||||
r'port range \(2221\)'):
|
||||
translate_funcs._get_port_range('2222-2221')
|
||||
# Error case: non-numeric input
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
ValueError,
|
||||
'\'2222-bar\' is non-numeric or an invalid port range'):
|
||||
translate_funcs._get_port_range('2222-bar')
|
||||
|
|
|
@ -45,12 +45,12 @@ class TestFormatCall(TestCase):
|
|||
def foo2(one, two, three=3):
|
||||
pass
|
||||
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
SaltInvocationError,
|
||||
r'foo takes at least 1 argument \(0 given\)'):
|
||||
format_call(foo, dict(two=3))
|
||||
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
TypeError,
|
||||
r'foo2 takes at least 2 arguments \(1 given\)'):
|
||||
format_call(foo2, dict(one=1))
|
||||
|
|
|
@ -65,7 +65,7 @@ class WarnUntilTestCase(TestCase):
|
|||
self.assertEqual(0, len(recorded_warnings))
|
||||
|
||||
# Let's set version info to (0, 17), a RuntimeError should be raised
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
r'The warning triggered on filename \'(.*)test_warnings.py\', '
|
||||
r'line number ([\d]+), is supposed to be shown until version '
|
||||
|
@ -74,7 +74,7 @@ class WarnUntilTestCase(TestCase):
|
|||
raise_warning(_version_info_=(0, 17, 0))
|
||||
|
||||
# Let's set version info to (0, 17), a RuntimeError should be raised
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
r'The warning triggered on filename \'(.*)test_warnings.py\', '
|
||||
r'line number ([\d]+), is supposed to be shown until version '
|
||||
|
@ -84,7 +84,7 @@ class WarnUntilTestCase(TestCase):
|
|||
|
||||
# Even though we're calling warn_until, we pass _dont_call_warnings
|
||||
# because we're only after the RuntimeError
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
r'The warning triggered on filename \'(.*)test_warnings.py\', '
|
||||
r'line number ([\d]+), is supposed to be shown until version '
|
||||
|
@ -94,7 +94,7 @@ class WarnUntilTestCase(TestCase):
|
|||
(0, 17), 'Foo', _dont_call_warnings=True
|
||||
)
|
||||
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
r'The warning triggered on filename \'(.*)test_warnings.py\', '
|
||||
r'line number ([\d]+), is supposed to be shown until version '
|
||||
|
@ -148,7 +148,7 @@ class WarnUntilTestCase(TestCase):
|
|||
|
||||
# Let's set version info to (0, 17), a RuntimeError should be raised
|
||||
# regardless of whether or not we pass any **kwargs.
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
r'The warning triggered on filename \'(.*)test_warnings.py\', '
|
||||
r'line number ([\d]+), is supposed to be shown until version '
|
||||
|
@ -156,7 +156,7 @@ class WarnUntilTestCase(TestCase):
|
|||
r'Please remove the warning.'):
|
||||
raise_warning(_version_info_=(0, 17)) # no kwargs
|
||||
|
||||
with self.assertRaisesRegexp(
|
||||
with self.assertRaisesRegex(
|
||||
RuntimeError,
|
||||
r'The warning triggered on filename \'(.*)test_warnings.py\', '
|
||||
r'line number ([\d]+), is supposed to be shown until version '
|
||||
|
|
|
@ -79,7 +79,7 @@ class BaseTestCase(TestCase):
|
|||
"""
|
||||
if args:
|
||||
details = details % args
|
||||
cm = self.assertRaisesRegexp(exc_type, details)
|
||||
cm = self.assertRaisesRegex(exc_type, details)
|
||||
with cm as exc:
|
||||
yield exc
|
||||
|
||||
|
@ -721,21 +721,21 @@ class IpaddrUnitTest(TestCase):
|
|||
class Broken(ipaddress._BaseAddress):
|
||||
pass
|
||||
broken = Broken('127.0.0.1')
|
||||
with self.assertRaisesRegexp(NotImplementedError, "Broken.*version"):
|
||||
with self.assertRaisesRegex(NotImplementedError, "Broken.*version"):
|
||||
broken.version
|
||||
|
||||
def testMissingNetworkVersion(self):
|
||||
class Broken(ipaddress._BaseNetwork):
|
||||
pass
|
||||
broken = Broken('127.0.0.1')
|
||||
with self.assertRaisesRegexp(NotImplementedError, "Broken.*version"):
|
||||
with self.assertRaisesRegex(NotImplementedError, "Broken.*version"):
|
||||
broken.version
|
||||
|
||||
def testMissingAddressClass(self):
|
||||
class Broken(ipaddress._BaseNetwork):
|
||||
pass
|
||||
broken = Broken('127.0.0.1')
|
||||
with self.assertRaisesRegexp(NotImplementedError, "Broken.*address"):
|
||||
with self.assertRaisesRegex(NotImplementedError, "Broken.*address"):
|
||||
broken._address_class
|
||||
|
||||
def testGetNetwork(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue