'Do some spot checks that str, repr, etc. work as expected.'

def test_str(self):

    lu1 = u.mag(u.Jy)
    assert (str(lu1) == u'mag(Jy)')
    assert (repr(lu1) == u'Unit("mag(Jy)")')
    assert (lu1.to_string(u'generic') == u'mag(Jy)')
    with pytest.raises(ValueError):
        lu1.to_string(u'fits')
    lu2 = u.dex()
    assert (str(lu2) == u'dex')
    assert (repr(lu2) == u'Unit("dex(1)")')
    assert (lu2.to_string() == u'dex(1)')
    lu3 = u.MagUnit(u.Jy, function_unit=(2 * u.mag))
    assert (str(lu3) == u'2    mag(Jy)')
    assert (repr(lu3) == u'MagUnit("Jy",    unit="2    mag")')
    assert (lu3.to_string() == u'2    mag(Jy)')
    lu4 = u.mag(u.ct)
    assert (lu4.to_string(u'generic') == u'mag(ct)')
    assert (lu4.to_string(u'latex') == u'$\\mathrm{mag}$$\\mathrm{\\left(    \\mathrm{ct}    \\right)}$')
    assert (lu4._repr_latex_() == lu4.to_string(u'latex'))
