Repository: pandas-dev/pandas
Pull request: Update test_period_range.py
Attempting to implement test for resolved issue #21793

- [x] closes #21793

Problem statement:
BUG: PeriodIndex comparisons break on listlike
```
idx = pd.period_range('2016', periods=3, freq='M')

>>> idx == idx.values
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/pandas/core/indexes/period.py", line 107, in wrapper
    other = Period(other, freq=self.freq)
  File "pandas/_libs/tslibs/period.pyx", line 1777, in pandas._libs.tslibs.period.Period.__new__
TypeError: unhashable type: 'numpy.ndarray'
```

Hints from issue discussion:
This looks to work on master now. Could use a test

```
In [56]: pd.__version__
Out[56]: '1.1.0.dev0+1536.ga7fb88fd5'

In [57]: idx == idx.values
Out[57]: array([ True,  True,  True])
```

Commit message: Update test_period_range.py

added comment above test for resolved issue #21793

Patch to review:
diff --git a/pandas/tests/indexes/period/test_period_range.py b/pandas/tests/indexes/period/test_period_range.py
index 2c3d22198df9f..0a8a9964dfc59 100644
--- a/pandas/tests/indexes/period/test_period_range.py
+++ b/pandas/tests/indexes/period/test_period_range.py
@@ -51,6 +51,11 @@ def test_construction_from_period(self):
         result = period_range(start=start, end=end, freq="Q", name="foo")
         tm.assert_index_equal(result, expected)
 
+        #test for issue #21793
+        idx = period_range(start=start, end=end, freq="Q", name="foo")
+        result = idx == idx.values
+        assert result.all()
+
         # empty
         expected = PeriodIndex([], freq="W", name="foo")
 


Code review comments:
diff_hunk: @@ -51,6 +51,11 @@ def test_construction_from_period(self):
         result = period_range(start=start, end=end, freq="Q", name="foo")
         tm.assert_index_equal(result, expected)
 
+        #test for issue #21793
+        idx = period_range(start=start, end=end, freq="Q", name="foo")
+        result = idx == idx.values
+        assert result.all()
path: pandas/tests/indexes/period/test_period_range.py
text: @user1:
Could you construct the expected result and use `tm.assert_numpy_array_equal` instead?

```
result = idx == idx.values
expected = np.array(...)
tm.assert_numpy_array_equal(result, expected)
```