@@ -775,19 +775,18 @@ def test_WKBElement(self, session, Lake, setup_tables, dialect_name):
775
775
assert srid == 4326
776
776
777
777
@test_only_with_dialects ("postgresql" , "mysql" , "sqlite-spatialite3" , "sqlite-spatialite4" )
778
- def test_transform (self , session , LocalPoint , setup_tables ):
779
- if session .bind .dialect .name == "mysql" :
780
- # Explicitly skip MySQL dialect to show that there is an issue
781
- pytest .skip (
782
- reason = (
783
- "The SRID is not properly retrieved so an exception is raised. TODO: This "
784
- "should be fixed later"
785
- )
786
- )
778
+ def test_transform (self , session , LocalPoint , setup_tables , dialect_name ):
787
779
# Create new point instance
788
780
p = LocalPoint ()
789
- p .geom = "SRID=4326;POINT(5 45)" # Insert geometry with wrong SRID
790
- p .managed_geom = "SRID=4326;POINT(5 45)" # Insert geometry with wrong SRID
781
+ if dialect_name in ["mysql" , "mariadb" ]:
782
+ expected_x = 45
783
+ expected_y = 5
784
+ else :
785
+ expected_x = 5
786
+ expected_y = 45
787
+ ewkt = f"SRID=4326;POINT({ expected_x } { expected_y } )"
788
+ p .geom = ewkt # Insert geometry with wrong SRID
789
+ p .managed_geom = ewkt # Insert geometry with wrong SRID
791
790
792
791
# Insert point
793
792
session .add (p )
@@ -800,11 +799,11 @@ def test_transform(self, session, LocalPoint, setup_tables):
800
799
assert pt .geom .srid == 4326
801
800
assert pt .managed_geom .srid == 4326
802
801
pt_wkb = to_shape (pt .geom )
803
- assert round (pt_wkb .x , 5 ) == 5
804
- assert round (pt_wkb .y , 5 ) == 45
802
+ assert round (pt_wkb .x , 5 ) == expected_x
803
+ assert round (pt_wkb .y , 5 ) == expected_y
805
804
pt_wkb = to_shape (pt .managed_geom )
806
- assert round (pt_wkb .x , 5 ) == 5
807
- assert round (pt_wkb .y , 5 ) == 45
805
+ assert round (pt_wkb .x , 5 ) == expected_x
806
+ assert round (pt_wkb .y , 5 ) == expected_y
808
807
809
808
# Check that the data is correct in DB using raw query
810
809
q = text (
@@ -818,7 +817,10 @@ def test_transform(self, session, LocalPoint, setup_tables):
818
817
for i in [res_q .geom , res_q .managed_geom ]:
819
818
x , y = re .match (r"POINT\((\d+\.\d*) (\d+\.\d*)\)" , i ).groups ()
820
819
assert round (float (x ), 3 ) == 857581.899
821
- assert round (float (y ), 3 ) == 6435414.748
820
+ if dialect_name in ["mysql" , "mariadb" ]:
821
+ assert round (float (y ), 3 ) == 6434180.796
822
+ else :
823
+ assert round (float (y ), 3 ) == 6435414.748
822
824
823
825
824
826
class TestUpdateORM :
0 commit comments