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

This is a unit test for an already fixed problem.

thanks @acarl005 !