当前位置: 首页>>代码示例>>Python>>正文


Python Script._python_to_lua方法代码示例

本文整理汇总了Python中mockredis.script.Script._python_to_lua方法的典型用法代码示例。如果您正苦于以下问题:Python Script._python_to_lua方法的具体用法?Python Script._python_to_lua怎么用?Python Script._python_to_lua使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mockredis.script.Script的用法示例。


在下文中一共展示了Script._python_to_lua方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_python_to_lua_none

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_none(self):
     pval = None
     lval = MockRedisScript._python_to_lua(pval)
     is_null = """
     function is_null(var1)
         return var1 == nil
     end
     return is_null
     """
     lua_is_null = self.lua.execute(is_null)
     ok_(MockRedisScript._lua_to_python(lua_is_null(lval)))
开发者ID:RedisLabs,项目名称:mockredis,代码行数:13,代码来源:test_script.py

示例2: test_python_to_lua_boolean

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_boolean(self):
     pval = True
     lval = MockRedisScript._python_to_lua(pval)
     eq_("boolean", self.lua_globals.type(lval))
     ok_(MockRedisScript._lua_to_python(lval))
开发者ID:RedisLabs,项目名称:mockredis,代码行数:7,代码来源:test_script.py

示例3: test_python_to_lua_float

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_float(self):
     pval = 10.1
     lval = MockRedisScript._python_to_lua(pval)
     lval_expected = self.lua.eval("10.1")
     eq_("number", self.lua_globals.type(lval))
     ok_(MockRedisScript._lua_to_python(self.lua_compare_val(lval_expected, lval)))
开发者ID:RedisLabs,项目名称:mockredis,代码行数:8,代码来源:test_script.py

示例4: test_python_to_lua_dict

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_dict(self):
     pval = {"k1": "v1", "k2": "v2"}
     lval = MockRedisScript._python_to_lua(pval)
     lval_expected = self.lua.eval('{"k1", "v1", "k2", "v2"}')
     self.lua_assert_equal_list_with_pairs(lval_expected, lval)
开发者ID:RedisLabs,项目名称:mockredis,代码行数:7,代码来源:test_script.py

示例5: test_python_to_lua_list

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_list(self):
     pval = ["abc", "xyz"]
     lval = MockRedisScript._python_to_lua(pval)
     lval_expected = self.lua.eval('{"abc", "xyz"}')
     self.lua_assert_equal_list(lval_expected, lval)
开发者ID:RedisLabs,项目名称:mockredis,代码行数:7,代码来源:test_script.py

示例6: test_python_to_lua_string

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_string(self):
     pval = "somestring"
     lval = MockRedisScript._python_to_lua(pval)
     lval_expected = self.lua.eval('"somestring"')
     eq_("string", self.lua_globals.type(lval))
     eq_(lval_expected, lval)
开发者ID:RedisLabs,项目名称:mockredis,代码行数:8,代码来源:test_script.py

示例7: test_python_to_lua_long

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_long(self):
     pval = long(10)
     lval = MockRedisScript._python_to_lua(pval)
     lval_expected = self.lua.eval('10')
     eq_("number", self.lua_globals.type(lval))
     ok_(MockRedisScript._lua_to_python(self.lua_compare_val(lval_expected, lval)))
开发者ID:asherf,项目名称:mockredis,代码行数:8,代码来源:test_script.py

示例8: test_python_to_lua_boolean

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_boolean(self):
     pval = True
     lval = MockredisScript._python_to_lua(pval)
     self.assertEqual("boolean", self.lua_globals.type(lval))
     self.assertTrue(MockredisScript._lua_to_python(lval))
开发者ID:aim110,项目名称:mockredis,代码行数:7,代码来源:test_script.py

示例9: test_python_to_lua_float

# 需要导入模块: from mockredis.script import Script [as 别名]
# 或者: from mockredis.script.Script import _python_to_lua [as 别名]
 def test_python_to_lua_float(self):
     pval = 10.1
     lval = MockredisScript._python_to_lua(pval)
     lval_expected = self.lua.eval('10.1')
     self.assertEqual("number", self.lua_globals.type(lval))
     self.assertTrue(MockredisScript._lua_to_python(self.lua_compare_val(lval_expected, lval)))
开发者ID:aim110,项目名称:mockredis,代码行数:8,代码来源:test_script.py


注:本文中的mockredis.script.Script._python_to_lua方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。