Skip to content

Commit 7f5da99

Browse files
committed
Prepare some tests for Ibis
1 parent 978dca1 commit 7f5da99

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

.github/workflows/continuous-integration.yml

+6
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
- python-version: "3.11"
5151
pandas-version: pre
5252
polars: true
53+
- python-version: "3.11"
54+
ibis: true
5355
- python-version: "3.11"
5456
uninstall_jinja2: true
5557
runs-on: ubuntu-20.04
@@ -85,6 +87,10 @@ jobs:
8587
if: matrix.polars
8688
run: pip install -e .[polars]
8789

90+
- name: Install Ibis
91+
if: matrix.ibis
92+
run: pip install -e .[ibis]
93+
8894
- name: Uninstall jinja2
8995
if: matrix.uninstall_jinja2
9096
run: pip uninstall jinja2 -y

itables/sample_dfs.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def get_df_complex_index():
105105
return df
106106

107107

108-
def get_dict_of_test_dfs(N=100, M=100, polars=False):
108+
def get_dict_of_test_dfs(N=100, M=100, polars=False, ibis=False):
109109
NM_values = np.reshape(np.linspace(start=0.0, stop=1.0, num=N * M), (N, M))
110110

111111
test_dfs = {
@@ -279,6 +279,19 @@ def get_dict_of_test_dfs(N=100, M=100, polars=False):
279279
pass
280280
return polars_dfs
281281

282+
if ibis:
283+
import ibis as ib
284+
285+
con = ib.pandas.connect(test_dfs)
286+
ibis_dfs = {}
287+
for key in test_dfs:
288+
try:
289+
ibis_dfs[key] = con.table(key)
290+
except (TypeError, AttributeError):
291+
pass
292+
293+
return ibis_dfs
294+
282295
return test_dfs
283296

284297

setup.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@
5252
},
5353
tests_require=["pytest", "pytz"],
5454
install_requires=["IPython", "pandas", "numpy"],
55-
extras_require={"polars": ["polars", "pyarrow"]},
55+
extras_require={
56+
"polars": ["polars", "pyarrow"],
57+
"ibis": ["ibis-framework[pandas]"],
58+
},
5659
license="MIT",
5760
classifiers=[
5861
"Development Status :: 5 - Production/Stable",

tests/test_ibis.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pytest
2+
3+
from itables import to_html_datatable
4+
from itables.sample_dfs import get_dict_of_test_dfs
5+
6+
try:
7+
import ibis # noqa
8+
except ImportError as e:
9+
pytest.skip(str(e), allow_module_level=True)
10+
11+
12+
@pytest.mark.parametrize(
13+
"name,df", [(name, df) for name, df in get_dict_of_test_dfs(ibis=True).items()]
14+
)
15+
def test_show_ibis_df(name, df, use_to_html):
16+
to_html_datatable(df, use_to_html)

0 commit comments

Comments
 (0)