Merge branch 'master_gh'

This commit is contained in:
Georg K 2023-08-11 02:56:45 +03:00
commit 0fda2cc05d
2 changed files with 14 additions and 1 deletions

View File

@ -651,7 +651,7 @@ class Message(ABC):
def __eq__(self, other) -> bool:
if type(self) is not type(other):
return False
return NotImplemented
for field_name in self._betterproto.meta_by_field_name:
self_val = self.__raw_get(field_name)

View File

@ -18,6 +18,7 @@ from typing import (
List,
Optional,
)
from unittest.mock import ANY
import pytest
@ -727,3 +728,15 @@ def test_is_set():
assert not Spam().is_set("bar")
assert Spam(foo=True).is_set("foo")
assert Spam(foo=True, bar=0).is_set("bar")
def test_equality_comparison():
from tests.output_betterproto.bool import Test as TestMessage
msg = TestMessage(value=True)
assert msg == msg
assert msg == ANY
assert msg == TestMessage(value=True)
assert msg != 1
assert msg != TestMessage(value=False)