@skipUnlessDBFeature('supports_temporal_subtraction')
    def test_date_subtraction(self):
        queryset = Experiment.objects.annotate(
            completion_duration=ExpressionWrapper(
                F('completed') - F('assigned'), output_field=models.DurationField()
            )
        )

        at_least_5_days = {e.name for e in queryset.filter(completion_duration__gte=datetime.timedelta(days=5))}
        self.assertEqual(at_least_5_days, {'e3', 'e4'})

        less_than_5_days = {e.name for e in queryset.filter(completion_duration__lt=datetime.timedelta(days=5))}
        expected = {'e0', 'e2'}
        if connection.features.supports_microsecond_precision:
            expected.add('e1')
        self.assertEqual(less_than_5_days, expected)
dataset/ETHPy150Open django/django/tests/expressions/tests.py/FTimeDeltaTests.test_date_subtraction/original