diff --git a/tests/kgtests/db/mkdf.py b/tests/kgtests/db/mkdf.py new file mode 100644 index 0000000..f115526 --- /dev/null +++ b/tests/kgtests/db/mkdf.py @@ -0,0 +1,6 @@ +import numpy as np +import pandas as pd + + +def mkdf(x): + return pd.DataFrame({'col1': np.arange(x)}) diff --git a/tests/kgtests/db/test_table_from_df.kg b/tests/kgtests/db/test_table_from_df.kg new file mode 100644 index 0000000..2a83473 --- /dev/null +++ b/tests/kgtests/db/test_table_from_df.kg @@ -0,0 +1,8 @@ +.py("klongpy.db") +.py("tests/kgtests/db/mkdf.py") +df::mkdf(10) +T::.table(df) + +t("#T=10";#T;10) +t(".schema(T)=[""col1""]";.schema(T);["col1"]) +t("T?""col1""=!10";T?"col1";!10) diff --git a/tests/test_sys_fn_db.py b/tests/test_sys_fn_db.py index 1eaa182..259790a 100644 --- a/tests/test_sys_fn_db.py +++ b/tests/test_sys_fn_db.py @@ -65,7 +65,6 @@ def test_table_from_a_df_with_single_row_and_two_columns(self): klong['df'] = df klong('.py("klongpy.db")') klong('T::.table(df)') - klong('.p(T)') r = klong('#T') self.assertEqual(r, 1) r = klong('.schema(T)') @@ -78,7 +77,6 @@ def test_table_from_a_df_with_one_column_many_rows(self): klong['df'] = df klong('.py("klongpy.db")') klong('T::.table(df)') - klong('.p(T)') r = klong('#T') self.assertEqual(r, 10) r = klong('.schema(T)')