Refs #29738 -- Added test for serializing psycopg2's NumericRange with DecimalRangeField in migrations.

This commit is contained in:
Guilherme Martins Crocetti 2021-11-04 10:36:11 +01:00 committed by Mariusz Felisiak
parent dc7ffd60d9
commit 52f6927d7f
1 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,5 @@
from decimal import Decimal
from django.db.backends.signals import connection_created from django.db.backends.signals import connection_created
from django.db.migrations.writer import MigrationWriter from django.db.migrations.writer import MigrationWriter
from django.test.utils import modify_settings from django.test.utils import modify_settings
@ -10,7 +12,8 @@ try:
) )
from django.contrib.postgres.fields import ( from django.contrib.postgres.fields import (
DateRangeField, DateTimeRangeField, IntegerRangeField, DateRangeField, DateTimeRangeField, DecimalRangeField,
IntegerRangeField,
) )
except ImportError: except ImportError:
pass pass
@ -29,6 +32,7 @@ class PostgresConfigTests(PostgreSQLTestCase):
(DateRange(empty=True), DateRangeField), (DateRange(empty=True), DateRangeField),
(DateTimeRange(empty=True), DateRangeField), (DateTimeRange(empty=True), DateRangeField),
(DateTimeTZRange(None, None, '[]'), DateTimeRangeField), (DateTimeTZRange(None, None, '[]'), DateTimeRangeField),
(NumericRange(Decimal('1.0'), Decimal('5.0'), '()'), DecimalRangeField),
(NumericRange(1, 10), IntegerRangeField), (NumericRange(1, 10), IntegerRangeField),
) )