MCPcopy Index your code
hub / github.com/plotly/plotly.py / check_roundtrip

Function check_roundtrip

tests/test_io/test_to_from_plotly_json.py:56–66  ·  view source on GitHub ↗
(value, engine, pretty)

Source from the content-addressed store, hash-verified

54
55
56def check_roundtrip(value, engine, pretty):
57 encoded = pio.to_json_plotly(value, engine=engine, pretty=pretty)
58 decoded = pio.from_json_plotly(encoded, engine=engine)
59 reencoded = pio.to_json_plotly(decoded, engine=engine, pretty=pretty)
60 assert encoded == reencoded
61
62 # Check from_plotly_json with bytes on Python 3
63 if sys.version_info.major == 3:
64 encoded_bytes = encoded.encode("utf8")
65 decoded_from_bytes = pio.from_json_plotly(encoded_bytes, engine=engine)
66 assert decoded == decoded_from_bytes
67
68
69# Fixtures

Callers 9

test_graph_object_inputFunction · 0.85
test_datetimeFunction · 0.85
test_datetime_arraysFunction · 0.85
test_object_arrayFunction · 0.85
test_nonstring_keyFunction · 0.85

Calls 1

encodeMethod · 0.45

Tested by

no test coverage detected