TST: GH20676 Verify equals operator for list of Numpy arrays
State: closed

- [x] closes #20676
- [ x ] tests added / passed
- [ x ] passes `black pandas`
- [ x ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ x ] whatsnew entry


Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Algos
description: Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff

Comments:
@simonjayhawkins Moved the Series.equals tests from `generic/test_generic.py` to `series/methods/test_equals.py`. But I think I found a bug while restructuring the tests such that they are in the same style. This raises a ValueError instead of `False`. If this is a bug that should be addressed then I would like to help (if possible given my little experience).

**Code Sample, a copy-pastable example if possible**
```python
arr = np.array([1, 2])
s1 = pd.Series([arr, arr])
s2 = s1.copy()

s1[1] = 9
s1.equals(s2)
```
**Problem description**
Series.qquals operation fails when comparing two Series that have a single value and list at the same position.
```
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
```

**Expected Output**
False

**Output of pd.show_versions()**
INSTALLED VERSIONS
------------------
commit           : 33df25994db637bc9a6988b4493b7db2410310a2
python           : 3.8.3.final.0
python-bits      : 64
OS               : Darwin
OS-release       : 19.5.0
Version          : Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
machine          : x86_64
processor        : i386
byteorder        : little
LC_ALL           : None
LANG             : None
LOCALE           : None.UTF-8

Output of pd.show_versions()
pandas           : 1.1.0.dev0+2090.g33df25994.dirty
numpy            : 1.18.5
pytz             : 2020.1
dateutil         : 2.8.1
pip              : 20.1.1
setuptools       : 49.1.1.post20200710
Cython           : 0.29.21
pytest           : 5.4.3
hypothesis       : 5.19.0
sphinx           : 3.1.1
blosc            : None
feather          : None
xlsxwriter       : 1.2.9
lxml.etree       : 4.5.2
html5lib         : 1.1
pymysql          : None
psycopg2         : None
jinja2           : 2.11.2
IPython          : 7.16.1
pandas_datareader: None
bs4              : 4.9.1
bottleneck       : 1.3.2
fsspec           : 0.7.4
fastparquet      : 0.4.0
gcsfs            : 0.6.2
matplotlib       : 3.2.2
numexpr          : 2.7.1
odfpy            : None
openpyxl         : 3.0.4
pandas_gbq       : None
pyarrow          : 0.17.1
pytables         : None
pyxlsb           : None
s3fs             : 0.4.2
scipy            : 1.5.0
sqlalchemy       : 1.3.18
tables           : 3.6.1
tabulate         : 0.8.7
xarray           : 0.15.1
xlrd             : 1.2.0
xlwt             : 1.3.0
numba            : 0.50.1


> @simonjayhawkins Moved the Series.equals tests from `generic/test_generic.py` to `series/methods/test_equals.py`. But I think I found a bug while restructuring the tests such that they are in the same style. This raises a ValueError instead of `False`. If this is a bug that should be addressed then I would like to help (if possible given my little experience).
> 
> **Code Sample, a copy-pastable example if possible**
> 
> ```python
> arr = np.array([1, 2])
> s1 = pd.Series([arr, arr])
> s2 = s1.copy()
> 
> s1[1] = 9
> s1.equals(s2)
> ```
> 
> **Problem description**
> Series.qquals operation fails when comparing two Series that have a single value and list at the same position.
> 
> ```
> ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
> ```
> 
> **Expected Output**
> False
> 
> ## **Output of pd.show_versions()**
> INSTALLED VERSIONS
> commit : [33df259](https://github.com/pandas-dev/pandas/commit/33df25994db637bc9a6988b4493b7db2410310a2)
> python : 3.8.3.final.0
> python-bits : 64
> OS : Darwin
> OS-release : 19.5.0
> Version : Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64
> machine : x86_64
> processor : i386
> byteorder : little
> LC_ALL : None
> LANG : None
> LOCALE : None.UTF-8
> 
> Output of pd.show_versions()
> pandas : 1.1.0.dev0+2090.g33df25994.dirty
> numpy : 1.18.5
> pytz : 2020.1
> dateutil : 2.8.1
> pip : 20.1.1
> setuptools : 49.1.1.post20200710
> Cython : 0.29.21
> pytest : 5.4.3
> hypothesis : 5.19.0
> sphinx : 3.1.1
> blosc : None
> feather : None
> xlsxwriter : 1.2.9
> lxml.etree : 4.5.2
> html5lib : 1.1
> pymysql : None
> psycopg2 : None
> jinja2 : 2.11.2
> IPython : 7.16.1
> pandas_datareader: None
> bs4 : 4.9.1
> bottleneck : 1.3.2
> fsspec : 0.7.4
> fastparquet : 0.4.0
> gcsfs : 0.6.2
> matplotlib : 3.2.2
> numexpr : 2.7.1
> odfpy : None
> openpyxl : 3.0.4
> pandas_gbq : None
> pyarrow : 0.17.1
> pytables : None
> pyxlsb : None
> s3fs : 0.4.2
> scipy : 1.5.0
> sqlalchemy : 1.3.18
> tables : 3.6.1
> tabulate : 0.8.7
> xarray : 0.15.1
> xlrd : 1.2.0
> xlwt : 1.3.0
> numba : 0.50.1

@avinashpancham can you file a new issue about this on master. thanks.
thanks @avinashpancham