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!
As it is yes, because I thought that the test should only worry about the standard version of the package i.e. the one you don't specify any options. To build macvim without python you have to add --without-python, but adding a check wouldn't be hard.

Is there a way to know what options were used to install a package? If not, we may just check if the output of otool is empty, that means macvim wasn't built with Python support.