Skip to content

Commit

Permalink
undid my change in pandas/core/ops/__init__.py and handle the case di…
Browse files Browse the repository at this point in the history
…fferently in pandas/tests/base/test_ops.py
  • Loading branch information
SaturnFromTitan committed Jan 27, 2020
1 parent 452335a commit 8bf1142
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pandas/core/ops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def _get_opstr(op):
rtruediv: "/",
operator.floordiv: "//",
rfloordiv: "//",
operator.mod: "%",
operator.mod: None, # TODO: Why None for mod but '%' for rmod?
rmod: "%",
operator.pow: "**",
rpow: "**",
Expand Down
11 changes: 8 additions & 3 deletions pandas/tests/base/test_ops.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from datetime import datetime, timedelta
from io import StringIO
import operator
import sys
from typing import Any

Expand Down Expand Up @@ -86,9 +87,13 @@ def setup_method(self, method):

@pytest.mark.parametrize("klass", [Series, DataFrame])
def test_binary_ops_docs(klass, all_arithmetic_functions):
operator = all_arithmetic_functions
operator_name = _get_op_name(operator, special=False)
operator_symbol = _get_opstr(operator)
op = all_arithmetic_functions
operator_name = _get_op_name(op, special=False)
if op is operator.mod:
# _get_opstr returns 'None' for this operator
operator_symbol = "%"
else:
operator_symbol = _get_opstr(op)
is_reverse = operator_name.startswith("r")

operand1 = klass.__name__.lower()
Expand Down

0 comments on commit 8bf1142

Please sign in to comment.