Skip to content

Commit

Permalink
Supports integers in float fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Mokto authored and eigenein committed Feb 15, 2023
1 parent 28f8477 commit 70ad76f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pure_protobuf/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class FloatSerializer(Serializer):
wire_type = WireType.LONG

def validate(self, value: Any):
if not isinstance(value, float):
if not isinstance(value, float) and not isinstance(value, int):
raise ValueError("a floating-point value is expected")

def dump(self, value: Any, io: IO):
Expand All @@ -363,7 +363,7 @@ class DoubleSerializer(Serializer):
wire_type = WireType.LONG_LONG

def validate(self, value: Any):
if not isinstance(value, float):
if not isinstance(value, float) and not isinstance(value, int):
raise ValueError("a floating-point value is expected")

def dump(self, value: Any, io: IO):
Expand Down

0 comments on commit 70ad76f

Please sign in to comment.