def __eq__(self, u):
        """ Test unit equality. """
        if not isinstance(u, Unit):
            return False
        return (
            math.isclose(self.base_value, u.base_value)
            and self.dimensions == u.dimensions
        )
def __eq__ ( self , u ) : if not isinstance ( u , Unit ) : return False return ( math . isclose ( self . base_value , u . base_value ) and self . dimensions == u . dimensions )
Test unit equality.