Try to match a single dict with the supplied arguments. Keys whose values are strings and which are in self._partial_matches will be checked for partial (i.e. substring) matches. You can extend this scheme to (for example) do regular expression matching, etc.
(self, d, **kwargs)
| 1555 | _partial_matches = ('msg', 'message') |
| 1556 | |
| 1557 | def matches(self, d, **kwargs): |
| 1558 | """ |
| 1559 | Try to match a single dict with the supplied arguments. |
| 1560 | |
| 1561 | Keys whose values are strings and which are in self._partial_matches |
| 1562 | will be checked for partial (i.e. substring) matches. You can extend |
| 1563 | this scheme to (for example) do regular expression matching, etc. |
| 1564 | """ |
| 1565 | result = True |
| 1566 | for k in kwargs: |
| 1567 | v = kwargs[k] |
| 1568 | dv = d.get(k) |
| 1569 | if not self.match_value(k, dv, v): |
| 1570 | result = False |
| 1571 | break |
| 1572 | return result |
| 1573 | |
| 1574 | def match_value(self, k, dv, v): |
| 1575 | """ |
no test coverage detected