add LogEntry.__eq__
This commit is contained in:
parent
864073f700
commit
e8f836425a
|
@ -4,6 +4,11 @@ class LogEntry:
|
|||
self.msg = msg
|
||||
self.level = level
|
||||
|
||||
def __eq__(self, other):
|
||||
if isinstance(other, LogEntry):
|
||||
return self.__dict__ == other.__dict__
|
||||
return False
|
||||
|
||||
def __repr__(self):
|
||||
return "LogEntry({}, {})".format(self.msg, self.level)
|
||||
|
||||
|
|
|
@ -4,3 +4,8 @@ from mitmproxy import log
|
|||
def test_logentry():
|
||||
e = log.LogEntry("foo", "info")
|
||||
assert repr(e) == "LogEntry(foo, info)"
|
||||
|
||||
f = log.LogEntry("foo", "warning")
|
||||
assert e == e
|
||||
assert e != f
|
||||
assert e != 42
|
||||
|
|
Loading…
Reference in New Issue