Fixed Macvim linking with brewed Python + tests

This should fix issue #31901.

I also added a test to both macvim and vim formula to test they link to the correct version of Python
First time coding in ruby so if you have any advice or corrections please let me know!
Yes, it passes both with Homebrew python and System python. It should also work with any other Python installation, but I haven't tried.