Skip to content
This repository has been archived by the owner on May 31, 2020. It is now read-only.

implemented floor divide operator for a complex number #447

Merged
merged 1 commit into from Feb 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion batavia/types/Tuple.js
Expand Up @@ -237,7 +237,13 @@ Tuple.prototype.__div__ = function(other) {
}

Tuple.prototype.__floordiv__ = function(other) {
throw new exceptions.TypeError.$pyclass("unsupported operand type(s) for //: 'tuple' and '" + type_name(other) + "'")
var types = require('../types')

if (types.isinstance(other, types.Complex)) {
throw new exceptions.TypeError.$pyclass("can't take floor of complex number.")
} else {
throw new exceptions.TypeError.$pyclass("unsupported operand type(s) for //: 'tuple' and '" + type_name(other) + "'")
}
}

Tuple.prototype.__truediv__ = function(other) {
Expand Down
2 changes: 0 additions & 2 deletions tests/datatypes/test_tuple.py
Expand Up @@ -133,8 +133,6 @@ class BinaryTupleOperationTests(BinaryOperationTestCase, TranspileTestCase):
data_type = 'tuple'

not_implemented = [
'test_floor_divide_complex',

'test_modulo_complex',

'test_multiply_int',
Expand Down