Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add inverse to test_datetime64tz_aware
  • Loading branch information
h-vetinari committed Feb 2, 2019
commit c089f1fb6fb5036cb2e93c375fff6a1f66ebaf88
14 changes: 14 additions & 0 deletions pandas/tests/test_algos.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,20 @@ def test_datetime64tz_aware(self, method, box):
result = method(obj)
assert_series_or_index_or_array_or_categorical_equal(result, expected)

if method == pd.unique:
# [Series/Index].unique do not yet support return_inverse=True

# reuse result as expected outcome of return_inverse case
expected_uniques = result.copy()
result_uniques, result_inverse = method(obj, return_inverse=True)

assert_series_or_index_or_array_or_categorical_equal(
result_uniques, expected_uniques)

# reconstruction can only work if inverse is correct
reconstr = box(result_uniques[result_inverse])
assert_series_or_index_or_array_or_categorical_equal(reconstr, obj)

def test_order_of_appearance(self):
# 9346
# light testing of guarantee of order of appearance
Expand Down