Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatal1ty committed Jun 12, 2023
1 parent c77f9f7 commit 7dcc09c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/test_annotated.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,9 @@ class Config(BaseConfig):
"deserialize": date.fromisoformat,
},
date: {
"serialize": lambda x: datetime(
x.year, x.month, x.day
).timestamp(),
"serialize": lambda x: x.strftime("%Y%m%d"),
"deserialize": (
lambda x: datetime.fromtimestamp(x).date()
lambda x: datetime.strptime(x, "%Y%m%d").date()
),
},
}
Expand All @@ -49,14 +47,15 @@ class Config(BaseConfig):
bar=date(2023, 6, 12),
baz=date(2023, 6, 12),
)
obj.foo.strftime("%Y%M%D")
assert (
DataClass.from_dict(
{"bar": "2023-06-12", "baz": 1686517200.0, "foo": 738683}
{"foo": 738683, "bar": "2023-06-12", "baz": "20230612"}
)
== obj
)
assert obj.to_dict() == {
"bar": "2023-06-12",
"baz": 1686517200.0,
"foo": 738683,
"bar": "2023-06-12",
"baz": "20230612",
}

0 comments on commit 7dcc09c

Please sign in to comment.