|
| 1 | +from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures |
| 2 | +from django.utils.functional import cached_property |
| 3 | + |
| 4 | + |
| 5 | +class GISFeatures(BaseSpatialFeatures): |
| 6 | + has_spatialrefsys_table = False |
| 7 | + supports_transform = False |
| 8 | + |
| 9 | + @cached_property |
| 10 | + def django_test_expected_failures(self): |
| 11 | + expected_failures = super().django_test_expected_failures |
| 12 | + expected_failures.update( |
| 13 | + { |
| 14 | + # annotate with Value not supported, e.g. |
| 15 | + # QuerySet.annotate(p=Value(p, GeometryField(srid=4326) |
| 16 | + "gis_tests.geoapp.test_expressions.GeoExpressionsTests.test_geometry_value_annotation", |
| 17 | + } |
| 18 | + ) |
| 19 | + return expected_failures |
| 20 | + |
| 21 | + @cached_property |
| 22 | + def django_test_skips(self): |
| 23 | + skips = super().django_test_skips |
| 24 | + skips.update( |
| 25 | + { |
| 26 | + "inspectdb not supported.": { |
| 27 | + "gis_tests.inspectapp.tests.InspectDbTests", |
| 28 | + }, |
| 29 | + "Raw SQL not supported": { |
| 30 | + "gis_tests.geoapp.tests.GeoModelTest.test_raw_sql_query", |
| 31 | + }, |
| 32 | + "MongoDB doesn't support the SRID used in this test.": { |
| 33 | + # Error messages: |
| 34 | + # - Can't extract geo keys |
| 35 | + # - Longitude/latitude is out of bounds |
| 36 | + "gis_tests.geoapp.test_expressions.GeoExpressionsTests.test_update_from_other_field", |
| 37 | + "gis_tests.layermap.tests.LayerMapTest.test_encoded_name", |
| 38 | + "gis_tests.relatedapp.tests.RelatedGeoModelTest.test06_f_expressions", |
| 39 | + # SouthTexasCity fixture objects use SRID 2278 which is ignored |
| 40 | + # by the patched version of loaddata in the Django fork. |
| 41 | + "gis_tests.distapp.tests.DistanceTest.test_init", |
| 42 | + }, |
| 43 | + "ImproperlyConfigured isn't raised when using RasterField": { |
| 44 | + # Normally RasterField.db_type() raises an error, but MongoDB |
| 45 | + # migrations don't need to call it, so the check doesn't happen. |
| 46 | + "gis_tests.gis_migrations.test_operations.NoRasterSupportTests", |
| 47 | + }, |
| 48 | + "MongoDB doesn't support redundant spatial indexes.": { |
| 49 | + # Error: Index already exists with a different name |
| 50 | + "gis_tests.geoapp.test_indexes.SchemaIndexesTests.test_index_name", |
| 51 | + }, |
| 52 | + "GIS lookups not supported.": { |
| 53 | + "gis_tests.geoapp.tests.GeoModelTest.test_gis_query_as_string", |
| 54 | + "gis_tests.geoapp.tests.GeoLookupTest.test_gis_lookups_with_complex_expressions", |
| 55 | + }, |
| 56 | + "GeoJSONSerializer doesn't support ObjectId.": { |
| 57 | + "gis_tests.geoapp.test_serializers.GeoJSONSerializerTests.test_fields_option", |
| 58 | + "gis_tests.geoapp.test_serializers.GeoJSONSerializerTests.test_geometry_field_option", |
| 59 | + "gis_tests.geoapp.test_serializers.GeoJSONSerializerTests.test_serialization_base", |
| 60 | + "gis_tests.geoapp.test_serializers.GeoJSONSerializerTests.test_srid_option", |
| 61 | + }, |
| 62 | + }, |
| 63 | + ) |
| 64 | + return skips |
0 commit comments