]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Pass test geoJSON as parameter, not with string interpolation
authorJacopo Farina <jacopo.farina@flixbus.com>
Thu, 16 Sep 2021 12:45:48 +0000 (14:45 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 21 Sep 2021 18:02:18 +0000 (19:02 +0100)
tests/test_shapely.py

index 8f776044975bc631be70b279aa363620883029e7..e8f10a570e01e75580a51b780916ac3cdaf33d4f 100644 (file)
@@ -3,7 +3,6 @@ import pytest
 from psycopg.pq import Format
 from psycopg.types import TypeInfo
 from psycopg.adapt import PyFormat
-
 from psycopg import ProgrammingError
 
 pytestmark = [pytest.mark.postgis]
@@ -134,9 +133,10 @@ def test_match_geojson(shapely_conn, fmt_out):
     SAMPLE_POINT = Point(1.2, 3.4)
     with shapely_conn.cursor(binary=fmt_out) as cur:
         cur.execute(
-            f"""
-            select ST_GeomFromGeoJSON('{SAMPLE_POINT_GEOJSON}')
             """
+            select ST_GeomFromGeoJSON(%s)
+            """,
+            (SAMPLE_POINT_GEOJSON,),
         )
         result = cur.fetchone()[0]
         # clone the coordinates to have a list instead of a shapely wrapper