Skip to content

Commit

Permalink
added tests for non-datetime x-axis
Browse files Browse the repository at this point in the history
  • Loading branch information
Azaya89 committed Feb 6, 2025
1 parent fc10a83 commit 46e53d0
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions hvplot/tests/plotting/testohlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,27 @@ def test_ohlc_date_tooltip_format():
formatter_key = '@' + x_label
formatter = hover_tool.formatters
assert formatter.get(formatter_key) == 'datetime'


def test_ohlc_non_datetime_x_axis():
df = pd.DataFrame(
{
'Open': [100.00, 101.25, 102.75],
'High': [104.10, 105.50, 110.00],
'Low': [94.00, 97.10, 99.20],
'Close': [101.15, 99.70, 109.50],
'Volume': [10012, 5000, 18000],
},
index=[1, 2, 3],
)

ohlc_cols = ['Open', 'High', 'Low', 'Close']

plot = df.hvplot.ohlc(y=ohlc_cols)
segments = plot.Segments.I
hover_tool = segments.opts.get('plot').kwargs['tools'][0]
tooltips = hover_tool.tooltips
x_label, x_tooltip = tooltips[0]
assert '{%F}' not in x_tooltip
formatter_key = '@' + x_label
assert formatter_key not in hover_tool.formatters

0 comments on commit 46e53d0

Please sign in to comment.