(value, engine, pretty)
| 54 | |
| 55 | |
| 56 | def 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 |
no test coverage detected