【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 " ...
随机推荐
- 关于安装black apple遇到的坑
1.用料准备: vmware player或vmware workstation,osx系统安装包(后缀名为cdr的几个G大小的文件),为vmware安装osx的补丁安装包unlocker 2.在安装 ...
- 基础 | batchnorm原理及代码详解
https://blog.csdn.net/qq_25737169/article/details/79048516 https://www.cnblogs.com/bonelee/p/8528722 ...
- OpenGL OBJ模型加载.
在我们前面绘制一个屋,我们可以看到,需要每个立方体一个一个的自己来推并且还要处理位置信息.代码量大并且要时间.现在我们通过加载模型文件的方法来生成模型文件,比较流行的3D模型文件有OBJ,FBX,da ...
- tomcat部署时war和war exploded区别
war模式—-将WEB工程以包的形式上传到服务器 war exploded模式—-将WEB工程以当前文件夹的位置关系上传到服务器
- SAP MM/FI 自动过账实现 OBYC 接口执行
一. 自动过账原理 在MM模块的许多操作都能实现在FI模块自动过账,如PO收货.发票验证(LIV).工单发料.向生产车间发料等等.不用说,一定需要在IMG中进行配置才可以实现自动处理.但SAP实现的这 ...
- static为什么一般与final一起用?
static和final的意义是不同的,static修饰的时候代表对象是静态的,而final修饰的时候代表对象只能赋值一次,他们连用的时候是因为定义的那个对象既要它是静态的,也要求它的值不能再被修改. ...
- (笔记)Mysql命令select:当前选择(连接)的数据库
select命令表示当前选择(连接)的数据库. select命令格式:mysql> select database(); MySQL中SELECT命令类似于其他编程语言里的print或者writ ...
- HTML5游戏中动画帧的概念理解
最近在弄一个HTML5游戏,在学习过程中,总结出这个帧结构. HTML5游戏最重要也就是对帧的理解. 容器:Canvas 一个画布 sprite:一个canvas上有多个动画,每个动画对象就是一个An ...
- e565. 关闭的时候隐藏窗口
By default, when the close button on a frame is clicked, nothing happens. This example shows how to ...
- SciTE配置信息
超强文本编辑器SciTE配置方法详细实例 转载 2006年12月28日 17:07:00 标签: 文本编辑 / 文档 / 语言 / html / python / api 32800 关于scite文 ...