code: def test_callproc_dict(self):
      # This parameter name tests for injection and quote escaping
      paramname = """
              Robert'); drop table "students" --
          """.strip()
      escaped_paramname = '"%s"' % paramname.replace('"', '""')
      procname = "pg_temp.randall"
  
      cur = self.conn.cursor()
  
      # Set up the temporary function
      cur.execute(
          f"""
              CREATE FUNCTION {procname}({escaped_paramname} INT)
              RETURNS INT AS
                  'SELECT $1 * $1'
              LANGUAGE SQL
          """
      )
  
      # Make sure callproc works right
      cur.callproc(procname, {paramname: 2})
      self.assertEquals(cur.fetchone()[0], 4)
  
      # Make sure callproc fails right
      failing_cases = [
          ({paramname: 2, "foo": "bar"}, psycopg2.ProgrammingError),
          ({paramname: "2"}, psycopg2.ProgrammingError),
          ({paramname: "two"}, psycopg2.ProgrammingError),
          ({"bj\xc3rn": 2}, psycopg2.ProgrammingError),
          ({3: 2}, TypeError),
          ({self: 2}, TypeError),
      ]
      for parameter_sequence, exception in failing_cases:
          self.assertRaises(
              exception, cur.callproc, procname, parameter_sequence
          )
          self.conn.rollback()
  
imports: import gc
  import sys
  import time
  import ctypes
  import pickle
  import psycopg2
  import psycopg2.extensions
  import unittest
  from datetime import date
  from decimal import Decimal
  from weakref import ref
  from .testutils import ConnectingTestCase, skip_before_postgres, skip_if_no_getrefcount, slow, skip_if_no_superuser, skip_if_windows, skip_if_crdb, crdb_version
  import psycopg2.extras
label_desc: Use image node_id 20 for calling the CursorTests obj's underlying member method code with example usage: obj.test_callproc_dict() without return types