Replaced the bind with the connection method

This commit is contained in:
2024-01-15 20:24:38 +01:00
parent 3af9ff58d6
commit 27a95c1c23
7 changed files with 26 additions and 48 deletions

View File

@@ -130,7 +130,7 @@ def test_transfer_news_to_sql(full_db: Session, monkeypatch: MonkeyPatch) -> Non
lambda _: NEWS_TEXTS,
)
transfer_news._transfer_news_to_sql(None, full_db) # type: ignore
articles = pd.read_sql_table(entities.News.__tablename__, full_db.bind) # type: ignore
articles = pd.read_sql_table(entities.News.__tablename__, full_db.connection()) # type: ignore
assert "text" in articles.columns
del articles["text"]
assert articles.to_dict(orient="records") == [
@@ -158,7 +158,7 @@ def test_transfer_news_to_sql(full_db: Session, monkeypatch: MonkeyPatch) -> Non
},
]
pd.testing.assert_frame_equal(
pd.read_sql_table(entities.Sentiment.__tablename__, full_db.bind), # type: ignore
pd.read_sql_table(entities.Sentiment.__tablename__, full_db.connection()),
pd.DataFrame(
[
{