def test_serialize_type_check(self): """Test that `serialize` will include full port namespace in exception message.""" base_namespace = 'base' nested_namespace = 'some.nested.namespace' port_namespace = PortNamespace(base_namespace) port_namespace.create_port_namespace(nested_namespace) with self.assertRaisesRegex( TypeError, f'.*{base_namespace}.*{nested_namespace}.*'): port_namespace.serialize( {'some': { 'nested': { 'namespace': Dict() } }})
def test_serialize_type_check(self): """Test that `serialize` will include full port namespace in exception message.""" base_namespace = 'base' nested_namespace = 'some.nested.namespace' port_namespace = PortNamespace(base_namespace) port_namespace.create_port_namespace(nested_namespace) # pylint: disable=deprecated-method # The `assertRaisesRegexp` method is deprecated in python 3 but assertRaisesRegex` does not exist in python 2 with self.assertRaisesRegexp( TypeError, '.*{}.*{}.*'.format(base_namespace, nested_namespace)): port_namespace.serialize( {'some': { 'nested': { 'namespace': {Dict()} } }})