diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2025-02-18 08:35:36 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-18 08:35:36 +0100 |
| commit | efb7f9ced2dcf71294353596a265e3fd67faffeb (patch) | |
| tree | b24b6127022fbe48c517d1acbe9e3c0c502391d9 /tests/migrations | |
| parent | 0d1dd6bba0c18b7feb6caa5cbd8df80fbac54afd (diff) | |
Refs #36005 -- Used datetime.UTC alias instead of datetime.timezone.utc.
datetime.UTC was added in Python 3.11.
Diffstat (limited to 'tests/migrations')
| -rw-r--r-- | tests/migrations/test_writer.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py index 953a3cdb6c..3a070f4d45 100644 --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -644,6 +644,13 @@ class WriterTests(SimpleTestCase): ("datetime.datetime(2014, 1, 1, 1, 1)", {"import datetime"}), ) self.assertSerializedResultEqual( + datetime.datetime(2012, 1, 1, 1, 1, tzinfo=datetime.UTC), + ( + "datetime.datetime(2012, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)", + {"import datetime"}, + ), + ) + self.assertSerializedResultEqual( datetime.datetime(2012, 1, 1, 1, 1, tzinfo=datetime.timezone.utc), ( "datetime.datetime(2012, 1, 1, 1, 1, tzinfo=datetime.timezone.utc)", @@ -1042,7 +1049,7 @@ class WriterTests(SimpleTestCase): "myfield", models.DateTimeField( default=datetime.datetime( - 2012, 1, 1, 1, 1, tzinfo=datetime.timezone.utc + 2012, 1, 1, 1, 1, tzinfo=datetime.UTC ), ), ), @@ -1066,7 +1073,7 @@ class WriterTests(SimpleTestCase): Test comments at top of file. """ migration = type("Migration", (migrations.Migration,), {"operations": []}) - dt = datetime.datetime(2015, 7, 31, 4, 40, 0, 0, tzinfo=datetime.timezone.utc) + dt = datetime.datetime(2015, 7, 31, 4, 40, 0, 0, tzinfo=datetime.UTC) with mock.patch("django.db.migrations.writer.now", lambda: dt): for include_header in (True, False): with self.subTest(include_header=include_header): |
