Skip to content

Commit 86362fd

Browse files
Tests and fix objobject ne impl
1 parent afb1ad8 commit 86362fd

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/snippets/builtin_complex.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
assert complex(1, 0) == 1.0
1515
assert 1.0 == complex(1, 0)
1616
assert complex(1, 1) != 1.0
17+
assert 1.0 != complex(1, 1)
1718
assert complex(1, 0) != 1.5
19+
assert not 1.0 != complex(1, 0)
1820
assert bool(complex(1, 0))
1921
assert complex(1, 2) != complex(1, 1)
20-
# Currently broken - see issue #419
21-
# assert complex(1, 2) != 'foo'
22+
assert complex(1, 2) != 'foo'
2223
assert complex(1, 2).__eq__('foo') == NotImplemented
2324

2425
# __neg__

vm/src/obj/objobject.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ fn object_ne(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
4040
args,
4141
required = [(zelf, Some(vm.ctx.object())), (other, None)]
4242
);
43-
let eq = vm.call_method(zelf, "__eq__", vec![other.clone()])?;
43+
44+
let eq = vm._eq(zelf.clone(), other.clone())?;
4445
objbool::not(vm, &eq)
4546
}
4647

0 commit comments

Comments
 (0)