'Test all the unusual conditions for locations of ``Time``
columns in a ``Table``.'

@pytest.mark.parametrize('table_types', (Table, QTable))
def test_time_to_fits_loc(self, table_types):

    t = table_types()
    t['a'] = Time(self.time, format='isot', scale='utc')
    t['b'] = Time(self.time, format='isot', scale='tt')
    t['a'].location = EarthLocation([1, 2], [2, 3], [3, 4])
    with pytest.raises(ValueError) as err:
        (table, hdr) = time_to_fits(t)
    assert ('Vectorized    Location    of    Time    Column' in str(err.value))
    t['a'].location = EarthLocation(1, 2, 3)
    t['b'].location = EarthLocation(2, 3, 4)
    with pytest.raises(ValueError) as err:
        (table, hdr) = time_to_fits(t)
        assert ('Multiple    Time    Columns    with    different    geocentric' in str(err.value))
    t['b'].location = None
    with catch_warnings() as w:
        (table, hdr) = time_to_fits(t)
        assert (len(w) == 1)
        assert str(w[0].message).startswith('Time    Column    "b"    has    no    specified    location,    but    global    Time    Position    is    present')
    t['b'].location = EarthLocation(1, 2, 3)
    with catch_warnings() as w:
        (table, hdr) = time_to_fits(t)
        assert (len(w) == 0)
    for scale in BARYCENTRIC_SCALES:
        t.replace_column('a', getattr(t['a'], scale))
        with catch_warnings() as w:
            (table, hdr) = time_to_fits(t)
            assert (len(w) == 1)
            assert str(w[0].message).startswith('Earth    Location    "TOPOCENTER"    for    Time    Column')
