userver: testsuite.protobuf.matching.ProtobufDict Class Reference
Loading...
Searching...
No Matches
testsuite.protobuf.matching.ProtobufDict Class Reference

Detailed Description

Strict protobuf matcher.

Compares a protobuf message against an expected dict by converting the message via :py:func:testsuite.protobuf.utils.message_to_dict and requiring the resulting dict to equal the expected one exactly.

Every field present in the message must appear in the expected dict (and vice versa). For partial matching where extra protobuf fields should be ignored, use :py:class:PartialProtobufDict or :py:func:RecursivePartialProtobufDict instead.

Example:

.. code-block:: python

assert msg == matching.ProtobufDict({ 'first_name': 'John', 'last_name': 'Doe', 'status': 'STATUS_ACTIVE', })

Definition at line 25 of file matching.py.

Inheritance diagram for testsuite.protobuf.matching.ProtobufDict:

Public Member Functions

 __init__ (self, dict d)
 __repr__ (self)
 __eq__ (self, other)

Protected Attributes

 _repr = repr
 _impl = impl

Constructor & Destructor Documentation

◆ __init__()

testsuite.protobuf.matching.ProtobufDict.__init__ ( self,
dict d )

Definition at line 50 of file matching.py.

Member Function Documentation

◆ __eq__()

testsuite.protobuf.matching.ProtobufDictsImpl.__eq__ ( self,
other )
inherited

Definition at line 17 of file matching.py.

◆ __repr__()

testsuite.protobuf.matching.ProtobufDictsImpl.__repr__ ( self)
inherited

Definition at line 14 of file matching.py.

Member Data Documentation

◆ _impl

testsuite.protobuf.matching.ProtobufDictsImpl._impl = impl
protectedinherited

Definition at line 12 of file matching.py.

◆ _repr

testsuite.protobuf.matching.ProtobufDictsImpl._repr = repr
protectedinherited

Definition at line 11 of file matching.py.


The documentation for this class was generated from the following file: