Skip to content

Commit

Permalink
Revert "Merge pull request #309 from rtosholdings/expose-op-methods"
Browse files Browse the repository at this point in the history
This reverts commit fcbf8c0, reversing
changes made to 2b73961.
  • Loading branch information
OrestZborowski-SIG committed Apr 18, 2022
1 parent 6e31067 commit 72cb43a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 92 deletions.
15 changes: 0 additions & 15 deletions riptable/rt_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,13 +1136,6 @@ def __le__(self, lhs):
def __lt__(self, lhs):
return self._dataset_compare_check('__lt__', lhs)

eq = __eq__
ne = __ne__
ge = __ge__
le = __le__
gt = __gt__
lt = __lt__

# ------------------------------------------------------------
def __len__(self):
# Debated October 2019
Expand Down Expand Up @@ -2270,14 +2263,6 @@ def abs(self) -> 'Dataset':
"""
return abs(self)

add = __add__
sub = __sub__
mul = __mul__
div = __truediv__
floordiv = __floordiv__
pow = __pow__
mod = __mod__

@property
def dtypes(self) -> Mapping[str, np.dtype]:
"""
Expand Down
15 changes: 0 additions & 15 deletions riptable/rt_fastarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,21 +1434,6 @@ def __gt__(self, other): return self._compare_check(super().__gt__,other)
def __le__(self, other): return self._compare_check(super().__le__,other)
def __lt__(self, other): return self._compare_check(super().__lt__,other)

eq = __eq__
ne = __ne__
ge = __ge__
le = __le__
gt = __gt__
lt = __lt__

add = np.ndarray.__add__
sub = np.ndarray.__sub__
mul = np.ndarray.__mul__
div = np.ndarray.__truediv__
floordiv = np.ndarray.__floordiv__
pow = np.ndarray.__pow__
mod = np.ndarray.__mod__

#---------------------------------------------------------------------------
def str_append(self, other):
if self.dtype.num == other.dtype.num:
Expand Down
34 changes: 0 additions & 34 deletions riptable/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
import unittest
import re
import keyword
import operator
import pandas as pd


from collections import namedtuple
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
Expand Down Expand Up @@ -2194,38 +2192,6 @@ def test_overwrite_column_with_scalar(self) -> None:
assert_array_equal(col, scalar_value)


@pytest.mark.parametrize('op_name', [
'eq',
'ne',
'ge',
'le',
'gt',
'lt',
'add',
'sub',
'mul',
'floordiv',
])
def test_operator_methods(op_name):
ds = TestDataset.get_arith_dataset()
result = getattr(ds, op_name)(ds)
expected = getattr(operator, op_name)(ds, ds)
assert (result == expected).all(axis=None)


def test_pow_methods():
ds = TestDataset.get_arith_dataset()
result = ds.pow(2)
expected = ds ** 2
assert (result == expected).all(axis=None)


def test_mod_methods():
ds = TestDataset.get_arith_dataset()
result = ds.mod(2)
expected = ds % 2
assert (result == expected).all(axis=None)


@pytest.mark.parametrize('categorical', get_all_categorical_data())
def test_dataset_to_dataframe_roundtripping(categorical):
Expand Down
28 changes: 0 additions & 28 deletions riptable/tests/test_fastarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1678,33 +1678,5 @@ def test_ctor_from_str_obj_array_with_None(as_unicode: bool) -> None:
assert_array_equal(none_results, rt.full(none_results.shape, result.inv, dtype=none_results.dtype))


@pytest.mark.parametrize('op_name', [
'eq',
'ne',
'ge',
'le',
'gt',
'lt',
'add',
'sub',
'mul',
'pow',
'floordiv',
'mod',
])
def test_operator_methods(op_name):
arr = rt.arange(5)
result = getattr(arr, op_name)(2)
expected = getattr(operator, op_name)(arr, 2)
assert_array_equal(result, expected)


def test_div_method():
arr = rt.arange(5)
result = arr.div(2)
expected = arr / 2
assert_array_equal(result, expected)


if __name__ == "__main__":
tester = unittest.main()

0 comments on commit 72cb43a

Please sign in to comment.