Skip to content

Commit d54db1c

Browse files
committed
Add deserialization test
1 parent d178c85 commit d54db1c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changelog/_unreleased.toml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[[entries]]
2+
id = "6d0f41f2-f7f9-4808-af65-196a7a909b4f"
3+
type = "fix"
4+
description = "Fix #47: Union with Literal in them can now de/serialize"
5+
author = "@rhaps0dy"

databind/src/databind/json/tests/converters_test.py

+6
Original file line numberDiff line numberDiff line change
@@ -726,3 +726,9 @@ def test_union_literal():
726726

727727
assert mapper.serialize("bye", StrType) == "bye"
728728
assert mapper.serialize("other", StrType) == "other"
729+
730+
assert mapper.deserialize("hi", IntType) == "hi"
731+
assert mapper.deserialize(2, IntType) == 2
732+
733+
assert mapper.deserialize("bye", StrType) == "bye"
734+
assert mapper.deserialize("other", StrType) == "other"

0 commit comments

Comments
 (0)