docstr: Tests writing data to alternative schema.
docstr_tok: ["Tests","writing","data","to","alternative","schema","."]
code: def test_write_postgis_to_different_schema(
      self, engine_postgis, df_nybb
  ):
      """
      Tests writing data to alternative schema.
      """
      engine = engine_postgis
  
      table = "nybb"
      schema_to_use = "test"
      sql = text(
          "CREATE SCHEMA IF NOT EXISTS {schema};".format(
              schema=schema_to_use
          )
      )
      with engine.begin() as conn:
          conn.execute(sql)
  
      write_postgis(
          df_nybb,
          con=engine,
          name=table,
          if_exists="replace",
          schema=schema_to_use,
      )
      # Validate
      sql = text(
          "SELECT * FROM {schema}.{table};".format(
              schema=schema_to_use, table=table
          )
      )
  
      df = read_postgis(sql, engine, geom_col="geometry")
      validate_boro_df(df)
  
imports: import os
  import warnings
  import pandas
  import geopandas
  from geopandas import GeoDataFrame, read_file, read_postgis
  import geopandas._compat
  from geopandas.io.sql import _get_conn, _write_postgis
  from geopandas.tests.util import create_postgis, create_spatialite, validate_boro_df
  import pytest
label_desc: Use image node_id 25 for calling the TestIO obj's underlying member method code with example usage: obj.test_write_postgis_to_different_schema(engine_postgis, df_nybb) without return types