From 57a3d96ff57abffa8e7fbe3fd972a5ee39bd0fec Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Mon, 18 Nov 2019 06:30:10 -0800 Subject: [PATCH] Replaced unnecessary str()/bytes() calls with literals. --- django/db/backends/base/schema.py | 4 ++-- tests/servers/tests.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index 98afbcc05a..bfccf5e8fb 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -282,9 +282,9 @@ class BaseDatabaseSchemaEditor: default = field.get_default() elif not field.null and field.blank and field.empty_strings_allowed: if field.get_internal_type() == "BinaryField": - default = bytes() + default = b'' else: - default = str() + default = '' elif getattr(field, 'auto_now', False) or getattr(field, 'auto_now_add', False): default = datetime.now() internal_type = field.get_internal_type() diff --git a/tests/servers/tests.py b/tests/servers/tests.py index 243b5a4200..33d0605443 100644 --- a/tests/servers/tests.py +++ b/tests/servers/tests.py @@ -250,7 +250,7 @@ class LiveServerPort(LiveServerBase): def test_specified_port_bind(self): """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. s = socket.socket() s.bind(('', 0))