

@requires_tz_support
@skipIfDBFeature('supports_microsecond_precision')
def test_naive_datetime_with_microsecond_unsupported(self):
    dt = datetime.datetime(2011, 9, 1, 13, 20, 30, 405060)
    with warnings.catch_warnings(record=True) as recorded:
        warnings.simplefilter('always')
        Event.objects.create(dt=dt)
        self.assertEqual(len(recorded), 1)
        msg = str(recorded[0].message)
        self.assertTrue(msg.startswith('DateTimeField Event.dt received a naive datetime'))
    event = Event.objects.get()
    self.assertEqual(event.dt, dt.replace(microsecond=0, tzinfo=EAT))

dataset/ETHPy150Open django/django/tests/timezones/tests.py NewDatabaseTests.test_naive_datetime_with_microsecond_unsupported/original