Repository navigation
Conversation
…e' kind options typo
…, shared fixtures; drop --geo
… tests marked geo
Remove unittest.TestCase, ComparisonTestCase and parameterized; turn the dask subclasses into tabular_lib/gridded_lib parametrization; deduplicate tests; fix test bugs; replace import guards with requires(); mark hvPlot bugs found as strict xfails.
…tion options/test_options_inventory.py and kinds/test_kinds_inventory.py check that every option of HoloViewsConverter._options_groups and every kind option of _kind_options has a test named after it in the matching module. hvPlot bugs uncovered by the new tests are marked as strict xfails.
…kinds Address the review: compare dim expressions by repr, test non-default option values, restore dask variants and whole-element comparisons lost in the migration, fix xfail/skip reasons, turn leftover classes into functions, and test the y container types on pandas only so that test_all_kinds goes from 690 to 169 tests while really checking y.
…render hvPlot configures HoloViews objects, but an invalid configuration often only fails when the plot is built. The test suite now renders every HoloViews object returned by hvPlot with the current backend. Failures are triaged: test data fixed, hvPlot bugs and upstream bugs marked with the new render_xfail marker, which only applies when rendering.
Following the review of how deeply each option was tested, add tests for the untested forms, values, data types and backends of the options and kinds (e.g. all legend positions, color/cmap forms, by/groupby lists and gridded data, ylim/xlim/invert per kind, hist/kde by, hexbin effects), and strict BUG xfails for the hvPlot bugs they uncovered. Use lighter Natural Earth scales in the geo tests.
… explorer with each
…ach backend, clarify backend xfails
…b_xfail, lib_render_xfail and lib_skip
…ecific tests to their kind or option
…-dependent options on dask-backed data too
…ators, merge the kind sweeps
Member
Author
|
The AI expanded the test suite at my request and found quite a number of issues. I'm posting them for the record for now. Issues found while refactoring the test suiteTo be addressed in separate PRs. Paths are relative to
hvPlot bugsOptions
Kinds
Data librariesMost of these are found by polars and duckdb
ibis
dask
Others
Behaviors to decide onTested as they are, not xfailed. Each could be a bug or intended.
Docstring issues
Found but not tested yet
Upstream issues, not filed yetEach has a non-strict xfail in the test suite. # HoloViews, plotly: numeric fontsize
hv.extension('plotly'); df = pd.DataFrame({'x': [1, 2, 3], 'y': [4, 5, 6]})
hv.renderer('plotly').get_plot(hv.Scatter(df, 'x', 'y').opts(fontsize=12)) # TypeError: argument of type 'int' is not iterable
# HoloViews, plotly: xaxis=True (bokeh and matplotlib accept it)
hv.renderer('plotly').get_plot(hv.Scatter(df, 'x', 'y').opts(xaxis=True)) # ValueError: does not accept True
# HoloViews, plotly: Bivariate
hv.renderer('plotly').get_plot(hv.Bivariate(df, ['x', 'y'])) # KeyError: 'Density'
# HoloViews, bokeh: BoxWhisker without kdims and with hover
hv.renderer('bokeh').get_plot(hv.BoxWhisker(pd.DataFrame({'0': [0, 1, 2]}), [], '0').opts(tools=['hover'])) # ValueError: zip() argument 2 is longer than argument 1
# HoloViews, bokeh: Area with string values
hv.renderer('bokeh').get_plot(hv.Area(pd.DataFrame({'upper': list('abc')}), 'index', 'upper')) # TypeError: '<=' not supported between 'int' and 'str'
# HoloViews, Narwhals interface with an ibis table (t = ibis.memtable(pd.DataFrame(...))), each fails at render:
hv.HexTiles(t, ['x', 'y']) # TypeError: Unexpected type for Series.__getitem__ (ndarray)
hv.Violin(t, [], 'y') # same TypeError
hv.BoxWhisker(t, [], 'y') # TypeError: Slicing is not supported on LazyFrame
hv.Curve(t, 'x', 'y').opts(interpolation='steps-mid') # TypeError: Cannot interpret 'Int64' as a data type
hv.Polygons([t], ['x', 'lon']) # AttributeError: 'Series' object has no attribute 'astype'
hv.VectorField(t, ['x', 'y'], ['angle', 'mag']) # ArrowNotImplementedError: add int64 + list<double>
hv.HeatMap(t, ['x', 'y'], 'value') # DataError: PandasInterface, DataFrame constructor not properly called
# HoloViews, Bars of a dask DataFrame with two kdims
ddf = dd.from_pandas(pd.DataFrame({'x': [1, 3, 5], 'y': [2, 4, 6], 'category': list('ABC')}), npartitions=2)
hv.Bars(ddf, ['x', 'category'], 'y') # ValueError: Cannot call len() on object with unknown chunk size
# HoloViews, apply_when + rasterize below the threshold drops the raw points after render
from holoviews.operation import apply_when
from holoviews.operation.datashader import rasterize
df = pd.DataFrame({'x': np.random.random(50), 'y': np.random.random(50)})
dmap = apply_when(hv.Scatter(df, 'x', 'y'), operation=rasterize, predicate=lambda p: len(p) > 1000)
hv.render(dmap)
print([(type(e).__name__, len(e)) for e in dmap.items()[0][1]]) # [('Image', 0), ('Scatter', 0)], expected Scatter(50)
# HoloViews + datashader, rasterize with a selector on dask data
ddf = dd.from_pandas(pd.DataFrame({'x': [1., 2, 3], 'y': [1., 2, 3], 'z': [1., 2, 3]}), npartitions=2)
hv.render(rasterize(hv.Points(ddf, ['x', 'y'], ['z']), selector=ds.first('z'))) # Array chunk size or shape is unknown
# dask 2026.8.0
ddf = dd.from_pandas(pd.DataFrame({'x': [1, 2], 'y': [3, 4]}), npartitions=2)
ddf.rename_axis(columns='My Name')['x'].max().compute() # TypeError: Series.rename_axis() got an unexpected keyword argument 'columns'
# datashader, pandas 3 string dtype
df = pd.DataFrame({'x': [1., 2, 3], 'y': [1., 2, 3], 'category': list('abc')})
ds.Canvas(plot_width=10, plot_height=10).points(df, 'x', 'y', ds.first('category')) # TypeError: Cannot interpret '<StringDtype(na_value=nan)>' as a data type |
…a, loosen the saved HTML check
… marker, guard the polars unpatch
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rework of
hvplot/tests. Goals: make it obvious where a test goes, test every plot option and kind, cover the data and plotting backends where relevant, isolate the tests, and keep the default run fast and offline.The issues found along the way are listed in a comment below and will be addressed separately.
What changed
kinds/(one module per kind, plustest_all_kinds.pysweeping every kind on each backend),options/(one module per option group),plotting/(pandas backend and thehvplot.plottingfunctions),data_libraries/(accessors, and the parity test checking that each tabular library gives the same plot as pandas). Inventory tests fail when a new option or kind has no test.TestCaseclasses orparameterized.geo.--no-renderturns it off.tabular_lib,gridded_libandbackendfixtures run a test across libraries or plotting backends. Known per-library failures uselib_xfail,lib_render_xfailandlib_skip. The library lists live in_deps.py.block_importfixture).slowand skipped by default,--slowruns them.scripts/download_data.pyfetches the Natural Earth data the geo tests render.BUG:reason; upstream failures (HoloViews, dask, datashader) are non-strict xfails.Outside the tests:
_unpatch()added to each data library extension module, used by the test isolation;'violine'typo in_kind_optionsfixed to'violin';cartopy <0.26pinned in the py311 test env (GeoViews 1.15 fails to render with it);doconly, like the pixi task.