Skip to content

Commit

Permalink
[MNT] Add tests for db module
Browse files Browse the repository at this point in the history
  • Loading branch information
lmmentel committed Sep 30, 2024
1 parent a5ea19e commit 1fc4836
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from mendeleev.db import get_engine
from sqlalchemy import text as sql_text
import pandas as pd


def test_read_sql_table():
engine = get_engine()
query = "select * from elements"
with engine.begin() as conn:
df = pd.read_sql_query(sql=sql_text(query), con=conn)
assert df is not None


def test_read_sql_table_old():
engine = get_engine()
query = "select * from elements"
# with engine.begin() as conn:
conn = engine.connect()
df = pd.read_sql_query(sql=query, con=conn)
assert df is not None

0 comments on commit 1fc4836

Please sign in to comment.