I have a function to read data from a MySQL database:
def example(mysql_engine) -> DataFrame:
query = """SELECT col_1 FROM xxx.xxx"""
df = pandas.read_sql(query, mysql_engine)
return df
mysql_engine
is returned by another function, now I want to write unit tests to validate the column name col_1
and datatype in df
, is there an example I can follow? Do I need to set up a real database engine in unit test?