Skip to content

Commit

Permalink
Merge pull request beeware#633 from amymok/inplace-complex
Browse files Browse the repository at this point in the history
Implemented Inplace modulo with complex type
  • Loading branch information
freakboy3742 authored Aug 18, 2017
2 parents 229c089 + fcbbc86 commit cd3bc6c
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 33 deletions.
6 changes: 5 additions & 1 deletion python/common/org/python/types/Object.java
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,11 @@ public org.python.Object __imod__(org.python.Object other) {
this.setValue(this.__mod__(other));
return this;
} catch (org.python.exceptions.TypeError e) {
throw new org.python.exceptions.TypeError("unsupported operand type(s) for %=: '" + this.typeName() + "' and '" + other.typeName() + "'");
if (other instanceof org.python.types.Complex) {
throw new org.python.exceptions.TypeError("can't mod complex numbers.");
} else {
throw new org.python.exceptions.TypeError("unsupported operand type(s) for %=: '" + this.typeName() + "' and '" + other.typeName() + "'");
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions tests/datatypes/test_NoneType.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class InplaceNoneTypeOperationTests(InplaceOperationTestCase, TranspileTestCase)
data_type = 'None'

not_implemented = [
'test_modulo_complex',

'test_multiply_bytes',
'test_multiply_bytearray',
'test_multiply_list',
Expand Down
2 changes: 0 additions & 2 deletions tests/datatypes/test_NotImplemented.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ class InplaceNotImplementedOperationTests(InplaceOperationTestCase, TranspileTes
'test_lt_complex',
'test_lt_frozenset',

'test_modulo_complex',

'test_multiply_bytes',
'test_multiply_bytearray',
'test_multiply_list',
Expand Down
1 change: 0 additions & 1 deletion tests/datatypes/test_bool.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class InplaceBoolOperationTests(InplaceOperationTestCase, TranspileTestCase):
'test_floor_divide_int',

'test_modulo_bool',
'test_modulo_complex',
'test_modulo_float',
'test_modulo_int',

Expand Down
1 change: 0 additions & 1 deletion tests/datatypes/test_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ class InplaceComplexOperationTests(InplaceOperationTestCase, TranspileTestCase):
'test_modulo_bytearray',
'test_modulo_bytes',
'test_modulo_class',
'test_modulo_complex',
'test_modulo_dict',
'test_modulo_float',
'test_modulo_frozenset',
Expand Down
4 changes: 0 additions & 4 deletions tests/datatypes/test_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,3 @@ class BinaryDictOperationTests(BinaryOperationTestCase, TranspileTestCase):

class InplaceDictOperationTests(InplaceOperationTestCase, TranspileTestCase):
data_type = 'dict'

not_implemented = [
'test_modulo_complex',
]
2 changes: 0 additions & 2 deletions tests/datatypes/test_float.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ class InplaceFloatOperationTests(InplaceOperationTestCase, TranspileTestCase):
not_implemented = [
'test_add_complex',

'test_modulo_complex',

'test_multiply_bytearray',
'test_multiply_bytes',
'test_multiply_class',
Expand Down
4 changes: 0 additions & 4 deletions tests/datatypes/test_frozenset.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,3 @@ class BinaryFrozensetOperationTests(BinaryOperationTestCase, TranspileTestCase):

class InplaceFrozensetOperationTests(InplaceOperationTestCase, TranspileTestCase):
data_type = 'frozenset'

not_implemented = [
'test_modulo_complex',
]
2 changes: 0 additions & 2 deletions tests/datatypes/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,4 @@ class InplaceListOperationTests(InplaceOperationTestCase, TranspileTestCase):
'test_add_range',
'test_add_set',
'test_add_str',

'test_modulo_complex',
]
4 changes: 0 additions & 4 deletions tests/datatypes/test_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,3 @@ class BinaryRangeOperationTests(BinaryOperationTestCase, TranspileTestCase):

class InplaceRangeOperationTests(InplaceOperationTestCase, TranspileTestCase):
data_type = 'range'

not_implemented = [
'test_modulo_complex',
]
4 changes: 0 additions & 4 deletions tests/datatypes/test_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,3 @@ class BinarySetOperationTests(BinaryOperationTestCase, TranspileTestCase):
class InplaceSetOperationTests(InplaceOperationTestCase, TranspileTestCase):
data_type = 'set'

not_implemented = [
'test_modulo_complex',

]
2 changes: 0 additions & 2 deletions tests/datatypes/test_slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,6 @@ class InplaceSliceOperationTests(InplaceOperationTestCase, TranspileTestCase):
data_type = 'slice'

not_implemented = [
'test_modulo_complex',

'test_multiply_bytearray',
'test_multiply_bytes',
'test_multiply_list',
Expand Down
4 changes: 0 additions & 4 deletions tests/datatypes/test_tuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,3 @@ class BinaryTupleOperationTests(BinaryOperationTestCase, TranspileTestCase):

class InplaceTupleOperationTests(InplaceOperationTestCase, TranspileTestCase):
data_type = 'tuple'

not_implemented = [
'test_modulo_complex',
]

0 comments on commit cd3bc6c

Please sign in to comment.