Skip to content

Commit

Permalink
Merge pull request #431 from yukinarit/add-test
Browse files Browse the repository at this point in the history
Add test of alias + rename_all
  • Loading branch information
yukinarit authored Oct 9, 2023
2 parents d356168 + 59abd5e commit fead102
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,17 @@ class Foo:
assert ff.a == 10


def test_rename_all_and_alias():
@serde.serde(rename_all="pascalcase")
class Foo:
a_field: int = serde.field(alias=["b_field"])

f = Foo(1)
assert '{"AField":1}' == serde.json.to_json(f)
ff = serde.json.from_json(Foo, '{"b_field":1}') # alias is not renamed
assert f == ff


def test_default_and_alias():
@serde.serde
class Foo:
Expand Down

0 comments on commit fead102

Please sign in to comment.