(self)
| 45 | |
| 46 | @skipUnlessDBFeature("supports_uuid7_function_shift") |
| 47 | def test_uuid7_shift_duration_field(self): |
| 48 | shift = timedelta(minutes=1) |
| 49 | m = UUIDModel.objects.create(shift=shift) |
| 50 | now = datetime.now(timezone.utc) |
| 51 | UUIDModel.objects.update(uuid=UUID7("shift")) |
| 52 | m.refresh_from_db() |
| 53 | ts = int.from_bytes(m.uuid.bytes[:6]) |
| 54 | uuid_timestamp = datetime.fromtimestamp(ts / 1000, tz=timezone.utc) |
| 55 | self.assertAlmostEqual( |
| 56 | (uuid_timestamp - now).total_seconds(), shift.total_seconds(), places=1 |
| 57 | ) |
| 58 | |
| 59 | @skipIfDBFeature("supports_uuid4_function") |
| 60 | def test_uuid4_unsupported(self): |
nothing calls this directly
no test coverage detected