测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | FAIL |
| 代码长度 | 693 字符 |
模型生成的代码 (693 字符)
def max_val(lst):
"""
Find the maximum numeric value in a heterogeneous list.
The function iterates over the list, extracts all elements that are
numbers (int or float), and returns the largest one.
Args:
lst: A list that may contain elements of any type.
Returns:
The maximum numeric value found in the list.
Raises:
ValueError: If the list contains no numeric elements.
"""
# Extract all elements that are instances of int or float
numbers = [x for x in lst if isinstance(x, (int, float))]
if not numbers:
raise ValueError("No numeric values found in the list.")
return max(numbers)
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
[['3.14', False, 7.5]]