'Test to ensure that truncate microseconds works as expected.
This will be default behavior in the future and we will need to modify the tests to comply
with new behavior
@since 3.2
@jira_ticket PYTHON-273
@expected_result microseconds should be to the nearest thousand when truncate is set.
@test_category object_mapper'

def test_datetime_truncate_microseconds(self):

    DateTime.truncate_microseconds = True
    try:
        dt_value = datetime(2024, 12, 31, 10, 10, 10, 923567)
        dt_truncated = datetime(2024, 12, 31, 10, 10, 10, 923000)
        self.DatetimeTest.objects.create(test_id=6, created_at=dt_value)
        dt2 = self.DatetimeTest.objects(test_id=6).first()
        self.assertEqual(dt2.created_at, dt_truncated)
    finally:
        DateTime.truncate_microseconds = False
