def METHOD_NAME(field, arg, test_invalid_unit):
    @quantity_to_dataclass(x=(field, sbd.DataClass))
    def test(x):
        return x[field]
    assert all(test(arg) == arg)
    with pytest.raises(FieldError):
        test(1 * u.Unit(test_invalid_unit))