# Path: simplesqlite/core.py
# def connect_memdb(max_workers: Optional[int] = None) -> SimpleSQLite:
#     """
#     :return: Instance of an in memory database.
#     :rtype: SimpleSQLite
# 
#     :Example:
#         :ref:`example-connect-sqlite-db-mem`
#     """
# 
#     return SimpleSQLite(MEMORY_DB_NAME, "w", max_workers=max_workers)
# 
# Path: test/_common.py
# def print_test_result(expected, actual, error=None):
#     print(f"[expected]\n{expected}\n")
#     print(f"[actual]\n{actual}\n")
# 
#     if error:
#         print(error, file=sys.stderr)


import pytest
    import pandas as pd
from simplesqlite import connect_memdb
from ._common import print_test_result
try:

    PANDAS_IMPORT = True
except ImportError:
    PANDAS_IMPORT = False


@pytest.mark.skipif(not PANDAS_IMPORT, reason="required package not found")
class Test_fromto_pandas_dataframe:
    def test_normal(self):
        con = connect_memdb()
        dataframe = pd.DataFrame(
            [[0, 0.1, "a"], [1, 1.1, "bb"], [2, 2.2, "ccc"]], columns=["id", "value", "name"]
        )
        table_name = "tablename"

        con.create_table_from_dataframe(dataframe, table_name)

        actual_all = con.select_as_dataframe(table_name=table_name)
        print_test_result(expected=dataframe, actual=actual_all)

        assert actual_all.equals(dataframe)

        select_columns = ["value", "name"]
        actual_part = con.select_as_dataframe(table_name=table_name, columns=select_columns)
        assert actual_part.equals(
            pd.DataFrame([[0.1, "a"], [1.1, "bb"], [2.2, "ccc"]], columns=select_columns)
        )

    def test_normal_include_datetime(self):

# Path: simplesqlite/core.py
# def connect_memdb(max_workers: Optional[int] = None) -> SimpleSQLite:
#     """
#     :return: Instance of an in memory database.
#     :rtype: SimpleSQLite
# 
#     :Example:
#         :ref:`example-connect-sqlite-db-mem`
#     """
# 
#     return SimpleSQLite(MEMORY_DB_NAME, "w", max_workers=max_workers)
# 
# Path: test/_common.py
# def print_test_result(expected, actual, error=None):
#     print(f"[expected]\n{expected}\n")
#     print(f"[actual]\n{actual}\n")
# 
#     if error:
#         print(error, file=sys.stderr)


# Path: test/test_pandas.py
import pytest
    import pandas as pd
from simplesqlite import connect_memdb
from ._common import print_test_result

try:

    PANDAS_IMPORT = True
except ImportError:
    PANDAS_IMPORT = False


@pytest.mark.skipif(not PANDAS_IMPORT, reason="required package not found")
class Test_fromto_pandas_dataframe:
    def test_normal(self):
        con = connect_memdb()
        dataframe = pd.DataFrame(
            [[0, 0.1, "a"], [1, 1.1, "bb"], [2, 2.2, "ccc"]], columns=["id", "value", "name"]
        )
        table_name = "tablename"

        con.create_table_from_dataframe(dataframe, table_name)

        actual_all = con.select_as_dataframe(table_name=table_name)
        print_test_result(expected=dataframe, actual=actual_all)

        assert actual_all.equals(dataframe)

        select_columns = ["value", "name"]
        actual_part = con.select_as_dataframe(table_name=table_name, columns=select_columns)
        assert actual_part.equals(
            pd.DataFrame([[0.1, "a"], [1.1, "bb"], [2.2, "ccc"]], columns=select_columns)
        )

    def test_normal_include_datetime(self):

        con = connect_memdb()