Skip to content

Commit

Permalink
merge changes from #134
Browse files Browse the repository at this point in the history
  • Loading branch information
rnag committed Nov 9, 2024
2 parents cf2e98c + 7c50897 commit ca0a366
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions dataclass_wizard/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def message(self) -> str:
obj_type=self.name(self.obj_type))

if self.json_object:
self.kwargs['json_object'] = json.dumps(self.json_object)
self.kwargs['json_object'] = json.dumps(self.json_object, default=str)

if self.kwargs:
sep = '\n '
Expand Down Expand Up @@ -168,7 +168,7 @@ def name(obj) -> str:
def message(self) -> str:
msg = self._TEMPLATE.format(
cls=self.class_name,
json_string=json.dumps(self.obj),
json_string=json.dumps(self.obj, default=str),
e=self.base_error,
fields=self.fields,
missing_fields=self.missing_fields)
Expand Down Expand Up @@ -217,7 +217,7 @@ def name(obj) -> str:
def message(self) -> str:
msg = self._TEMPLATE.format(
cls=self.class_name,
json_string=json.dumps(self.obj),
json_string=json.dumps(self.obj, default=str),
fields=self.fields,
json_key=self.json_key)

Expand Down Expand Up @@ -255,7 +255,7 @@ def message(self) -> str:
msg = self._TEMPLATE.format(
cls=self.class_name,
nested_cls=self.nested_class_name,
json_string=json.dumps(self.obj),
json_string=json.dumps(self.obj, default=str),
field=self.field_name,
o=self.obj,
)
Expand Down
2 changes: 1 addition & 1 deletion dataclass_wizard/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __contains__(self, item) -> bool:
type. Checks that the item is incorporated in the given expected values of
the Literal.
"""
return item in self.value_to_type.keys()
return item in self.value_to_type

def __call__(self, o: Any) -> M:
"""
Expand Down

0 comments on commit ca0a366

Please sign in to comment.