當前位置: 首頁>>代碼示例>>Python>>正文


Python amp.Argument方法代碼示例

本文整理匯總了Python中twisted.protocols.amp.Argument方法的典型用法代碼示例。如果您正苦於以下問題:Python amp.Argument方法的具體用法?Python amp.Argument怎麽用?Python amp.Argument使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在twisted.protocols.amp的用法示例。


在下文中一共展示了amp.Argument方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_argumentInterface

# 需要導入模塊: from twisted.protocols import amp [as 別名]
# 或者: from twisted.protocols.amp import Argument [as 別名]
def test_argumentInterface(self):
        """
        L{Argument} instances provide L{amp.IArgumentType}.
        """
        self.assertTrue(verifyObject(amp.IArgumentType, amp.Argument())) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:7,代碼來源:test_amp.py

示例2: test_commandArgumentsMustBeNamedWithByteStrings

# 需要導入模塊: from twisted.protocols import amp [as 別名]
# 或者: from twisted.protocols.amp import Argument [as 別名]
def test_commandArgumentsMustBeNamedWithByteStrings(self):
        """
        A L{Command} subclass's C{arguments} must have byte string names.
        """
        error = self.assertRaises(
            TypeError, type, "NewCommand", (amp.Command, ),
            {"arguments": [(u"foo", None)]})
        self.assertRegex(
            str(error), "^Argument names must be byte strings, got: u?'foo'$") 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:11,代碼來源:test_amp.py

示例3: test_toBox

# 需要導入模塊: from twisted.protocols import amp [as 別名]
# 或者: from twisted.protocols.amp import Argument [as 別名]
def test_toBox(self):
        """
        L{ListOf.toBox} extracts the list of objects from the C{objects}
        dictionary passed to it, using the C{name} key also passed to it,
        serializes each of the elements in that list using the L{Argument}
        instance previously passed to its initializer, combines the serialized
        results, and inserts the result into the C{strings} dictionary using
        the same C{name} key.
        """
        stringList = amp.ListOf(self.elementType)
        strings = amp.AmpBox()
        for key in self.objects:
            stringList.toBox(
                key.encode("ascii"), strings, self.objects.copy(), None)
        self.assertEqual(strings, self.strings) 
開發者ID:proxysh,項目名稱:Safejumper-for-Desktop,代碼行數:17,代碼來源:test_amp.py

示例4: test_toBox

# 需要導入模塊: from twisted.protocols import amp [as 別名]
# 或者: from twisted.protocols.amp import Argument [as 別名]
def test_toBox(self):
        """
        L{ListOf.toBox} extracts the list of objects from the C{objects}
        dictionary passed to it, using the C{name} key also passed to it,
        serializes each of the elements in that list using the L{Argument}
        instance previously passed to its initializer, combines the serialized
        results, and inserts the result into the C{strings} dictionary using
        the same C{name} key.
        """
        stringList = amp.ListOf(self.elementType)
        strings = amp.AmpBox()
        for key in self.objects:
            stringList.toBox(key, strings, self.objects.copy(), None)
        self.assertEquals(strings, self.strings) 
開發者ID:kuri65536,項目名稱:python-for-android,代碼行數:16,代碼來源:test_amp.py

示例5: fromString

# 需要導入模塊: from twisted.protocols import amp [as 別名]
# 或者: from twisted.protocols.amp import Argument [as 別名]
def fromString(self, inString):
        # inString is always a byte string, as defined by amp.Argument.
        return inString 
開發者ID:maas,項目名稱:maas,代碼行數:5,代碼來源:arguments.py


注:本文中的twisted.protocols.amp.Argument方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。