python 自定义断言


     #判断返回结果是否包含预期结果
    def is_contain(self,str_one,str_two):#判断str_one是否包含于str_two
        flag=None
        try:
            str_one.index(str_two)>1
        except:
            print('PASS!')
            flag=False
        return flag

     #判断两个字典是否相等
    def is_equal_dict(self,dict_one,dict_two):#判断两个字典值是否相等

        if isinstance(dict_one,dict_two):
            print('haha')
            dict_one =json.loads(dict_one)#str转成dict
            print(dict_two)
        else:
            print('oo')
        print(operator.eq(dict_one,dict_two))

 

 
posted @ 2019-06-08 23:57  行走的小z  阅读(542)  评论(0编辑  收藏  举报