本文整理汇总了Python中pyamf.tests.util.Spam.hello方法的典型用法代码示例。如果您正苦于以下问题:Python Spam.hello方法的具体用法?Python Spam.hello怎么用?Python Spam.hello使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyamf.tests.util.Spam
的用法示例。
在下文中一共展示了Spam.hello方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_anonymous
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_anonymous(self):
pyamf.register_class(Spam)
x = Spam()
x.spam = "eggs"
x.hello = "world"
self.assertEncoded(x, "\x03", ("\x00\x05hello\x02\x00\x05world", "\x00\x04spam\x02\x00\x04eggs"), "\x00\x00\t")
示例2: test_anonymous
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_anonymous(self):
pyamf.register_class(Spam)
x = Spam()
x.spam = 'eggs'
x.hello = 'world'
self.assertEncoded(x, '\x03', ('\x00\x05hello\x02\x00\x05world',
'\x00\x04spam\x02\x00\x04eggs'), '\x00\x00\t')
示例3: test_anonymous
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_anonymous(self):
pyamf.register_class(Spam)
x = Spam()
x.spam = 'eggs'
x.hello = 'world'
self._run([
(x, '\x03\x00\x05hello\x02\x00\x05world\x00\x04spam\x02\x00\x04eggs\x00\x00\t')])
示例4: test_dynamic
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_dynamic(self):
def attr_func(obj):
self.assertTrue(isinstance(obj, Spam))
return ['hello']
x = Spam()
x.foo = 'bar'
x.hello = 'world'
pyamf.register_class(Spam, attr_func=attr_func, metadata=['dynamic'])
self._run([(x, '\x03\x00\x05hello\x02\x00\x05world\x00\x00\t')])
pyamf.unregister_class(Spam)
# try duplicate attributes
pyamf.register_class(Spam, attrs=['hello'], attr_func=attr_func,
metadata=['dynamic'])
self._run([(x, '\x03\x00\x05hello\x02\x00\x05world\x00\x00\t')])
pyamf.unregister_class(Spam)
pyamf.register_class(Spam, attrs=['foo'], attr_func=attr_func,
metadata=['dynamic'])
self._run([
(x, ('\x03', (
'\x00\x03foo\x02\x00\x03bar',
'\x00\x05hello\x02\x00\x05world'
), '\x00\x00\t'))])
pyamf.unregister_class(Spam)
# and now typedobject
pyamf.register_class(Spam, 'x', attr_func=attr_func,
metadata=['dynamic'])
self._run([(x,
'\x10\x00\x01x\x00\x05hello\x02\x00\x05world\x00\x00\t')])
pyamf.unregister_class(Spam)
pyamf.register_class(Spam, 'x', attrs=['hello'], attr_func=attr_func,
metadata=['dynamic'])
self._run([(x,
'\x10\x00\x01x\x00\x05hello\x02\x00\x05world\x00\x00\t')])
pyamf.unregister_class(Spam)
pyamf.register_class(Spam, 'x', attrs=['foo'], attr_func=attr_func,
metadata=['dynamic'])
self._run([
(x, ('\x10\x00\x01x', (
'\x00\x03foo\x02\x00\x03bar',
'\x00\x05hello\x02\x00\x05world'
), '\x00\x00\t'))])
示例5: test_dynamic_static
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_dynamic_static(self):
x = Spam()
x.foo = "bar"
x.hello = "world"
alias = pyamf.register_class(Spam)
alias.static_attrs = ["hello"]
alias.compile()
self.assertTrue(alias.dynamic)
self.assertEncoded(x, "\x03", ("\x00\x05hello\x02\x00\x05world", "\x00\x03foo\x02\x00\x03bar"), "\x00\x00\t")
示例6: test_dynamic
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_dynamic(self):
x = Spam()
x.foo = 'bar'
x.hello = 'world'
alias = pyamf.register_class(Spam)
alias.exclude_attrs = ['foo']
alias.compile()
self.assertTrue(alias.dynamic)
self.assertEncoded(x, '\x03\x00\x05hello\x02\x00\x05world\x00\x00\t')
示例7: test_dynamic_static
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_dynamic_static(self):
x = Spam()
x.foo = 'bar'
x.hello = 'world'
alias = pyamf.register_class(Spam)
alias.static_attrs = ['hello']
alias.compile()
self.assertTrue(alias.dynamic)
self.assertEncoded(x, '\x03', ('\x00\x05hello\x02\x00\x05world',
'\x00\x03foo\x02\x00\x03bar'), '\x00\x00\t')
示例8: test_dynamic_registered
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_dynamic_registered(self):
x = Spam()
x.foo = "bar"
x.hello = "world"
alias = pyamf.register_class(Spam, "x")
alias.exclude_attrs = ["foo"]
alias.compile()
self.assertTrue(alias.dynamic)
self.assertEncoded(x, "\x10\x00\x01x", "\x00\x05hello\x02\x00\x05world", "\x00\x00\t")
示例9: test_dynamic
# 需要导入模块: from pyamf.tests.util import Spam [as 别名]
# 或者: from pyamf.tests.util.Spam import hello [as 别名]
def test_dynamic(self):
x = Spam()
x.foo = 'bar'
x.hello = 'world'
alias = pyamf.register_class(Spam)
alias.exclude_attrs = ['foo']
alias.compile()
self.assertTrue(alias.dynamic)
self._run([(x, '\x03\x00\x05hello\x02\x00\x05world\x00\x00\t')])
pyamf.unregister_class(Spam)
# try duplicate attributes
alias = pyamf.register_class(Spam)
alias.static_attrs = ['hello']
alias.compile()
self.assertTrue(alias.dynamic)
self._run([(x, '\x03\x00\x05hello\x02\x00\x05world\x00\x03foo\x02'
'\x00\x03bar\x00\x00\t')])
pyamf.unregister_class(Spam)
# and now typedobject
alias = pyamf.register_class(Spam, 'x')
alias.exclude_attrs = ['foo']
alias.compile()
self.assertTrue(alias.dynamic)
self._run([(x,
'\x10\x00\x01x\x00\x05hello\x02\x00\x05world\x00\x00\t')])