1
0
mirror of https://github.com/django/django.git synced 2025-06-05 03:29:12 +00:00

[1.5.x] Lowered field ordering requirement in ogrinspect test

This test was randomly failing depending on the library environment.
Backport of a1c470a6f from master.
This commit is contained in:
Claude Paroz 2013-02-02 14:00:38 +01:00
parent 6bd3896fcb
commit 3610d11ba0

View File

@ -68,23 +68,27 @@ class OGRInspectTest(TestCase):
layer_key=AllOGRFields._meta.db_table, layer_key=AllOGRFields._meta.db_table,
decimal=['f_decimal']) decimal=['f_decimal'])
expected = [ self.assertTrue(model_def.startswith(
'# This is an auto-generated Django model module created by ogrinspect.', '# This is an auto-generated Django model module created by ogrinspect.\n'
'from django.contrib.gis.db import models', 'from django.contrib.gis.db import models\n'
'', '\n'
'class Measurement(models.Model):', 'class Measurement(models.Model):\n'
' f_decimal = models.DecimalField(max_digits=0, decimal_places=0)', ))
' f_int = models.IntegerField()',
' f_datetime = models.DateTimeField()', # The ordering of model fields might vary depending on several factors (version of GDAL, etc.)
' f_time = models.TimeField()', self.assertIn(' f_decimal = models.DecimalField(max_digits=0, decimal_places=0)', model_def)
' f_float = models.FloatField()', self.assertIn(' f_int = models.IntegerField()', model_def)
' f_char = models.CharField(max_length=10)', self.assertIn(' f_datetime = models.DateTimeField()', model_def)
' f_date = models.DateField()', self.assertIn(' f_time = models.TimeField()', model_def)
' geom = models.PolygonField()', self.assertIn(' f_float = models.FloatField()', model_def)
' objects = models.GeoManager()', self.assertIn(' f_char = models.CharField(max_length=10)', model_def)
] self.assertIn(' f_date = models.DateField()', model_def)
self.assertTrue(model_def.endswith(
' geom = models.PolygonField()\n'
' objects = models.GeoManager()'
))
self.assertEqual(model_def, '\n'.join(expected))
def get_ogr_db_string(): def get_ogr_db_string():
# Construct the DB string that GDAL will use to inspect the database. # Construct the DB string that GDAL will use to inspect the database.