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


Python StrObject.call方法代碼示例

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


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

示例1: testSplit

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
    def testSplit(self):
        """
        Strings can be split.
        """

        s = StrObject(u"first second")
        result = s.call(u"split", [StrObject(u" ")])
        pieces = [obj._s for obj in unwrapList(result)]
        self.assertEqual(pieces, [u"first", u"second"])
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:11,代碼來源:test_data.py

示例2: testContainsTrue

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
    def testContainsTrue(self):
        """
        String containment tests have true positives.
        """

        haystack = StrObject(u"needle in a haystack")
        needle = StrObject(u"needle")
        result = haystack.call(u"contains", [needle])
        self.assertTrue(result.isTrue())
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:11,代碼來源:test_data.py

示例3: testMakeIterator

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
    def testMakeIterator(self):
        """
        Strings are iterable.
        """

        s = StrObject(u"cs")
        iterator = s.call(u"_makeIterator", [])
        with Ejector() as ej:
            result = iterator.call(u"next", [ej])
            objs = unwrapList(result)
            self.assertEqual(objs[0].getInt(), 0)
            self.assertEqual(objs[1]._c, u'c')
            result = iterator.call(u"next", [ej])
            objs = unwrapList(result)
            self.assertEqual(objs[0].getInt(), 1)
            self.assertEqual(objs[1]._c, u's')
            self.assertRaises(Ejecting, iterator.call, u"next", [ej])
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:19,代碼來源:test_data.py

示例4: testGet

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testGet(self):
     s = StrObject(u"index")
     result = s.call(u"get", [IntObject(2)])
     self.assertEqual(result._c, u'd')
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例5: testTrimWord

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testTrimWord(self):
     s = StrObject(u"  testing  ")
     result = s.call(u"trim", [])
     self.assertEqual(result._s, u"testing")
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例6: testTrimSpaces

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testTrimSpaces(self):
     s = StrObject(u"    ")
     result = s.call(u"trim", [])
     self.assertEqual(result._s, u"")
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例7: testLastIndexOfFail

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testLastIndexOfFail(self):
     s = StrObject(u"needle")
     result = s.call(u"lastIndexOf", [StrObject(u"x")])
     self.assertEqual(result.getInt(), -1)
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例8: testIndexOf

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testIndexOf(self):
     s = StrObject(u"needle")
     result = s.call(u"indexOf", [StrObject(u"e")])
     self.assertEqual(result.getInt(), 1)
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例9: testToUpperCaseUnicode

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testToUpperCaseUnicode(self):
     s = StrObject(u"¡Holá!")
     result = s.call(u"toUpperCase", [])
     self.assertEqual(result._s, u"¡HOLÁ!")
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例10: testToUpperCase

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testToUpperCase(self):
     s = StrObject(u"lower")
     result = s.call(u"toUpperCase", [])
     self.assertEqual(result._s, u"LOWER")
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例11: testToLowerCaseUnicode

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testToLowerCaseUnicode(self):
     s = StrObject(u"Α And Ω")
     result = s.call(u"toLowerCase", [])
     self.assertEqual(result._s, u"α and ω")
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例12: testSliceStartStop

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testSliceStartStop(self):
     s = StrObject(u"the lime in the coconut")
     result = s.call(u"slice", [IntObject(4), IntObject(8)])
     self.assertEqual(result._s, u"lime")
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例13: testSliceStart

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testSliceStart(self):
     s = StrObject(u"slice of lemon")
     result = s.call(u"slice", [IntObject(9)])
     self.assertEqual(result._s, u"lemon")
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:6,代碼來源:test_data.py

示例14: testJoin

# 需要導入模塊: from typhon.objects.data import StrObject [as 別名]
# 或者: from typhon.objects.data.StrObject import call [as 別名]
 def testJoin(self):
     s = StrObject(u"|")
     result = s.call(u"join",
             [ConstList([StrObject(u"5"), StrObject(u"42")])])
     self.assertEqual(result._s, u"5|42")
開發者ID:markrwilliams,項目名稱:typhon,代碼行數:7,代碼來源:test_data.py


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