Add __eq__ method to assertion comparison example

This makes the example make more sense, because now Foo(1) == Foo(1) is
true. Fixes #411
This commit is contained in:
Ben Webb 2015-09-21 14:23:26 +01:00
parent 8fe5c704e3
commit 622e64320a
1 changed files with 4 additions and 1 deletions

View File

@ -200,7 +200,10 @@ now, given this test module::
# content of test_foocompare.py
class Foo:
def __init__(self, val):
self.val = val
self.val = val
def __eq__(self, other):
return self.val == other.val
def test_compare():
f1 = Foo(1)