Created
May 6, 2021 00:48
-
-
Save podhmo/d117e6aaf94437c6c484fa2e1582da4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dataclasses | |
import enum | |
import jsonpickle | |
class Status(enum.Enum): | |
x = enum.auto() | |
y = enum.auto() | |
z = enum.auto() | |
@dataclasses.dataclass | |
class A: | |
name: str | |
age: int | |
status: Status | |
a = A(name="foo", age=0, status=Status.y) | |
print(jsonpickle.encode(a)) | |
print(jsonpickle.decode(jsonpickle.encode(a))) | |
print(jsonpickle.decode(jsonpickle.encode(a)) == a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment