From 666be7b9942611d5c0f5e485c448f219cd5a1ad5 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Fri, 1 Jun 2018 22:54:26 -0400 Subject: [PATCH] Fixed #29461 -- Fixed ogrinspect test_time_field failure on SpatiaLite. --- tests/gis_tests/inspectapp/tests.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/gis_tests/inspectapp/tests.py b/tests/gis_tests/inspectapp/tests.py index 51bb363fa0..ca49fc0d2d 100644 --- a/tests/gis_tests/inspectapp/tests.py +++ b/tests/gis_tests/inspectapp/tests.py @@ -134,12 +134,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