Skip to content

Commit

Permalink
Test case for 6bac71f
Browse files Browse the repository at this point in the history
  • Loading branch information
parkervg committed Oct 22, 2024
1 parent 6bac71f commit b1b18ab
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/test_multi_table_blendsql.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
return_aapl,
get_table_size,
select_first_option,
return_aapl_alias,
)

databases = [
Expand All @@ -31,6 +32,7 @@ def dummy_ingredients() -> set:
return_aapl,
get_table_size,
select_first_option,
return_aapl_alias,
}


Expand Down Expand Up @@ -293,6 +295,32 @@ def test_qa_equals_multi_exec(db, dummy_ingredients):
assert_equality(smoothie=smoothie, sql_df=sql_df)


@pytest.mark.parametrize("db", databases)
def test_alias_ingredient_multi_exec(db):
"""Tests the AliasIngredient class.
We don't inherit the dummy_ingredients fixture here,
since we want to be sure the 'return_aapl_alias' ingredient
is correctly injecting any dependent ingredients at runtime.
commit 6bac71f
"""
blendsql = """
SELECT Action FROM account_history
WHERE Symbol = {{return_aapl_alias()}}
"""
sql = """
SELECT Action FROM account_history
WHERE Symbol = 'AAPL'
"""
smoothie = blend(
query=blendsql,
db=db,
ingredients={return_aapl_alias},
)
sql_df = db.execute_to_df(sql)
assert_equality(smoothie=smoothie, sql_df=sql_df)


@pytest.mark.parametrize("db", databases)
def test_table_alias_multi_exec(db, dummy_ingredients):
blendsql = """
Expand Down

0 comments on commit b1b18ab

Please sign in to comment.