测试评估
| 指标 | 结果 |
|---|---|
| Base 测试 | PASS |
| Plus 测试 | PASS |
| 代码长度 | 389 字符 |
模型生成的代码 (389 字符)
import cmath
def convert(z):
"""
Convert a complex number to its polar coordinates.
Parameters
----------
z : complex
A complex number.
Returns
-------
tuple
A tuple (r, theta) where r is the magnitude (absolute value)
and theta is the phase angle in radians.
"""
r = abs(z)
theta = cmath.phase(z)
return (r, theta)
Base 失败测试用例
- 无失败测试
Plus 失败测试用例
- 无失败测试