diff options
| author | Vytis Banaitis <vytis.banaitis@gmail.com> | 2017-02-12 16:43:04 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-02-16 12:35:40 -0500 |
| commit | eedf276ed1b247c87d3852db4241da1aa9779589 (patch) | |
| tree | 7df519aa311499034a9f4c61d464333a9ed6f11f /tests | |
| parent | 4f0185aac39fff4a5f1a3a3f103e6e920eb60703 (diff) | |
[1.11.x] Fixed #27828 -- Fixed a crash when subtracting Integer/DurationField from DateField on Oracle/PostgreSQL.
Backport of d5088f838d837fc9e3109c828f18511055f20bea from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/expressions/tests.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 8399e3c0a9..7bdcb5f1cd 100644 --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -1187,6 +1187,12 @@ class FTimeDeltaTests(TestCase): ).order_by('name') self.assertQuerysetEqual(over_estimate, ['e3', 'e4'], lambda e: e.name) + def test_date_minus_duration(self): + more_than_4_days = Experiment.objects.filter( + assigned__lt=F('completed') - Value(datetime.timedelta(days=4), output_field=models.DurationField()) + ) + self.assertQuerysetEqual(more_than_4_days, ['e3', 'e4'], lambda e: e.name) + def test_negative_timedelta_update(self): # subtract 30 seconds, 30 minutes, 2 hours and 2 days experiments = Experiment.objects.filter(name='e0').annotate( |
