一个函数调用另一个函数的值
from test_get_tokenimport test_token 获取对方函数
def test_container_list():
token = test_token()
url ="http://10.203.198.229:8080/v1/AUTH_admin"
headers = {
"X-Auth-Token":"{token}".format(token=token) 也可以直接写 token 不加“”引起来
}
response = requests.get(url, headers=headers)
print response.status_code
Python format 格式化函数是调用
def assertEqual(param, param1):
code=test_create_container()
if param1==param:
print "要求是{0}.{1} this code is same".format(param, param1 )
或者print "要求是{param}获得参数{param1} this code is same".format(param=param, param1=param1 )