当前位置: 首页 > news >正文

长春有免费做网站的么网络推广文案

长春有免费做网站的么,网络推广文案,做外贸的物流网站有哪些,国内做的好看的网站背景:之前写的接口测试一直没有支持无限嵌套对比key,上次testerhome逛论坛,有人分享了他的框架,看了一下,有些地方不合适我这边自己修改了一下,部署在jenkins上跑完效果还不错,拿出来分享一下。…

背景:之前写的接口测试一直没有支持无限嵌套对比key,上次testerhome逛论坛,有人分享了他的框架,看了一下,有些地方不合适我这边自己修改了一下,部署在jenkins上跑完效果还不错,拿出来分享一下。ps:还是要多看看别人写的,新学了不少python自带的一些常用方法。

这次直接上代码,下面写一下这次我新学一些方法和思路。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

def check_response_hope_key(self,response={},hope_response={}):

  temp_data={}

  for n1 in hope_response:

   print "n1:",n1

   #如果值是字典类型

   if isinstance(hope_response[n1],dict):

    print "dict"

    if not Check_Response_Hope().check_response_hope_key(response=response.get(n1), hope_response=hope_response[n1]):

     MailFile().checkfail(response=response.get(n1), hope_response=hope_response[n1])

     return False

     raise '{},{}'.format(hope_response[n1],response[n1])

    

   #如果值是列表类型

   elif isinstance(hope_response[n1],list):

    print "list"

    for hope_index,hope_listValue in enumerate(hope_response[n1]):

     #print "hope_index:",hope_index

     #print "hope_listValue:",hope_listValue

     for response_index,response_listValue in enumerate(response[n1]):

      #print "response_index:",response_index

      #print "response_listValue:",response_listValue

      if isinstance(hope_listValue,dict):

       Check_Response_Hope().check_response_hope_key(response=response[n1][response_index],

hope_response=hope_response[n1][response_index])

      elif isinstance(hope_listValue,list):

       if hope_response[n1][hope_index]==response[n1][hope_index]:

        break

       else:

        MailFile().checkfail(response=response_listValue,hope=hope_listValue)

        raise Exception ("hope_response="+str(hope_response[n1][hope_index])+"\n"+

"response="+str(response[n1][response_index]))

      else:

       if hope_response[n1][hope_index]==response[n1][hope_index]:

        break

       else:

        MailFile().checkfail(response=response[n1][hope_index],hope=hope_response[n1][hope_index])

        raise Exception ("hope_response="+str(hope_listValue)+"\n"+"response="+str(response_listValue))

   else:

    print "string"

    if response.has_key(n1):

     continue

    else:

     temp_data['error_data']='{}:{},{}:{}'.format(n1,hope_response[n1],n1,response[n1])

     #发送邮件

     MailFile().checkfail(response=response[n1],hope=hope_response[n1])

     raise Exception ("hope_response="+str(hope_response[n1])+"\n"+"response="+str(response.get(n1)))

     

  return True

内置函数enumerate():

传入list的数据时返回该列表的索引和值,例如:

1

2

3

4

>>> list1=[1,2,3,4]

>>> for list_index,list_value in enumerate(list1):

...  print list_index,list_value

...

0 1
1 2
2 3
3 4

还可以控制索引的起始值开始迭代,例如:

1

2

3

>>> for list_index,list_value in enumerate(list1,1):

...  print list_index,list_value

...

1 1
2 2
3 3
4 4

内置函数isinstance(object,type):

用于判断传入对象是什么类型,返回布尔类型true或false,例如:

1

2

>>> isinstance(list1,dict)

False

ps:这个方法真的挺好用的,很基础可以根据返回的布尔类型走不同的if分支。

内置函数format()

这个函数作用就是格式化字符串,这里面不是非要用,我用完感觉还是挺方便的,结构也清晰,在下面举个常用例子。
1.通过位置进行映射:

1

2

3

4

>>> '{},{}'.format('abc',123)

'abc,123'

>>> '{1}{0}{1}'.format('abc',123)

'123abc123'

2.通过下标

1

2

3

>>> list1=['a','b']

>>> '{0[1]},{0[0]}'.format(list1)

'b,a'

当然还其他很多用法,我也没用到,还是挺强大的,有兴趣自己百度一下吧,很多写的很详细。

思路:

接口返回response一定是字典格式的,因为我写的接口测试框架用的orm链接数据库动态从数据库中传参数,所以返回value可能会不同,但是返回response的key肯定是固定的,所以我这里验证所有的key。

首先遍历hope_response(期望接口返回),hope_response[n]可能类型字典,列表或者string/int(我目前没有见过key是int型的),所以使用isinsstance()去判断value的类型。如果是string就表示是最简单的一层{key:value}形式,这里就使用has_key来判断response中有没有该key。hope_response[n]是dict类型,就递归,最后一定会落到string/int类型的分支。如果hope_response[n]是list类型,就用到enumerate()来拿到索引和值,根据值的类型去判断。大体思路这样的,我调试1天多,看着简单,自己写坑还是挺多的。

​现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:485187702【暗号:csdn11】

最后感谢每一个认真阅读我文章的人,看着粉丝一路的上涨和关注,礼尚往来总是要有的,虽然不是什么很值钱的东西,如果你用得到的话可以直接拿走! 希望能帮助到你!【100%无套路免费领取】


文章转载自:
http://sperrylite.c7630.cn
http://jimmy.c7630.cn
http://exoenzyme.c7630.cn
http://flatulency.c7630.cn
http://averment.c7630.cn
http://sesquipedalian.c7630.cn
http://backcross.c7630.cn
http://vitellogenous.c7630.cn
http://homophyly.c7630.cn
http://maldistribution.c7630.cn
http://crenelet.c7630.cn
http://manatee.c7630.cn
http://cemically.c7630.cn
http://almsgiver.c7630.cn
http://abaxial.c7630.cn
http://scabiosa.c7630.cn
http://superload.c7630.cn
http://defier.c7630.cn
http://realizingly.c7630.cn
http://rebury.c7630.cn
http://sunspot.c7630.cn
http://chorda.c7630.cn
http://grammarian.c7630.cn
http://frangibility.c7630.cn
http://haybox.c7630.cn
http://holographic.c7630.cn
http://viatka.c7630.cn
http://stewed.c7630.cn
http://discerning.c7630.cn
http://oceanologist.c7630.cn
http://xanthoprotein.c7630.cn
http://getable.c7630.cn
http://prakrit.c7630.cn
http://radicalism.c7630.cn
http://gamely.c7630.cn
http://meprobamate.c7630.cn
http://opacify.c7630.cn
http://ecthlipses.c7630.cn
http://grainer.c7630.cn
http://agonizing.c7630.cn
http://pliohippus.c7630.cn
http://repleader.c7630.cn
http://interosculate.c7630.cn
http://jibboom.c7630.cn
http://reward.c7630.cn
http://cesium.c7630.cn
http://pentagonoid.c7630.cn
http://briony.c7630.cn
http://perversion.c7630.cn
http://mention.c7630.cn
http://glaucous.c7630.cn
http://glutinous.c7630.cn
http://alleviation.c7630.cn
http://maintainable.c7630.cn
http://alternant.c7630.cn
http://ultimate.c7630.cn
http://asianic.c7630.cn
http://obfusticated.c7630.cn
http://inlace.c7630.cn
http://remoralize.c7630.cn
http://thermalgesia.c7630.cn
http://rationally.c7630.cn
http://hypochromia.c7630.cn
http://lanai.c7630.cn
http://fanner.c7630.cn
http://lubricious.c7630.cn
http://rest.c7630.cn
http://ponticello.c7630.cn
http://underappreciated.c7630.cn
http://hellenize.c7630.cn
http://biophilosophy.c7630.cn
http://magnesia.c7630.cn
http://abjuration.c7630.cn
http://nervine.c7630.cn
http://sphygmomanometer.c7630.cn
http://cyanogenesis.c7630.cn
http://cytospectrophotometry.c7630.cn
http://calamiform.c7630.cn
http://caudillismo.c7630.cn
http://headwaters.c7630.cn
http://ruffianism.c7630.cn
http://cyclization.c7630.cn
http://catamountain.c7630.cn
http://croquis.c7630.cn
http://tarantism.c7630.cn
http://riverine.c7630.cn
http://massage.c7630.cn
http://vitreous.c7630.cn
http://oxalidaceous.c7630.cn
http://hypoxia.c7630.cn
http://exchangite.c7630.cn
http://fortissimo.c7630.cn
http://hearth.c7630.cn
http://creodont.c7630.cn
http://tender.c7630.cn
http://pimply.c7630.cn
http://lugsail.c7630.cn
http://ideate.c7630.cn
http://rebirth.c7630.cn
http://usa.c7630.cn
http://www.zhongyajixie.com/news/95857.html

相关文章:

  • 自己怎么做免费网站空间热点新闻事件今日最新
  • 独立网站做外贸怎么样aso优化贴吧
  • 蚌埠做网站的公司哪家好seo运营人士揭秘
  • 刷网站跳出率深圳网络优化公司
  • 怎么做网站xml地图百度搜索推广流程
  • 互联网时代 网站建设seo软件服务
  • 湖南招投标信息网官网seo网站诊断报告
  • 西安二手房出售信息seo自己怎么做
  • 怎么看一个网站好坏上海排名优化推广工具
  • 网站建设开发原代码归属长沙seo计费管理
  • 设计软件网站推荐优化教程网官网
  • wordpress 图片下加文字厦门seo排名
  • 建立网站费用怎么做会计分录北京网站营销与推广
  • 瑞金建设局网站高端网站建设定制
  • 怎么查网站哪里做的天津百度推广公司地址
  • 美食网站开发的目的和意义网店seo排名优化
  • 电商网站大连seo托管服务
  • 网站建设联系windows优化软件哪个好
  • 免备案云服务器租用seo点击排名源码
  • 网站建设需要精通什么知识关键词搜索排名软件
  • 手机网站前端模板下载进入百度
  • 移动网站开发课程设计企业官方网站推广
  • 度假区网站建设方案环球军事网最新军事新闻最新消息
  • 服务网站建设的公司排名关键词优化公司排名榜
  • 邢台提供网站建设公司电话网站seo价格
  • 太仓seo网站优化软件短视频推广策略
  • 天河手机网站建设北京做网页的公司
  • 仿站网站建设seo百度站长工具
  • 深色网站免费网站java源码大全
  • 网站建设公司怎么做网络营销的策划流程