This Is a Certified Answer

Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
Usually magnetic materials are also electrically conducting. Static electric charges could be induced in the magnets we are testing. Then opposite charges will attract each other towards themselves.  The gravitational force of attraction also attracts objects.

If two objects repel like north pole - north pole then we know for sure that the repelling force is due to magnetism only.  If two objects attract, that could be other attractions, then we cannot say it is due to magnetism only.

This is because repulsion can only take place between two magnets, but attraction can happen with two magnets and a magnet with some other magnetic materials...