| Total Complexity | 5 |
| Total Lines | 20 |
| Duplicated Lines | 0 % |
| 1 | __author__ = "Jon Reid" |
||
| 8 | class IsSame(BaseMatcher): |
||
| 9 | |||
| 10 | def __init__(self, object): |
||
| 11 | self.object = object |
||
| 12 | |||
| 13 | def _matches(self, item): |
||
| 14 | return item is self.object |
||
| 15 | |||
| 16 | def describe_to(self, description): |
||
| 17 | description.append_text('same instance as ') \ |
||
| 18 | .append_text(hex(id(self.object))) \ |
||
| 19 | .append_text(' ') \ |
||
| 20 | .append_description_of(self.object) |
||
| 21 | |||
| 22 | def describe_mismatch(self, item, mismatch_description): |
||
| 23 | mismatch_description.append_text('was ') |
||
| 24 | if item is not None: |
||
| 25 | mismatch_description.append_text(hex(id(item))) \ |
||
| 26 | .append_text(' ') |
||
| 27 | mismatch_description.append_description_of(item) |
||
| 28 | |||
| 40 |