测试评估
| 指标 | 结果 |
|---|---|
| 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]]