File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
packages/python/plotly/plotly/tests/test_io Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change 66import pandas as pd
77import json
88import datetime
9+ import re
910import sys
1011from pytz import timezone
1112from _plotly_utils .optional_imports import get_module
@@ -201,6 +202,14 @@ def to_str(v):
201202
202203 array_str = to_json_test (dt_values )
203204 expected = build_test_dict_string (array_str )
205+ if orjson :
206+ # orjson always serializes datetime64 to ns, but json will return either
207+ # full seconds or microseconds, if the rest is zeros.
208+ # we don't care about any trailing zeros
209+ trailing_zeros = re .compile (r'[.]?0+"' )
210+ result = trailing_zeros .sub ('"' , result )
211+ expected = trailing_zeros .sub ('"' , expected )
212+
204213 assert result == expected
205214 check_roundtrip (result , engine = engine , pretty = pretty )
206215
You can’t perform that action at this time.
0 commit comments