Replaced unnecessary str()/bytes() calls with literals.

This commit is contained in:
Jon Dufresne 2019-11-18 06:30:10 -08:00 committed by Mariusz Felisiak
parent e649d691f8
commit 57a3d96ff5
2 changed files with 3 additions and 3 deletions

View File

@ -282,9 +282,9 @@ class BaseDatabaseSchemaEditor:
default = field.get_default() default = field.get_default()
elif not field.null and field.blank and field.empty_strings_allowed: elif not field.null and field.blank and field.empty_strings_allowed:
if field.get_internal_type() == "BinaryField": if field.get_internal_type() == "BinaryField":
default = bytes() default = b''
else: else:
default = str() default = ''
elif getattr(field, 'auto_now', False) or getattr(field, 'auto_now_add', False): elif getattr(field, 'auto_now', False) or getattr(field, 'auto_now_add', False):
default = datetime.now() default = datetime.now()
internal_type = field.get_internal_type() internal_type = field.get_internal_type()

View File

@ -250,7 +250,7 @@ class LiveServerPort(LiveServerBase):
def test_specified_port_bind(self): def test_specified_port_bind(self):
"""LiveServerTestCase.port customizes the server's port.""" """LiveServerTestCase.port customizes the server's port."""
TestCase = type(str('TestCase'), (LiveServerBase,), {}) TestCase = type('TestCase', (LiveServerBase,), {})
# Find an open port and tell TestCase to use it. # Find an open port and tell TestCase to use it.
s = socket.socket() s = socket.socket()
s.bind(('', 0)) s.bind(('', 0))