Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add test for datetime64[ns]
  • Loading branch information
emilykl committed Nov 11, 2025
commit 4d4fa4f99b1ba555f1346776fb6d03311e0ef69e
16 changes: 16 additions & 0 deletions tests/test_optional/test_graph_objs/test_numpy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from datetime import datetime

import numpy as np

import plotly.graph_objs as go


def test_np_ns_datetime():
x = [np.datetime64("2025-09-26").astype("datetime64[ns]")]
y = [1.23]
scatter = go.Scatter(x=x, y=y, mode="markers")

# x value should be converted to native datetime
assert isinstance(scatter.x[0], datetime)
# x value should match original numpy value at microsecond precision
assert x[0].astype("datetime64[us]").item() == scatter.x[0]