Hamcrest matchers for Protocol Buffers in Python.
This is forked from proto-matcher which was no longer receiving updates and which was itself based on MessageDifferencer and EqualsProto googletest matcher.
This packages provides the following proto-related matchers:
equals_proto(message: Union[Message, str])
Test the argument equals the given protobuf message.
approximately(proto_matcher: Matcher[Message],
float_margin: Optional[float] = None,
float_fraction: Optional[float] = None)
Test the argument equals the given protobuf message, while comparing any float field using approximation.
ignoring_field_paths(field_paths: Set[Tuple[str]],
matcher: _ProtoMatcher)
Test the argument equals the given protobuf message, while ignoring those fields specified in the field paths.
ignoring_repeated_field_ordering(proto_matcher: Matcher[Message])
Test the argument equals the given protobuf message, ignoring the ordering of any repeated field.
partially(proto_matcher: Matcher[Message])
Test the argument partially equals the given protobuf message, i.e. if a field is in the argument but not in the expected message, it's ignored in the comparsion.