# Path: pandas_gbq/exceptions.py
# class GenericGBQException(ValueError):
# class AccessDenied(ValueError):
# class ConversionError(GenericGBQException):
# class InvalidPrivateKeyFormat(ValueError):
# class PerformanceWarning(RuntimeWarning):
# 
# Path: pandas_gbq/features.py
# FEATURES = Features()
# 
# Path: pandas_gbq/load.py
# def encode_chunk(dataframe):
# def split_dataframe(dataframe, chunksize=None):
# def cast_dataframe_for_parquet(
#     dataframe: pandas.DataFrame, schema: Optional[Dict[str, Any]],
# ) -> pandas.DataFrame:
# def load_parquet(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
# def load_csv(
#     dataframe: pandas.DataFrame,
#     chunksize: Optional[int],
#     bq_schema: Optional[List[bigquery.SchemaField]],
#     load_chunk: Callable,
# ):
# def load_csv_from_dataframe(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     chunksize: Optional[int],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
#     def load_chunk(chunk, job_config):
# def load_csv_from_file(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     chunksize: Optional[int],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
#     def load_chunk(chunk, job_config):
# def load_chunks(
#     client,
#     dataframe,
#     destination_table_ref,
#     chunksize=None,
#     schema=None,
#     location=None,
#     api_method="load_parquet",
#     billing_project: Optional[str] = None,
# ):


import datetime
import decimal
import textwrap
import db_dtypes
import numpy
import pandas
import pandas.testing
import pytest
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import pyarrow
from io import StringIO
from unittest import mock
from pandas_gbq import exceptions
from pandas_gbq.features import FEATURES
from pandas_gbq import load
# Copyright (c) 2017 pandas-gbq Authors All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

# -*- coding: utf-8 -*-





def load_method(bqclient, api_method):
    if not FEATURES.bigquery_has_from_dataframe_with_csv and api_method == "load_csv":
        return bqclient.load_table_from_file
    return bqclient.load_table_from_dataframe



# Path: pandas_gbq/exceptions.py
# class GenericGBQException(ValueError):
# class AccessDenied(ValueError):
# class ConversionError(GenericGBQException):
# class InvalidPrivateKeyFormat(ValueError):
# class PerformanceWarning(RuntimeWarning):
# 
# Path: pandas_gbq/features.py
# FEATURES = Features()
# 
# Path: pandas_gbq/load.py
# def encode_chunk(dataframe):
# def split_dataframe(dataframe, chunksize=None):
# def cast_dataframe_for_parquet(
#     dataframe: pandas.DataFrame, schema: Optional[Dict[str, Any]],
# ) -> pandas.DataFrame:
# def load_parquet(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
# def load_csv(
#     dataframe: pandas.DataFrame,
#     chunksize: Optional[int],
#     bq_schema: Optional[List[bigquery.SchemaField]],
#     load_chunk: Callable,
# ):
# def load_csv_from_dataframe(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     chunksize: Optional[int],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
#     def load_chunk(chunk, job_config):
# def load_csv_from_file(
#     client: bigquery.Client,
#     dataframe: pandas.DataFrame,
#     destination_table_ref: bigquery.TableReference,
#     location: Optional[str],
#     chunksize: Optional[int],
#     schema: Optional[Dict[str, Any]],
#     billing_project: Optional[str] = None,
# ):
#     def load_chunk(chunk, job_config):
# def load_chunks(
#     client,
#     dataframe,
#     destination_table_ref,
#     chunksize=None,
#     schema=None,
#     location=None,
#     api_method="load_parquet",
#     billing_project: Optional[str] = None,
# ):


# Path: tests/unit/test_load.py
import datetime
import decimal
import textwrap
import db_dtypes
import numpy
import pandas
import pandas.testing
import pytest
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import google.cloud.bigquery
    import pyarrow
from io import StringIO
from unittest import mock
from pandas_gbq import exceptions
from pandas_gbq.features import FEATURES
from pandas_gbq import load

# Copyright (c) 2017 pandas-gbq Authors All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.

# -*- coding: utf-8 -*-





def load_method(bqclient, api_method):
    if not FEATURES.bigquery_has_from_dataframe_with_csv and api_method == "load_csv":
        return bqclient.load_table_from_file
    return bqclient.load_table_from_dataframe



def test_encode_chunk_with_unicode():