Tests for Deprecate SparseArray for python 3.6 and 3.7 and fixes to other deprecation tests
- [x] closes #30642
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry
   - N/A

Turns out that the existing tests were not testing deprecation correctly for both python 3.7 and python 3.6, so had to change some of the code in `test_api.py` to make that work right.

For `pd.SparseArray` in python 3.6, we can only issue a warning when the constructor `pd.SparseArray` is used.  But this is consistent with `pd.datetime` and `pd.np` with python 3.6, which will issue warnings when things like `pd.datetime.now()` are called.  However, for python 3.6, I could not figure out a way to issue a warning on `pd.datetime(2015, 10, 11, 0, 0)`, so we may just have to live with that.  


