Skip to content

Commit 60e853c

Browse files
HyeockJinKimncw
authored andcommitted
__ne__ of dict return NotImplemented
1 parent f3df7a4 commit 60e853c

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

py/dict.go

+3
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ func (a StringDict) M__ne__(other Object) (Object, error) {
193193
if err != nil {
194194
return nil, err
195195
}
196+
if res == NotImplemented {
197+
return res, nil
198+
}
196199
if res == True {
197200
return False, nil
198201
}

py/tests/dict.py

+11
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,15 @@
4141
assert a.__contains__('hello')
4242
assert not a.__contains__('world')
4343

44+
doc="__eq__, __ne__"
45+
a = {'a': 'b'}
46+
assert a.__eq__(3) != True
47+
assert a.__ne__(3) != False
48+
assert a.__ne__(3) != True
49+
assert a.__ne__(3) != False
50+
51+
assert a.__ne__({}) == True
52+
assert a.__eq__({'a': 'b'}) == True
53+
assert a.__ne__({'a': 'b'}) == False
54+
4455
doc="finished"

0 commit comments

Comments
 (0)