From: Jacopo Farina Date: Thu, 16 Sep 2021 12:45:48 +0000 (+0200) Subject: Pass test geoJSON as parameter, not with string interpolation X-Git-Tag: 3.0~71^2~6 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=021c54c9b5aaecd343e2d1301ac17cea9568a299;p=thirdparty%2Fpsycopg.git Pass test geoJSON as parameter, not with string interpolation --- diff --git a/tests/test_shapely.py b/tests/test_shapely.py index 8f7760449..e8f10a570 100644 --- a/tests/test_shapely.py +++ b/tests/test_shapely.py @@ -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