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


Python aot.jellyToSource函数代码示例

本文整理汇总了Python中twisted.persisted.aot.jellyToSource函数的典型用法代码示例。如果您正苦于以下问题:Python jellyToSource函数的具体用法?Python jellyToSource怎么用?Python jellyToSource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_copyReg

 def test_copyReg(self):
     s = "foo_bar"
     sio = StringIO.StringIO()
     sio.write(s)
     uj = aot.unjellyFromSource(aot.jellyToSource(sio))
     # print repr(uj.__dict__)
     assert uj.getvalue() == s
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:7,代码来源:test_persisted.py

示例2: test_methodSelfIdentity

 def test_methodSelfIdentity(self):
     a = A()
     b = B()
     a.bmethod = b.bmethod
     b.a = a
     im_ = aot.unjellyFromSource(aot.jellyToSource(b)).a.bmethod
     self.assertEqual(im_.im_class, im_.im_self.__class__)
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:7,代码来源:test_persisted.py

示例3: test_copyReg

 def test_copyReg(self):
     """
     L{aot.jellyToSource} and L{aot.unjellyFromSource} honor functions
     registered in the pickle copy registry.
     """
     uj = aot.unjellyFromSource(aot.jellyToSource(CopyRegistered()))
     self.assertIsInstance(uj, CopyRegisteredLoaded)
开发者ID:marcelpetersen,项目名称:localnews,代码行数:7,代码来源:test_persisted.py

示例4: test_methodSelfIdentity

 def test_methodSelfIdentity(self):
     a = A()
     b = B()
     a.bmethod = b.bmethod
     b.a = a
     im_ = aot.unjellyFromSource(aot.jellyToSource(b)).a.bmethod
     self.assertEqual(aot._selfOfMethod(im_).__class__,
                      aot._classOfMethod(im_))
开发者ID:marcelpetersen,项目名称:localnews,代码行数:8,代码来源:test_persisted.py

示例5: test_methodNotSelfIdentity

 def test_methodNotSelfIdentity(self):
     """
     If a class change after an instance has been created,
     L{aot.unjellyFromSource} shoud raise a C{TypeError} when trying to
     unjelly the instance.
     """
     a = A()
     b = B()
     a.bmethod = b.bmethod
     b.a = a
     savedbmethod = B.bmethod
     del B.bmethod
     try:
         self.assertRaises(TypeError, aot.unjellyFromSource,
                           aot.jellyToSource(b))
     finally:
         B.bmethod = savedbmethod
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:17,代码来源:test_persisted.py

示例6: test_basicIdentity

 def test_basicIdentity(self):
     # Anyone wanting to make this datastructure more complex, and thus this
     # test more comprehensive, is welcome to do so.
     aj = aot.AOTJellier().jellyToAO
     d = {'hello': 'world', "method": aj}
     l = [1, 2, 3,
          "he\tllo\n\n\"x world!",
          u"goodbye \n\t\u1010 world!",
          1, 1.0, 100 ** 100l, unittest, aot.AOTJellier, d,
          funktion
          ]
     t = tuple(l)
     l.append(l)
     l.append(t)
     l.append(t)
     uj = aot.unjellyFromSource(aot.jellyToSource([l, l]))
     assert uj[0] is uj[1]
     assert uj[1][0:5] == l[0:5]
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:18,代码来源:test_persisted.py

示例7: test_nonDictState

 def test_nonDictState(self):
     a = NonDictState()
     a.state = "meringue!"
     assert aot.unjellyFromSource(aot.jellyToSource(a)).state == a.state
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:4,代码来源:test_persisted.py

示例8: test_simpleTypes

 def test_simpleTypes(self):
     obj = (1, 2.0, 3j, True, slice(1, 2, 3), 'hello', u'world', sys.maxint + 1, None, Ellipsis)
     rtObj = aot.unjellyFromSource(aot.jellyToSource(obj))
     self.assertEqual(obj, rtObj)
开发者ID:12019,项目名称:OpenWrt_Luci_Lua,代码行数:4,代码来源:test_persisted.py


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