Merge "Use == to compare against the empty string, not is"

This commit is contained in:
Zuul 2019-10-15 22:56:44 +00:00 committed by Gerrit Code Review
commit 0e5a32000a
4 changed files with 4 additions and 4 deletions

View File

@ -267,7 +267,7 @@ def run_daemon(klass, conf_file, section_name='', once=False, **kwargs):
""" """
# very often the config section_name is based on the class name # very often the config section_name is based on the class name
# the None singleton will be passed through to readconf as is # the None singleton will be passed through to readconf as is
if section_name is '': if section_name == '':
section_name = sub(r'([a-z])([A-Z])', r'\1-\2', section_name = sub(r'([a-z])([A-Z])', r'\1-\2',
klass.__name__).lower() klass.__name__).lower()
try: try:

View File

@ -217,7 +217,7 @@ def parse_acl_v2(data):
""" """
if data is None: if data is None:
return None return None
if data is '': if data == '':
return {} return {}
try: try:
result = json.loads(data) result = json.loads(data)

View File

@ -187,7 +187,7 @@ class TestRequest(S3ApiTestCase):
self.assertEqual(mock_get_resp.call_count, 2) self.assertEqual(mock_get_resp.call_count, 2)
args, kargs = mock_get_resp.call_args_list[0] args, kargs = mock_get_resp.call_args_list[0]
get_resp_obj = args[3] get_resp_obj = args[3]
self.assertTrue(get_resp_obj is '') self.assertEqual(get_resp_obj, '')
self.assertEqual(m_check_permission.call_count, 1) self.assertEqual(m_check_permission.call_count, 1)
args, kargs = m_check_permission.call_args args, kargs = m_check_permission.call_args
permission = args[1] permission = args[1]

View File

@ -600,7 +600,7 @@ class TestWSGI(unittest.TestCase):
logger = logging.getLogger('test') logger = logging.getLogger('test')
sock = listen_zero() sock = listen_zero()
wsgi.run_server(conf, logger, sock) wsgi.run_server(conf, logger, sock)
self.assertTrue(os.environ['TZ'] is not '') self.assertNotEqual(os.environ['TZ'], '')
self.assertEqual(30, _wsgi.WRITE_TIMEOUT) self.assertEqual(30, _wsgi.WRITE_TIMEOUT)
_wsgi_evt.hubs.use_hub.assert_called_with(utils.get_hub()) _wsgi_evt.hubs.use_hub.assert_called_with(utils.get_hub())