Skip to content

Commit 6073eeb

Browse files
committed
fix: Remove redundancies
1 parent 8736935 commit 6073eeb

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ If you want to apply custom serialization logic to specific columns:
145145
result = item.to_dict(serialize_columns={
146146
'password': lambda v: '***' if v else None,
147147
'email': lambda v: v.lower() if v else None,
148-
'id': lambda v: str(v),
148+
'id': str,
149149
})
150150

151151
# Set default for all instances of a model

tests/test_serialize_columns.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def test_serialize_columns_class_level(get_instance):
66

77
class ClassLevelCustomFlatModel(FlatModel):
88
serialize_columns = {
9-
"id": lambda v: str(v),
9+
"id": str,
1010
"string": lambda v: v.upper() if v else None,
1111
}
1212

@@ -220,7 +220,7 @@ def test_serialize_columns_with_multiple_fields(get_instance):
220220

221221
data = i.to_dict(
222222
serialize_columns={
223-
"id": lambda v: str(v),
223+
"id": str,
224224
"string": lambda v: v.upper() if v else None,
225225
"bool": lambda v: "YES" if v else "NO",
226226
}

0 commit comments

Comments
 (0)