Skip to content

Commit 0b6bd5f

Browse files
committed
Attempting to fix tests
1 parent 3fe5c50 commit 0b6bd5f

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

src/betterproto/__init__.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
b64decode,
1212
b64encode,
1313
)
14-
from copy import deepcopy, copy
14+
from copy import deepcopy
1515
from datetime import (
1616
datetime,
1717
timedelta,
@@ -894,7 +894,7 @@ def __copy__(self: T, _: Any = {}) -> T:
894894
for name in self._betterproto.sorted_field_names:
895895
value = self.__raw_get(name)
896896
if value is not PLACEHOLDER:
897-
kwargs[name] = copy(value)
897+
kwargs[name] = value
898898
return self.__class__(**kwargs) # type: ignore
899899

900900
@property
@@ -1136,12 +1136,10 @@ def __getstate__(self) -> bytes:
11361136
return bytes(self)
11371137

11381138
def __setstate__(self: T, pickled_bytes: bytes) -> T:
1139-
new = self.parse(pickled_bytes)
1140-
new.__post_init__()
1141-
return new
1139+
return self.parse(pickled_bytes)
11421140

11431141
def __reduce__(self) -> Union[str, Tuple[Any, ...]]:
1144-
return (self.__class__, (self.to_dict(),))
1142+
return (self.__class__.FromString, (bytes(self),))
11451143

11461144
@classmethod
11471145
def _type_hint(cls, field_name: str) -> Type:

tests/test_features.py

-1
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,6 @@ def test_equality_comparison():
743743
assert msg != TestMessage(value=False)
744744

745745

746-
747746
@dataclass
748747
class PickleMessage(betterproto.Message):
749748
foo: bool = betterproto.bool_field(1)

0 commit comments

Comments
 (0)