Merge "remove unicode from code"

This commit is contained in:
Zuul 2022-01-04 09:38:50 +00:00 committed by Gerrit Code Review
commit 7cbec53543
11 changed files with 52 additions and 52 deletions

View File

@ -92,8 +92,8 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Neutron' project = 'Neutron'
copyright = u'2011-present, OpenStack Foundation.' copyright = '2011-present, OpenStack Foundation.'
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.
@ -216,8 +216,8 @@ htmlhelp_basename = 'neutrondoc'
# (source start file, target name, title, author, # (source start file, target name, title, author,
# documentclass [howto/manual]). # documentclass [howto/manual]).
latex_documents = [ latex_documents = [
('pdf-index', 'doc-neutron.tex', u'Neutron Documentation', ('pdf-index', 'doc-neutron.tex', 'Neutron Documentation',
u'Neutron development team', 'manual'), 'Neutron development team', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of

View File

@ -33,11 +33,11 @@ from neutron.tests import base
class FdbPopulationExtensionTestCase(base.BaseTestCase): class FdbPopulationExtensionTestCase(base.BaseTestCase):
UPDATE_MSG = {u'device_owner': constants.DEVICE_OWNER_ROUTER_INTF, UPDATE_MSG = {'device_owner': constants.DEVICE_OWNER_ROUTER_INTF,
u'physical_network': u'physnet1', 'physical_network': 'physnet1',
u'mac_address': u'fa:16:3e:ba:bc:21', 'mac_address': 'fa:16:3e:ba:bc:21',
u'port_id': u'17ceda02-43e1-48d8-beb6-35885b20cae6'} 'port_id': '17ceda02-43e1-48d8-beb6-35885b20cae6'}
DELETE_MSG = {u'port_id': u'17ceda02-43e1-48d8-beb6-35885b20cae6'} DELETE_MSG = {'port_id': '17ceda02-43e1-48d8-beb6-35885b20cae6'}
def setUp(self): def setUp(self):
super(FdbPopulationExtensionTestCase, self).setUp() super(FdbPopulationExtensionTestCase, self).setUp()

View File

@ -491,7 +491,7 @@ class SGServerRpcCallBackTestCase(test_sg.SecurityGroupDBTestCase):
'security_group_id': sg2_id}, 'security_group_id': sg2_id},
{'direction': 'egress', 'ethertype': const.IPv6, {'direction': 'egress', 'ethertype': const.IPv6,
'security_group_id': sg2_id}, 'security_group_id': sg2_id},
{'direction': u'ingress', {'direction': 'ingress',
'source_ip_prefix': port_fixed_ip2 + '/32', 'source_ip_prefix': port_fixed_ip2 + '/32',
'protocol': const.PROTO_NAME_TCP, 'protocol': const.PROTO_NAME_TCP,
'ethertype': const.IPv4, 'ethertype': const.IPv4,
@ -553,13 +553,13 @@ class SGServerRpcCallBackTestCase(test_sg.SecurityGroupDBTestCase):
'stateful': True}, 'stateful': True},
{'direction': 'egress', 'ethertype': const.IPv6, {'direction': 'egress', 'ethertype': const.IPv6,
'stateful': True}, 'stateful': True},
{'direction': u'ingress', {'direction': 'ingress',
'protocol': const.PROTO_NAME_TCP, 'protocol': const.PROTO_NAME_TCP,
'ethertype': const.IPv4, 'ethertype': const.IPv4,
'port_range_max': 25, 'port_range_min': 24, 'port_range_max': 25, 'port_range_min': 24,
'remote_group_id': sg2_id, 'remote_group_id': sg2_id,
'stateful': True}, 'stateful': True},
{'direction': u'ingress', {'direction': 'ingress',
'protocol': const.PROTO_NAME_TCP, 'protocol': const.PROTO_NAME_TCP,
'ethertype': const.IPv4, 'ethertype': const.IPv4,
'port_range_max': 27, 'port_range_min': 26, 'port_range_max': 27, 'port_range_min': 26,
@ -694,13 +694,13 @@ class SGServerRpcCallBackTestCase(test_sg.SecurityGroupDBTestCase):
'stateful': True}, 'stateful': True},
{'direction': 'egress', 'ethertype': const.IPv6, {'direction': 'egress', 'ethertype': const.IPv6,
'stateful': True}, 'stateful': True},
{'direction': u'ingress', {'direction': 'ingress',
'protocol': const.PROTO_NAME_TCP, 'protocol': const.PROTO_NAME_TCP,
'ethertype': const.IPv6, 'ethertype': const.IPv6,
'port_range_max': 22, 'port_range_min': 22, 'port_range_max': 22, 'port_range_min': 22,
'remote_group_id': sg1_id, 'remote_group_id': sg1_id,
'stateful': True}, 'stateful': True},
{'direction': u'ingress', {'direction': 'ingress',
'protocol': const.PROTO_NAME_TCP, 'protocol': const.PROTO_NAME_TCP,
'ethertype': const.IPv6, 'ethertype': const.IPv6,
'port_range_max': 23, 'port_range_min': 23, 'port_range_max': 23, 'port_range_min': 23,

View File

@ -138,7 +138,7 @@ class ResourceTestCase(base.BaseTestCase):
return wsgi.JSONDeserializer() return wsgi.JSONDeserializer()
def test_unmapped_neutron_error_with_json(self): def test_unmapped_neutron_error_with_json(self):
msg = u'\u7f51\u7edc' msg = '\u7f51\u7edc'
class TestException(n_exc.NeutronException): class TestException(n_exc.NeutronException):
message = msg message = msg
@ -181,7 +181,7 @@ class ResourceTestCase(base.BaseTestCase):
str(wsgi.JSONDeserializer().deserialize(res.body))) str(wsgi.JSONDeserializer().deserialize(res.body)))
def test_mapped_neutron_error_with_json(self): def test_mapped_neutron_error_with_json(self):
msg = u'\u7f51\u7edc' msg = '\u7f51\u7edc'
class TestException(n_exc.NeutronException): class TestException(n_exc.NeutronException):
message = msg message = msg

View File

@ -139,7 +139,7 @@ class TestNovaNotify(base.BaseTestCase):
device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87' device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87'
returned_obj = {'port': returned_obj = {'port':
{'device_owner': DEVICE_OWNER_COMPUTE, {'device_owner': DEVICE_OWNER_COMPUTE,
'id': u'bee50827-bcee-4cc8-91c1-a27b0ce54222', 'id': 'bee50827-bcee-4cc8-91c1-a27b0ce54222',
'device_id': device_id}} 'device_id': device_id}}
expected_event = {'server_uuid': device_id, expected_event = {'server_uuid': device_id,
@ -152,7 +152,7 @@ class TestNovaNotify(base.BaseTestCase):
def test_create_floatingip_notify(self): def test_create_floatingip_notify(self):
device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87' device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87'
returned_obj = {'floatingip': returned_obj = {'floatingip':
{'port_id': u'bee50827-bcee-4cc8-91c1-a27b0ce54222'}} {'port_id': 'bee50827-bcee-4cc8-91c1-a27b0ce54222'}}
expected_event = {'server_uuid': device_id, expected_event = {'server_uuid': device_id,
'name': 'network-changed', 'name': 'network-changed',
@ -172,7 +172,7 @@ class TestNovaNotify(base.BaseTestCase):
def test_delete_floatingip_notify(self): def test_delete_floatingip_notify(self):
device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87' device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87'
returned_obj = {'floatingip': returned_obj = {'floatingip':
{'port_id': u'bee50827-bcee-4cc8-91c1-a27b0ce54222'}} {'port_id': 'bee50827-bcee-4cc8-91c1-a27b0ce54222'}}
expected_event = {'server_uuid': device_id, expected_event = {'server_uuid': device_id,
'name': 'network-changed', 'name': 'network-changed',
@ -202,7 +202,7 @@ class TestNovaNotify(base.BaseTestCase):
def test_associate_floatingip_notify(self): def test_associate_floatingip_notify(self):
device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87' device_id = '32102d7b-1cf4-404d-b50a-97aae1f55f87'
returned_obj = {'floatingip': returned_obj = {'floatingip':
{'port_id': u'5a39def4-3d3f-473d-9ff4-8e90064b9cc1'}} {'port_id': '5a39def4-3d3f-473d-9ff4-8e90064b9cc1'}}
original_obj = {'port_id': None} original_obj = {'port_id': None}
expected_event = {'server_uuid': device_id, expected_event = {'server_uuid': device_id,

View File

@ -375,8 +375,8 @@ class TestL2PopulationRpcTestCase(test_plugin.Ml2PluginV2TestCase):
host=HOST_4, host=HOST_4,
refresh_tunnels=True) refresh_tunnels=True)
fanout_expected = {port['port']['network_id']: { fanout_expected = {port['port']['network_id']: {
'network_type': u'vxlan', 'network_type': 'vxlan',
'ports': {u'20.0.0.4': [('00:00:00:00:00:00', '0.0.0.0')]}, 'ports': {'20.0.0.4': [('00:00:00:00:00:00', '0.0.0.0')]},
'segment_id': 1}} 'segment_id': 1}}
self.mock_fanout.assert_called_with(mock.ANY, self.mock_fanout.assert_called_with(mock.ANY,
'add_fdb_entries', 'add_fdb_entries',
@ -1490,13 +1490,13 @@ class TestL2PopulationMechDriver(base.BaseTestCase):
self.assertEqual(expected_result, result) self.assertEqual(expected_result, result)
def test_update_port_precommit_mac_address_changed_raises(self): def test_update_port_precommit_mac_address_changed_raises(self):
port = {'status': u'ACTIVE', port = {'status': 'ACTIVE',
'device_owner': DEVICE_OWNER_COMPUTE, 'device_owner': DEVICE_OWNER_COMPUTE,
'mac_address': u'12:34:56:78:4b:0e', 'mac_address': '12:34:56:78:4b:0e',
'id': u'1'} 'id': '1'}
original_port = port.copy() original_port = port.copy()
original_port['mac_address'] = u'12:34:56:78:4b:0f' original_port['mac_address'] = '12:34:56:78:4b:0f'
with mock.patch.object(driver_context.segments_db, with mock.patch.object(driver_context.segments_db,
'get_network_segments'): 'get_network_segments'):

View File

@ -2619,7 +2619,7 @@ class TestOvsNeutronAgent(object):
self.assertRaises(ValueError, self._make_agent) self.assertRaises(ValueError, self._make_agent)
def test__check_bridge_datapath_id(self): def test__check_bridge_datapath_id(self):
datapath_id = u'0000622486fa3f42' datapath_id = '0000622486fa3f42'
datapath_ids_set = set() datapath_ids_set = set()
for i in range(5): for i in range(5):
dpid = format((i << 48) + int(datapath_id, 16), '0x').zfill(16) dpid = format((i << 48) + int(datapath_id, 16), '0x').zfill(16)

View File

@ -167,7 +167,7 @@ class TestManagers(base.BaseTestCase):
cfg.CONF.set_override('mechanism_drivers', ['faulty_agent'], cfg.CONF.set_override('mechanism_drivers', ['faulty_agent'],
group='ml2') group='ml2')
self.assertRaises(SystemExit, managers.MechanismManager) self.assertRaises(SystemExit, managers.MechanismManager)
mock_log.assert_called_once_with(u"The '%(entrypoint)s' entrypoint " mock_log.assert_called_once_with("The '%(entrypoint)s' entrypoint "
"could not be loaded for the " "could not be loaded for the "
"following reason: '%(reason)s'.", "following reason: '%(reason)s'.",
{'entrypoint': mock.ANY, {'entrypoint': mock.ANY,

View File

@ -237,20 +237,20 @@ class LoggingRpcCallbackTestCase(test_sg.SecurityGroupDBTestCase):
'port_id': port_id, 'port_id': port_id,
'security_group_rules': [ 'security_group_rules': [
{'direction': 'egress', {'direction': 'egress',
'ethertype': u'IPv4', 'ethertype': 'IPv4',
'security_group_id': sg_id}, 'security_group_id': sg_id},
{'direction': 'egress', {'direction': 'egress',
'ethertype': u'IPv6', 'ethertype': 'IPv6',
'security_group_id': sg_id}, 'security_group_id': sg_id},
{'direction': 'ingress', {'direction': 'ingress',
'ethertype': u'IPv4', 'ethertype': 'IPv4',
'port_range_max': 22, 'port_range_max': 22,
'port_range_min': 22, 'port_range_min': 22,
'protocol': u'tcp', 'protocol': 'tcp',
'security_group_id': sg_id}, 'security_group_id': sg_id},
{'direction': 'egress', {'direction': 'egress',
'ethertype': u'IPv4', 'ethertype': 'IPv4',
'protocol': u'tcp', 'protocol': 'tcp',
'dest_ip_prefix': 'dest_ip_prefix':
net_utils.AuthenticIPNetwork( net_utils.AuthenticIPNetwork(
'10.0.0.1/32'), '10.0.0.1/32'),
@ -312,23 +312,23 @@ class LoggingRpcCallbackTestCase(test_sg.SecurityGroupDBTestCase):
'port_id': port_id, 'port_id': port_id,
'security_group_rules': [ 'security_group_rules': [
{'direction': 'egress', {'direction': 'egress',
'ethertype': u'IPv4', 'ethertype': 'IPv4',
'security_group_id': sg_id}, 'security_group_id': sg_id},
{'direction': 'egress', {'direction': 'egress',
'ethertype': u'IPv6', 'ethertype': 'IPv6',
'security_group_id': sg_id}, 'security_group_id': sg_id},
{'direction': 'ingress', {'direction': 'ingress',
'ethertype': u'IPv4', 'ethertype': 'IPv4',
'port_range_max': 13, 'port_range_max': 13,
'port_range_min': 11, 'port_range_min': 11,
'protocol': u'tcp', 'protocol': 'tcp',
'source_ip_prefix': 'source_ip_prefix':
net_utils.AuthenticIPNetwork( net_utils.AuthenticIPNetwork(
'10.0.0.1/32'), '10.0.0.1/32'),
'security_group_id': sg_id}, 'security_group_id': sg_id},
{'direction': 'egress', {'direction': 'egress',
'ethertype': u'IPv4', 'ethertype': 'IPv4',
'protocol': u'icmp', 'protocol': 'icmp',
'security_group_id': sg_id}] 'security_group_id': sg_id}]
}], }],
'project_id': tenant_id 'project_id': tenant_id

View File

@ -260,7 +260,7 @@ class SerializerTest(base.BaseTestCase):
serializer = wsgi.Serializer() serializer = wsgi.Serializer()
result = serializer.deserialize(data_string, content_type) result = serializer.deserialize(data_string, content_type)
self.assertEqual({'body': {u'servers': [u'test=pass']}}, result) self.assertEqual({'body': {'servers': ['test=pass']}}, result)
class RequestDeserializerTest(testtools.TestCase): class RequestDeserializerTest(testtools.TestCase):
@ -520,7 +520,7 @@ class JSONDictSerializerTest(base.BaseTestCase):
self.assertEqual(expected_json, result) self.assertEqual(expected_json, result)
def test_json_with_unicode(self): def test_json_with_unicode(self):
input_dict = dict(servers=dict(a=(2, u'\u7f51\u7edc'))) input_dict = dict(servers=dict(a=(2, '\u7f51\u7edc')))
expected_json = b'{"servers":{"a":[2,"\\u7f51\\u7edc"]}}' expected_json = b'{"servers":{"a":[2,"\\u7f51\\u7edc"]}}'
serializer = wsgi.JSONDictSerializer() serializer = wsgi.JSONDictSerializer()
result = serializer.serialize(input_dict) result = serializer.serialize(input_dict)
@ -572,14 +572,14 @@ class JSONDeserializerTest(base.BaseTestCase):
def test_json_with_utf8(self): def test_json_with_utf8(self):
data = b'{"a": "\xe7\xbd\x91\xe7\xbb\x9c"}' data = b'{"a": "\xe7\xbd\x91\xe7\xbb\x9c"}'
as_dict = {'body': {'a': u'\u7f51\u7edc'}} as_dict = {'body': {'a': '\u7f51\u7edc'}}
deserializer = wsgi.JSONDeserializer() deserializer = wsgi.JSONDeserializer()
self.assertEqual(as_dict, self.assertEqual(as_dict,
deserializer.deserialize(data)) deserializer.deserialize(data))
def test_json_with_unicode(self): def test_json_with_unicode(self):
data = b'{"a": "\u7f51\u7edc"}' data = b'{"a": "\u7f51\u7edc"}'
as_dict = {'body': {'a': u'\u7f51\u7edc'}} as_dict = {'body': {'a': '\u7f51\u7edc'}}
deserializer = wsgi.JSONDeserializer() deserializer = wsgi.JSONDeserializer()
self.assertEqual(as_dict, self.assertEqual(as_dict,
deserializer.deserialize(data)) deserializer.deserialize(data))

View File

@ -60,8 +60,8 @@ source_suffix = '.rst'
master_doc = 'index' master_doc = 'index'
# General information about the project. # General information about the project.
project = u'Neutron Release Notes' project = 'Neutron Release Notes'
copyright = u'2015, Neutron Developers' copyright = '2015, Neutron Developers'
# Release notes are version independent # Release notes are version independent
# The short X.Y version. # The short X.Y version.
@ -209,8 +209,8 @@ latex_elements = {
# author, documentclass [howto, manual, or own class]). # author, documentclass [howto, manual, or own class]).
latex_documents = [ latex_documents = [
('index', 'NeutronReleaseNotes.tex', ('index', 'NeutronReleaseNotes.tex',
u'Neutron Release Notes Documentation', 'Neutron Release Notes Documentation',
u'Neutron Developers', 'manual'), 'Neutron Developers', 'manual'),
] ]
# The name of an image file (relative to this directory) to place at the top of # The name of an image file (relative to this directory) to place at the top of
@ -239,8 +239,8 @@ latex_documents = [
# One entry per manual page. List of tuples # One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section). # (source start file, name, description, authors, manual section).
man_pages = [ man_pages = [
('index', 'neutronreleasenotes', u'Neutron Release Notes Documentation', ('index', 'neutronreleasenotes', 'Neutron Release Notes Documentation',
[u'Neutron Developers'], 1) ['Neutron Developers'], 1)
] ]
# If true, show URL addresses after external links. # If true, show URL addresses after external links.
@ -253,8 +253,8 @@ man_pages = [
# (source start file, target name, title, author, # (source start file, target name, title, author,
# dir menu entry, description, category) # dir menu entry, description, category)
texinfo_documents = [ texinfo_documents = [
('index', 'NeutronReleaseNotes', u'Neutron Release Notes Documentation', ('index', 'NeutronReleaseNotes', 'Neutron Release Notes Documentation',
u'Neutron Developers', 'NeutronReleaseNotes', 'Neutron Developers', 'NeutronReleaseNotes',
'One line description of project.', 'One line description of project.',
'Miscellaneous'), 'Miscellaneous'),
] ]