Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal committed Oct 29, 2024
1 parent d819f73 commit dcc5023
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion wren-core-py/tests/functions.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
function_type,name,return_type,description
scalar,add_two,int,"Adds two numbers together."
aggregate,median,int,"Returns the median value of a numeric column."
window,max_if,int,"If the condition is true, returns the maximum value in the window."
12 changes: 7 additions & 5 deletions wren-core-py/tests/test_modeling_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@ def test_session_context():

def test_read_function_list():
path = "tests/functions.csv"
functions = wren_core.read_remote_function_list(path)
assert len(functions) == 3
session_context = SessionContext(manifest_str, path)
functions = session_context.get_available_functions()
assert len(functions) == 260

rewritten_sql = wren_core.transform_sql(manifest_str, functions, "SELECT add_two(c_custkey) FROM my_catalog.my_schema.customer")
rewritten_sql = session_context.transform_sql("SELECT add_two(c_custkey) FROM my_catalog.my_schema.customer")
assert rewritten_sql == 'SELECT add_two(customer.c_custkey) FROM (SELECT customer.c_custkey FROM (SELECT main.customer.c_custkey AS c_custkey FROM main.customer) AS customer) AS customer'

functions = wren_core.read_remote_function_list(None)
assert len(functions) == 0
session_context = SessionContext(manifest_str, None)
functions = session_context.get_available_functions()
assert len(functions) == 258


def test_get_available_functions():
Expand Down

0 comments on commit dcc5023

Please sign in to comment.