Skip to content

Commit 3470df5

Browse files
Address recursive message PR notes
- Uses `is not` to compare types in `Message.__eq__` - Adds a space after each comma in `Message.__repr__`
1 parent ccf9337 commit 3470df5

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/betterproto/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ def __raw_get(self, name: str) -> Any:
536536
return super().__getattribute__(name)
537537

538538
def __eq__(self, other):
539-
if type(self) != type(other):
539+
if type(self) is not type(other):
540540
return False
541541

542542
equal = True
@@ -564,7 +564,7 @@ def __repr__(self):
564564
if value is PLACEHOLDER:
565565
continue
566566
found = True
567-
parts.extend([field_name, "=", repr(value), ","])
567+
parts.extend([field_name, "=", repr(value), ", "])
568568

569569
if found:
570570
parts.pop()

tests/test_features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,5 +341,5 @@ def test_message_repr():
341341
assert repr(RecursiveMessage(foo=1)) == "RecursiveMessage(foo=1)"
342342
assert (
343343
repr(RecursiveMessage(child=RecursiveMessage(), foo=1))
344-
== "RecursiveMessage(child=RecursiveMessage(),foo=1)"
344+
== "RecursiveMessage(child=RecursiveMessage(), foo=1)"
345345
)

0 commit comments

Comments
 (0)