|
| 1 | +from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures |
| 2 | +from django.utils.functional import cached_property |
| 3 | + |
| 4 | +from django_mongodb_backend.features import DatabaseFeatures as MongoFeatures |
| 5 | + |
| 6 | + |
| 7 | +class DatabaseFeatures(BaseSpatialFeatures, MongoFeatures): |
| 8 | + has_spatialrefsys_table = False |
| 9 | + supports_transform = False |
| 10 | + |
| 11 | + @cached_property |
| 12 | + def django_test_expected_failures(self): |
| 13 | + expected_failures = super().django_test_expected_failures |
| 14 | + expected_failures.update( |
| 15 | + { |
| 16 | + # SRIDs aren't populated: AssertionError: 4326 != None |
| 17 | + # self.assertEqual(4326, nullcity.point.srid) |
| 18 | + "gis_tests.geoapp.tests.GeoModelTest.test_proxy", |
| 19 | + # MongoDB does not support the within lookup |
| 20 | + "gis_tests.relatedapp.tests.RelatedGeoModelTest.test06_f_expressions", |
| 21 | + # 'Adapter' object has no attribute 'srid' |
| 22 | + "gis_tests.geoapp.test_expressions.GeoExpressionsTests.test_geometry_value_annotation", |
| 23 | + # Object of type ObjectId is not JSON serializable |
| 24 | + "gis_tests.geoapp.test_serializers.GeoJSONSerializerTests.test_fields_option", |
| 25 | + "gis_tests.geoapp.test_serializers.GeoJSONSerializerTests.test_geometry_field_option", |
| 26 | + "gis_tests.geoapp.test_serializers.GeoJSONSerializerTests.test_serialization_base", |
| 27 | + "gis_tests.geoapp.test_serializers.GeoJSONSerializerTests.test_srid_option", |
| 28 | + # KeyError: 'within' connection.ops.gis_operators[self.lookup_name] |
| 29 | + "gis_tests.geoapp.tests.GeoModelTest.test_gis_query_as_string", |
| 30 | + # No lookups are supported (yet?) |
| 31 | + "gis_tests.geoapp.tests.GeoLookupTest.test_gis_lookups_with_complex_expressions", |
| 32 | + # Trying to remove spatial index fails: |
| 33 | + # "index not found with name [gis_neighborhood_geom_id]" |
| 34 | + "gis_tests.gis_migrations.test_operations.OperationTests.test_alter_field_remove_spatial_index", |
| 35 | + } |
| 36 | + ) |
| 37 | + return expected_failures |
| 38 | + |
| 39 | + @cached_property |
| 40 | + def django_test_skips(self): |
| 41 | + skips = super().django_test_skips |
| 42 | + skips.update( |
| 43 | + { |
| 44 | + "inspectdb not supported.": { |
| 45 | + "gis_tests.inspectapp.tests.InspectDbTests", |
| 46 | + }, |
| 47 | + "Raw SQL not supported": { |
| 48 | + "gis_tests.geoapp.tests.GeoModelTest.test_raw_sql_query", |
| 49 | + }, |
| 50 | + "MongoDB doesn't support the SRID(s) used in this test.": { |
| 51 | + # Error messages: |
| 52 | + # - Can't extract geo keys |
| 53 | + # - Longitude/latitude is out of bounds |
| 54 | + "gis_tests.geoapp.test_expressions.GeoExpressionsTests.test_update_from_other_field", |
| 55 | + "gis_tests.layermap.tests.LayerMapTest.test_encoded_name", |
| 56 | + # SouthTexasCity fixture objects use SRID 2278 which is ignored |
| 57 | + # by the patched version of loaddata in the Django fork. |
| 58 | + "gis_tests.distapp.tests.DistanceTest.test_init", |
| 59 | + }, |
| 60 | + "ImproperlyConfigured isn't raised when using RasterField": { |
| 61 | + # Normally RasterField.db_type() raises an error, but MongoDB |
| 62 | + # migrations don't need to call it, so the check doesn't happen. |
| 63 | + "gis_tests.gis_migrations.test_operations.NoRasterSupportTests", |
| 64 | + }, |
| 65 | + }, |
| 66 | + ) |
| 67 | + return skips |
0 commit comments