Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xinrong-meng committed Mar 31, 2021
1 parent 8279d16 commit 1beaa6f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions databricks/koalas/tests/indexes/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,11 @@ def test_arithmetic_op_exceptions(self):
self.assertRaisesRegex(TypeError, expected_err_msg, lambda: kidx % other)
self.assertRaisesRegex(TypeError, expected_err_msg, lambda: other % kidx)

for other in [1, 0.1, py_datetime]:
expected_err_msg = "datetime subtraction can only be applied to datetime series."
expected_err_msg = "datetime subtraction can only be applied to datetime series."

for other in [1, 0.1]:
self.assertRaisesRegex(TypeError, expected_err_msg, lambda: kidx - other)
self.assertRaisesRegex(TypeError, expected_err_msg, lambda: other - kidx)

self.assertRaisesRegex(TypeError, expected_err_msg, lambda: kidx - other)
self.assertRaises(NotImplementedError, lambda: py_datetime - kidx)
8 changes: 5 additions & 3 deletions databricks/koalas/tests/test_series_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ def test_arithmetic_op_exceptions(self):
self.assertRaisesRegex(TypeError, expected_err_msg, lambda: kser % other)
self.assertRaisesRegex(TypeError, expected_err_msg, lambda: other % kser)

ks.set_option("compute.ops_on_diff_frames", True)
for other in [1, 0.1, py_datetime]:
expected_err_msg = "datetime subtraction can only be applied to datetime series."
expected_err_msg = "datetime subtraction can only be applied to datetime series."

for other in [1, 0.1]:
self.assertRaisesRegex(TypeError, expected_err_msg, lambda: kser - other)
self.assertRaisesRegex(TypeError, expected_err_msg, lambda: other - kser)

self.assertRaisesRegex(TypeError, expected_err_msg, lambda: kser - other)
self.assertRaises(NotImplementedError, lambda: py_datetime - kser)

def test_date_subtraction(self):
Expand Down

0 comments on commit 1beaa6f

Please sign in to comment.