Skip to content

Conversation

@MarcSkovMadsen
Copy link
Collaborator

@MarcSkovMadsen MarcSkovMadsen commented Nov 28, 2022

Closing #5526

Depends on #5522

Comment on lines 334 to 362
def test_datetime_xaxis(self):
"""Test to make sure a DateTimeAxis can be identified for the bokeh backend"""
plot_ibis = Curve(self.reference_table, kdims="date", vdims="actual")
# When
plot_bokeh = render(plot_ibis, "bokeh")
xaxis, yaxis = plot_bokeh.axis
# Then
assert isinstance(xaxis, bokeh_axes.DatetimeAxis)
assert isinstance(yaxis, bokeh_axes.LinearAxis)

def test_categorical_xaxis(self):
"""Test to make sure a Categorical axis can be identified for the bokeh backend"""
plot_ibis = Curve(self.reference_table, kdims="string", vdims="actual")
# When
plot_bokeh = render(plot_ibis, "bokeh")
xaxis, yaxis = plot_bokeh.axis
# Then
assert isinstance(xaxis, bokeh_axes.CategoricalAxis)
assert isinstance(yaxis, bokeh_axes.LinearAxis)

def test_numerical_xaxis(self):
"""Test to make sure a LinearAxis axis can be identified for the bokeh backend"""
plot_ibis = Curve(self.reference_table, kdims="numerical", vdims="actual")
# When
plot_bokeh = render(plot_ibis, "bokeh")
xaxis, yaxis = plot_bokeh.axis
# Then
assert isinstance(xaxis, bokeh_axes.LinearAxis)
assert isinstance(yaxis, bokeh_axes.LinearAxis)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of all, really appreciate your work investigating these issues. That said these tests can't live here. The plotting and data parts of HoloViews are separated for a reason and if test coverage of the data parts is sufficiently extensive then there's no reason to ever test the plotting code with different data backends.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if test coverage of the data parts is sufficiently extensive

To be clear, that is of course clearly not the case since you're discovering these issues.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the non-comprehensive test, the missing docstrings and type annotations from the base Interface also makes it harder than it has to be, to know what a method on the interface actually should do and return.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would someone be able to setup appropriate tests for a backend @philippjfr? If I look into the tests/core/data folder I see nothing that systematically tests the same things across backends?

And knowing what to test for is also quite difficult due to missing docstrings, type annotations, very complex functions and similar.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are various baseclasses in tests/core/data which implement systematic tests which are then subclassed for each interface.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best thing to do is probably to continue extending tests/core/data/base HeterogeneousColumnTests with more tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifically testing for datetime columns seems to be pretty lacking.

@codecov-commenter
Copy link

codecov-commenter commented Nov 29, 2022

Codecov Report

❌ Patch coverage is 11.66667% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.56%. Comparing base (0317237) to head (d98011b).
⚠️ Report is 646 commits behind head on main.

Files with missing lines Patch % Lines
holoviews/tests/core/data/test_ibisinterface.py 10.00% 45 Missing ⚠️
holoviews/core/data/ibis.py 20.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5527      +/-   ##
==========================================
- Coverage   88.07%   87.56%   -0.51%     
==========================================
  Files         302      302              
  Lines       62283    62338      +55     
==========================================
- Hits        54855    54589     -266     
- Misses       7428     7749     +321     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hoxbro
Copy link
Member

hoxbro commented Oct 31, 2025

Will be fixed by #6718.

image
from pathlib import Path

import duckdb
import holoviews as hv
import hvplot.ibis
import hvplot.pandas
import ibis
import pandas as pd

hvplot.extension("plotly")

DUCKDB_PATH = "DuckDB.db"

pandas_df = pd.DataFrame(
    {
        "actual": [100, 150, 125, 140, 145, 135, 123],
        "forecast": [90, 160, 125, 150, 141, 141, 120],
        "numerical": [1.1, 1.9, 3.2, 3.8, 4.3, 5.0, 5.5],
        "date": pd.date_range("2022-01-03", "2022-01-09"),
        "string": ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
    },
)
if not Path(DUCKDB_PATH).exists():
    duckdb_con = duckdb.connect(DUCKDB_PATH)
    duckdb_con.execute("CREATE TABLE df AS SELECT * FROM pandas_df")

ibis.options.sql.default_limit = None

db = ibis.duckdb.connect(DUCKDB_PATH)

table = db.table("df")

hv.Bars(table, kdims="string", vdims="actual").redim.values(
    string=["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
)

@hoxbro hoxbro closed this Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ibis.common.exceptions.OperationNotDefinedError: No translation rule for <class 'ibis.expr.operations.generic.RowID'>

5 participants