diff --git a/py/dict.go b/py/dict.go index 94974a00..25bdd3b2 100644 --- a/py/dict.go +++ b/py/dict.go @@ -169,6 +169,9 @@ func (a StringDict) M__ne__(other Object) (Object, error) { if err != nil { return nil, err } + if res == NotImplemented { + return res, nil + } if res == True { return False, nil } diff --git a/py/tests/dict.py b/py/tests/dict.py index 418792a4..c63e8a4a 100644 --- a/py/tests/dict.py +++ b/py/tests/dict.py @@ -33,4 +33,15 @@ assert a.__contains__('hello') assert not a.__contains__('world') +doc="__eq__, __ne__" +a = {'a': 'b'} +assert a.__eq__(3) != True +assert a.__ne__(3) != False +assert a.__ne__(3) != True +assert a.__ne__(3) != False + +assert a.__ne__({}) == True +assert a.__eq__({'a': 'b'}) == True +assert a.__ne__({'a': 'b'}) == False + doc="finished"