diff options
author | Tim Graham <timograham@gmail.com> | 2018-06-01 22:54:26 -0400 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-06-02 07:33:32 -0400 |
commit | b548180605e760fcc284bf20dde310e9afb49a5e (patch) | |
tree | fcf3f7892dd6f05b7d72304cf622934fefef9242 /tests | |
parent | d60d7d6d71018b17f01bbf0c390c7d929ff28310 (diff) | |
download | django-b548180605e760fcc284bf20dde310e9afb49a5e.tar.gz |
[1.11.x] Fixed #29461 -- Fixed ogrinspect test_time_field failure on SpatiaLite.
Backport of 666be7b9942611d5c0f5e485c448f219cd5a1ad5 from master
Diffstat (limited to 'tests')
-rw-r--r-- | tests/gis_tests/inspectapp/tests.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/gis_tests/inspectapp/tests.py b/tests/gis_tests/inspectapp/tests.py index 1e153fe772..23980f860c 100644 --- a/tests/gis_tests/inspectapp/tests.py +++ b/tests/gis_tests/inspectapp/tests.py @@ -133,12 +133,20 @@ class OGRInspectTest(TestCase): )) # The ordering of model fields might vary depending on several factors (version of GDAL, etc.) - self.assertIn(' f_decimal = models.DecimalField(max_digits=0, decimal_places=0)', model_def) + if connection.vendor == 'sqlite': + # SpatiaLite introspection is somewhat lacking (#29461). + self.assertIn(' f_decimal = models.CharField(max_length=0)', model_def) + else: + self.assertIn(' f_decimal = models.DecimalField(max_digits=0, decimal_places=0)', model_def) self.assertIn(' f_int = models.IntegerField()', model_def) self.assertIn(' f_datetime = models.DateTimeField()', model_def) self.assertIn(' f_time = models.TimeField()', model_def) - self.assertIn(' f_float = models.FloatField()', model_def) - self.assertIn(' f_char = models.CharField(max_length=10)', model_def) + if connection.vendor == 'sqlite': + self.assertIn(' f_float = models.CharField(max_length=0)', model_def) + else: + self.assertIn(' f_float = models.FloatField()', model_def) + max_length = 0 if connection.vendor == 'sqlite' else 10 + self.assertIn(' f_char = models.CharField(max_length=%s)' % max_length, model_def) self.assertIn(' f_date = models.DateField()', model_def) # Some backends may have srid=-1 |