]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Force different placeholder to increase the coverage
authorJacopo Farina <jacopo.farina@flixbus.com>
Wed, 15 Sep 2021 14:28:35 +0000 (16:28 +0200)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 21 Sep 2021 18:02:18 +0000 (19:02 +0100)
tests/test_shapely.py

index 6e410793e78c0bc540a6c1ce3d2d92ccdff964c0..b01d320e106122f3fd0bdce7d29b486b8613124d 100644 (file)
@@ -97,6 +97,9 @@ def test_write_read_shape(shapely_conn, fmt_out):
 
     SAMPLE_POINT = Point(1.2, 3.4)
     SAMPLE_POLYGON = Polygon([(0, 0), (1, 1), (1, 0)])
+
+    fmt_placeholder = "%b" if fmt_out == Format.BINARY else "%t"
+
     with shapely_conn.cursor(binary=fmt_out) as cur:
         cur.execute(
             """
@@ -107,10 +110,11 @@ def test_write_read_shape(shapely_conn, fmt_out):
         """
         )
         cur.execute(
-            "insert into sample_geoms(id, geom) VALUES(1, %s)", (SAMPLE_POINT,)
+            f"insert into sample_geoms(id, geom) VALUES(1, {fmt_placeholder})",
+            (SAMPLE_POINT,),
         )
         cur.execute(
-            "insert into sample_geoms(id, geom) VALUES(2, %s)",
+            f"insert into sample_geoms(id, geom) VALUES(2, {fmt_placeholder})",
             (SAMPLE_POLYGON,),
         )