【RF库测试】Encode String To Bytes&Decode Bytes To String& should be string&should be unicode string &should not be string
场景1:判断类型
r
${d} set variable \xba\xcb\xbc\xf5\xcd\xa8\xb9\xfd #核减通过
Run Keyword And Continue On Failure should be byte string ${d}
should be string ${d}
Should Be Unicode String ${d}
Run Keyword And Continue On Failure Should Not Be String ${d}
${e} set variable 核减通过
Run Keyword And Continue On Failure should be byte string ${e}
should be string ${e}
Should Be Unicode String ${e}
Run Keyword And Continue On Failure Should Not Be String ${e}
总结:两个变量均为string 和 unicode string类型,而非byte string类型;
场景2:Encode String To Bytes
e
${d} set variable \xba\xcb\xbc\xf5\xcd\xa8\xb9\xfd
${dUTF8} Encode String To Bytes ${d} UTF-8
${dASCII} Encode String To Bytes ${d} ASCII errors=ignore
${e} set variable 核减通过
${eUTF8} Encode String To Bytes ${e} UTF-8
${eASCII} Run Keyword And Continue On Failure Encode String To Bytes ${e} ASCII
Run Keyword And Continue On Failure should be equal ${eUTF8} ${dUTF8}
Run Keyword And Continue On Failure should be equal ${eASCII} ${dASCII}
执行结果:
Starting test: ZXJF.清结算 一期.互联网核减.e
20170712 11:33:08.790 : INFO : ${d} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:33:08.790 : INFO : ${dUTF8} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:33:08.790 : INFO : ${dASCII} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:33:08.790 : INFO : ${e} = 核减通过
20170712 11:33:08.790 : INFO : ${eUTF8} = \xe6\xa0\xb8\xe5\x87\x8f\xe9\x80\x9a\xe8\xbf\x87
20170712 11:33:08.806 : FAIL : UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
20170712 11:33:08.806 : INFO : ${eASCII} = None
20170712 11:33:08.806 : INFO :
Argument types are:
<type 'str'>
<type 'str'>
20170712 11:33:08.806 : FAIL : \xe6\xa0\xb8\xe5\x87\x8f\xe9\x80\x9a\xe8\xbf\x87 != xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:33:08.806 : INFO :
Argument types are:
<type 'NoneType'>
<type 'str'>
20170712 11:33:08.806 : FAIL : None != xbaxcbxbcxf5xcdxa8xb9xfd
Ending test: ZXJF.清结算 一期.互联网核减.e
场景3:Decode Bytes To String
t
${d} set variable \xba\xcb\xbc\xf5\xcd\xa8\xb9\xfd
${dUTF8} Decode Bytes To String ${d} UTF-8
${dASCII} Decode Bytes To String ${d} ASCII errors=ignore
${e} set variable 核减通过
${eUTF8} Run Keyword And Continue On Failure Decode Bytes To String ${e} UTF-8
${eASCII} Run Keyword And Continue On Failure Decode Bytes To String ${e} ASCII errors=ignore
Run Keyword And Continue On Failure should be equal ${eUTF8} ${dUTF8}
Run Keyword And Continue On Failure should be equal ${eASCII} ${dASCII}
执行结果:
Starting test: ZXJF.清结算 一期.互联网核减.t
20170712 11:31:33.780 : INFO : ${d} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:31:33.780 : INFO : ${dUTF8} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:31:33.780 : INFO : ${dASCII} = xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:31:33.780 : INFO : ${e} = 核减通过
20170712 11:31:33.780 : FAIL : UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
20170712 11:31:33.796 : INFO : ${eUTF8} = None
20170712 11:31:33.796 : FAIL : UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-3: ordinal not in range(128)
20170712 11:31:33.796 : INFO : ${eASCII} = None
20170712 11:31:33.796 : INFO :
Argument types are:
<type 'NoneType'>
<type 'unicode'>
20170712 11:31:33.796 : FAIL : None != xbaxcbxbcxf5xcdxa8xb9xfd
20170712 11:31:33.796 : INFO :
Argument types are:
<type 'NoneType'>
<type 'unicode'>
20170712 11:31:33.812 : FAIL : None != xbaxcbxbcxf5xcdxa8xb9xfd
Ending test: ZXJF.清结算 一期.互联网核减.t
【RF库测试】Encode String To Bytes&Decode Bytes To String& should be string&should be unicode string &should not be string的更多相关文章
- 【RF库测试】DateTime库
术语说明: 1.Epoch指的是一个特定的时间:1970-01-01 00:00:00 UTC. 2.国际标准化组织的国际标准ISO 8601是日期和时间的表示方法,格式是 'YYYY-MM-DD h ...
- 【RF库测试】算法运算
- 【RF库测试】set variable if
- 【RF库测试】关键字get time
*** Test Cases ***Timestamp ${time} GET TIME ${secs} GET TIME epoch ${year} GET TIME return year ${y ...
- 【RF库测试】Variable Should not Exist & variable should exist
Variable Should not Exist variable should exist
- 【RF库测试】Exit For Loop 相关
1.Exit For Loop If:满足条件时,跳出循环,后面的循环不再执行 2.Continue For Loop If:满足条件时,跳出本次循环,继续执行后面的循环
- 【RF库测试】对出错的处理
1.出错后继续执行:Run Keyword And Continue On Failure 2.获取关键字执行结果后继续执行:Run Keyword And Ignore Error 有时候,我们需要 ...
- python3 str.encode bytes.decode
str.encode 把字符串编码成字节序列 bytes.decode 把字节序列解码成字符串 https://docs.python.org/3.5/library/stdtypes.html st ...
- Python使用import导入模块时报ValueError: source code string cannot contain null bytes的解决方案
老猿在导入一个Python模块时报错: >>> import restartnet.py Traceback (most recent call last): File " ...
随机推荐
- lapacke svd实例
参考 intel MTK实例 https://software.intel.com/sites/products/documentation/doclib/mkl_sa/11/mkl_lapack_e ...
- [转]Idea2016 使用Maven配置简单Web项目(受益比较多的一篇)
最近被同事一直吵着用Idea写Java,于是偷偷的去试用了一下Idea.确实不错,无论界面还是智能提醒都是蛮符合我的使用习惯,但是刚从Eclipse出来,使用Idea还是不太习惯的.所以这里写出来,供 ...
- SpringMVC系列(十六)Spring MVC与Struts2的对比
• Spring MVC 的入口是 Servlet, 而 Struts2 是 Filter• Spring MVC 会稍微比 Struts2 快些. Spring MVC 是基于方法设计, 而 Stu ...
- e618. Validating a JTextField When Permanently Losing the Focus
This example demonstrates a text field that validates its contents when it receives a permanent focu ...
- sqlite学习笔记1:编译数据库
首先说下我使用的是Linux环境 一 下载源代码 官网下载:点这里 二 编译 1 解压 下载完毕之后通常会在当前用户的"下载"文件夹中,首先cd到下载文件夹,然后创建一个文件件.用 ...
- SpringBoot学习:使用spring-boot-devtools进行热部署
项目下载地址:http://download.csdn.net/detail/aqsunkai/9805821 pom.xml添加依赖: <!--支持热启动jar包--> <depe ...
- MySQL存储引擎Innodb和MyISAM对比总结
Innodb引擎 InnoDB是一个事务型的存储引擎,设计目标是处理大数量数据时提供高性能的服务,它在运行时会在内存中建立缓冲池,用于缓冲数据和索引. Innodb引擎优点 1.支持事务处理.ACID ...
- Linux-centos6.8下关闭防火墙
一.临时关闭防火墙 1. 查看防火墙的状态 [root@vpnSS ~]# /etc/init.d/iptables status Table: filter Chain INPUT (policy ...
- http 断点续传
一.序 Hi,大家好,我是承香墨影! HTTP 协议在网络知识中占据了重要的地位,HTTP 协议最基础的就是请求和响应的报文,而报文又是由报文头(Header)和实体组成.大多数 HTTP 协议的使用 ...
- 软件设计模式之代理模式(JAVA)
貌似停笔了近半个月了,实在不该啊,新的一年,时刻让自己归零. Back To Zero,就从这篇文章拉开今年的序幕吧. 这篇文章准备介绍下有关代理模式的基本概念和静态代理.动态代理的优缺点及使用方法( ...