Mbpp/278

⚠️ Base 通过 / Plus 失败 Base: PASS Plus: FAIL
测试评估
指标结果
Base 测试PASS
Plus 测试FAIL
代码长度623 字符
模型生成的代码 (623 字符)
def count_first_elements(tup):
    """
    Returns the number of elements that occur before the first tuple element in the given tuple.

    Args:
        tup: A tuple that may contain other tuples as elements.

    Returns:
        The index (0-based) of the first element that is itself a tuple, which equals
        the count of elements before it. If no tuple element is found, returns the length
        of the input tuple.
    """
    for i, item in enumerate(tup):
        if isinstance(item, tuple):
            return i
    # If no tuple element is present, return the total number of elements.
    return len(tup)
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • [[1, 2, 3, 4, 5, 6]]