Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tests and fix objobject ne impl
  • Loading branch information
OddCoincidence committed Feb 10, 2019
commit a510aed86aee355a51dcb5e33abb909758621a19
16 changes: 10 additions & 6 deletions tests/snippets/builtin_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@

assert complex(1, -1) == complex(1, -1)
assert complex(1, 0) == 1
assert not complex(1, 1) == 1
assert 1 == complex(1, 0)
assert complex(1, 1) != 1
assert 1 != complex(1, 1)
assert complex(1, 0) == 1.0
assert not complex(1, 1) == 1.0
assert not complex(1, 0) == 1.5
assert 1.0 == complex(1, 0)
assert complex(1, 1) != 1.0
assert 1.0 != complex(1, 1)
assert complex(1, 0) != 1.5
assert not 1.0 != complex(1, 0)
assert bool(complex(1, 0))
assert not complex(1, 2) == complex(1, 1)
# Currently broken - see issue #419
# assert complex(1, 2) != 'foo'
assert complex(1, 2) != complex(1, 1)
assert complex(1, 2) != 'foo'
assert complex(1, 2).__eq__('foo') == NotImplemented

# __neg__
Expand Down
3 changes: 2 additions & 1 deletion vm/src/obj/objobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ fn object_ne(vm: &mut VirtualMachine, args: PyFuncArgs) -> PyResult {
args,
required = [(zelf, Some(vm.ctx.object())), (other, None)]
);
let eq = vm.call_method(zelf, "__eq__", vec![other.clone()])?;

let eq = vm._eq(zelf.clone(), other.clone())?;
objbool::not(vm, &eq)
}

Expand Down