Mbpp/785

⚠️ Base 通过 / Plus 失败 Base: PASS Plus: FAIL
测试评估
指标结果
Base 测试PASS
Plus 测试FAIL
代码长度640 字符
模型生成的代码 (640 字符)
def tuple_str_int(s: str) -> tuple:
    """
    Convert a string representation of a tuple of integers into an actual tuple of integers.
    
    Args:
        s (str): A string like "(7, 8, 9)".
    
    Returns:
        tuple: Tuple of integers.
    
    Example:
        >>> tuple_str_int("(7, 8, 9)")
        (7, 8, 9)
    """
    # Strip parentheses and any surrounding whitespace
    s = s.strip()
    if s.startswith('(') and s.endswith(')'):
        s = s[1:-1]
    # Handle empty tuple
    if not s.strip():
        return ()
    # Split by commas and convert each part to int
    return tuple(int(x.strip()) for x in s.split(','))
Base 失败测试用例
  • 无失败测试
Plus 失败测试用例
  • ['((7, 8, 9)']