场景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的更多相关文章

  1. 【RF库测试】DateTime库

    术语说明: 1.Epoch指的是一个特定的时间:1970-01-01 00:00:00 UTC. 2.国际标准化组织的国际标准ISO 8601是日期和时间的表示方法,格式是 'YYYY-MM-DD h ...

  2. 【RF库测试】算法运算

  3. 【RF库测试】set variable if

  4. 【RF库测试】关键字get time

    *** Test Cases ***Timestamp ${time} GET TIME ${secs} GET TIME epoch ${year} GET TIME return year ${y ...

  5. 【RF库测试】Variable Should not Exist & variable should exist

    Variable Should not Exist variable should exist

  6. 【RF库测试】Exit For Loop 相关

    1.Exit For Loop If:满足条件时,跳出循环,后面的循环不再执行 2.Continue For Loop If:满足条件时,跳出本次循环,继续执行后面的循环

  7. 【RF库测试】对出错的处理

    1.出错后继续执行:Run Keyword And Continue On Failure 2.获取关键字执行结果后继续执行:Run Keyword And Ignore Error 有时候,我们需要 ...

  8. python3 str.encode bytes.decode

    str.encode 把字符串编码成字节序列 bytes.decode 把字节序列解码成字符串 https://docs.python.org/3.5/library/stdtypes.html st ...

  9. Python使用import导入模块时报ValueError: source code string cannot contain null bytes的解决方案

    老猿在导入一个Python模块时报错: >>> import restartnet.py Traceback (most recent call last): File " ...

随机推荐

  1. 关于源码输出,浏览器不解析Html标签

    有时候根据需要我们需要看到浏览器上源码效果如: 但是我如果在html中输入 <a href = 'http://www.baidu.com'>百度</a>那么问题来了,总是显示 ...

  2. linux进程的挂起和恢复

    进程的挂起及恢复 #ctrl+z:挂起,程序放到后台,程序没有结束. #jobs:查看被挂起的程序工作号 恢复进程执行时,有两种选择:fg命令将挂起的作业放回到前台执行:用bg命令将挂起的作业放到后台 ...

  3. 自然语言交流系统 phxnet团队 创新实训 个人博客 (十二)

    在本项目中关于天空盒子的使用的配置方法: 给场景添加天空盒  第二种方式   在菜单栏中选择:Edit->Render Setting,在保证不在选择场景中其它文件的前提下,Inspector面 ...

  4. 摄像头驱动OV7725学习笔记连载(一):OV7725 电器特性和时序图

    OV(豪威科技)已经被中国财团收购.这个昔日的大佬,最终走下神坛. 关于OVsensor的资料包括,OV7725的简介(OmniVsion_OV7725),OV7725的数据手册(OV7725_Dat ...

  5. hashMap put方法 第二行代码

    if (table == EMPTY_TABLE) { inflateTable(threshold); } table transient Entry<K,V>[] table = (E ...

  6. Q-Learning

    一.Q-Learning: 例子:https://www.zhihu.com/question/26408259/answer/123230350 http://ml.cs.tsinghua.edu. ...

  7. Spring Data Redis学习

    本文是从为知笔记上复制过来的,懒得调整格式了,为知笔记版本是带格式的,内容也比这里全.点这里 为知笔记版本 Spring Data Redis 学习 Version 1.8.4.Release 前言 ...

  8. 第三百八十四节,Django+Xadmin打造上线标准的在线教育平台—路由映射与静态文件配置以及会员注册

    第三百八十四节,Django+Xadmin打造上线标准的在线教育平台—路由映射与静态文件配置以及会员注册 基于类的路由映射 from django.conf.urls import url, incl ...

  9. 认识J2EE规范或标准以及J2EE和JEE有什么不同?

    1. J2EE实际上是一组规范(新手对规范这个词可能云里雾里的,没有办法,JAVA概念太多了,大部分概念慢慢就会理解),没错,J2EE这个概念并不是某种技术,而是一堆规范(实现意义上可以说是一堆技术) ...

  10. 如何使用Matrix对bitmap的旋转与镜像水平垂直翻转

    Bitmap convert(Bitmap a, int width, int height){int w = a.getWidth();int h = a.getHeight();Bitmap ne ...