We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 115d166 commit fabd54dCopy full SHA for fabd54d
packages/python/plotly/plotly/tests/test_io/test_to_from_plotly_json.py
@@ -6,6 +6,7 @@
6
import pandas as pd
7
import json
8
import datetime
9
+import re
10
import sys
11
from pytz import timezone
12
from _plotly_utils.optional_imports import get_module
@@ -201,6 +202,14 @@ def to_str(v):
201
202
203
array_str = to_json_test(dt_values)
204
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
+
213
assert result == expected
214
check_roundtrip(result, engine=engine, pretty=pretty)
215
0 commit comments