Electricity and magnetism are said to be inter-related to each other. A current carrying conductor has a magnetic field around it. So, when a compass is brought near to it, we can observe a deflection in the compass. Similarly, a battery is the source of the electric current. What will be the deflection, when we bring a compass near a 3 V cell (battery)?
The needle will show no deflection and point towards geographical north.
A battery is a source of current. But there is no current flowing inside a battery, only charge separation. Hence, there would be no magnetic field around it, so the compass will not show any deflection.