def testFunOrder(x, y):
xs = re.findall(r"(d+)", x)
ys = re.findall(r"(d+)", y)
if len(xs) > 0 and len(ys) > 0:
return int(xs[0]) - int(ys[0])
else:
return (x > y) - (x < y)
unittest.TestLoader.sortTestMethodsUsing = staticmethod(testFunOrder)
效果为 按照方法中第一个数字从小到大执行



