def METHOD_NAME(  # noqa: C901
    tap_class: type[Tap],
    config: dict | None = None,
) -> list[t.Callable]:
    """Return callable pytest which executes simple discovery and connection tests.
    Args:
        tap_class: TODO
        config: TODO
    Returns:
        TODO
    """
    def _test_cli_prints() -> None:
        # Initialize with basic config
        tap1: Tap = tap_class(config=config, parse_env_config=True)
        # Test CLI prints
        tap1.print_version()
        tap1.print_about()
        tap1.print_about(output_format="json")
    def _test_discovery() -> None:
        catalog1 = _get_tap_catalog(tap_class, config or {})
        # Reset and re-initialize with an input catalog
        tap2: Tap = tap_class(config=config, parse_env_config=True, catalog=catalog1)
        assert tap2
    def _test_stream_connections() -> None:
        # Initialize with basic config
        tap1: Tap = tap_class(config=config, parse_env_config=True)
        tap1.run_connection_test()
    def _test_pkeys_in_schema() -> None:
        """Verify that primary keys are actually in the stream's schema."""
        tap = tap_class(config=config, parse_env_config=True)
        for name, stream in tap.streams.items():
            pkeys = stream.primary_keys or []
            schema_props = set(stream.schema["properties"].keys())
            for pkey in pkeys:
                error_message = (
                    f"Coding error in stream '{name}': "
                    f"primary_key '{pkey}' is missing in schema"
                )
                assert pkey in schema_props, error_message
    def _test_state_partitioning_keys_in_schema() -> None:
        """Verify that state partitioning keys are actually in the stream's schema."""
        tap = tap_class(config=config, parse_env_config=True)
        for name, stream in tap.streams.items():
            sp_keys = stream.state_partitioning_keys or []
            schema_props = set(stream.schema["properties"].keys())
            for sp_key in sp_keys:
                assert sp_key in schema_props, (
                    f"Coding error in stream '{name}': state_partitioning_key "
                    f"'{sp_key}' is missing in schema"
                )
    def _test_replication_keys_in_schema() -> None:
        """Verify that the replication key is actually in the stream's schema."""
        tap = tap_class(config=config, parse_env_config=True)
        for name, stream in tap.streams.items():
            rep_key = stream.replication_key
            if rep_key is None:
                continue
            schema_props = set(stream.schema["properties"].keys())
            assert rep_key in schema_props, (
                f"Coding error in stream '{name}': replication_key "
                f"'{rep_key}' is missing in schema"
            )
    return [
        _test_cli_prints,
        _test_discovery,
        _test_stream_connections,
        _test_pkeys_in_schema,
        _test_state_partitioning_keys_in_schema,
        _test_replication_keys_in_schema,
    ]