TST: add tests to validate margin results for pivot (#25815)
- [x ] closes #25815
- [x ] tests added / passed
- [x ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

see #27233 for details on black code style to resolve the CI failure.