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


Python pprint.isrecursive方法代碼示例

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


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

示例1: test_basic

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def test_basic(self):
        # Verify .isrecursive() and .isreadable() w/o recursion
        pp = pprint.PrettyPrinter()
        for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, uni("yaddayadda"),
                     bytearray(b"ghi"), True, False, None,
                     self.a, self.b):
            # module-level convenience functions
            self.assertFalse(pprint.isrecursive(safe),
                             "expected not isrecursive for %r" % (safe,))
            self.assertTrue(pprint.isreadable(safe),
                            "expected isreadable for %r" % (safe,))
            # PrettyPrinter methods
            self.assertFalse(pp.isrecursive(safe),
                             "expected not isrecursive for %r" % (safe,))
            self.assertTrue(pp.isreadable(safe),
                            "expected isreadable for %r" % (safe,)) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:18,代碼來源:test_pprint.py

示例2: test_basic

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def test_basic(self):
        # Verify .isrecursive() and .isreadable() w/o recursion
        pp = pprint.PrettyPrinter()
        for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, b"def",
                     bytearray(b"ghi"), True, False, None, ...,
                     self.a, self.b):
            # module-level convenience functions
            self.assertFalse(pprint.isrecursive(safe),
                             "expected not isrecursive for %r" % (safe,))
            self.assertTrue(pprint.isreadable(safe),
                            "expected isreadable for %r" % (safe,))
            # PrettyPrinter methods
            self.assertFalse(pp.isrecursive(safe),
                             "expected not isrecursive for %r" % (safe,))
            self.assertTrue(pp.isreadable(safe),
                            "expected isreadable for %r" % (safe,)) 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:18,代碼來源:test_pprint.py

示例3: test_basic

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def test_basic(self):
        # Verify .isrecursive() and .isreadable() w/o recursion
        verify = self.assert_
        pp = pprint.PrettyPrinter()
        for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, uni("yaddayadda"),
                     self.a, self.b):
            # module-level convenience functions
            verify(not pprint.isrecursive(safe),
                   "expected not isrecursive for %r" % (safe,))
            verify(pprint.isreadable(safe),
                   "expected isreadable for %r" % (safe,))
            # PrettyPrinter methods
            verify(not pp.isrecursive(safe),
                   "expected not isrecursive for %r" % (safe,))
            verify(pp.isreadable(safe),
                   "expected isreadable for %r" % (safe,)) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:18,代碼來源:test_pprint.py

示例4: test_knotted

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def test_knotted(self):
        # Verify .isrecursive() and .isreadable() w/ recursion
        # Tie a knot.
        self.b[67] = self.a
        # Messy dict.
        self.d = {}
        self.d[0] = self.d[1] = self.d[2] = self.d

        pp = pprint.PrettyPrinter()

        for icky in self.a, self.b, self.d, (self.d, self.d):
            self.assertTrue(pprint.isrecursive(icky), "expected isrecursive")
            self.assertFalse(pprint.isreadable(icky), "expected not isreadable")
            self.assertTrue(pp.isrecursive(icky), "expected isrecursive")
            self.assertFalse(pp.isreadable(icky), "expected not isreadable")

        # Break the cycles.
        self.d.clear()
        del self.a[:]
        del self.b[:]

        for safe in self.a, self.b, self.d, (self.d, self.d):
            # module-level convenience functions
            self.assertFalse(pprint.isrecursive(safe),
                             "expected not isrecursive for %r" % (safe,))
            self.assertTrue(pprint.isreadable(safe),
                            "expected isreadable for %r" % (safe,))
            # PrettyPrinter methods
            self.assertFalse(pp.isrecursive(safe),
                             "expected not isrecursive for %r" % (safe,))
            self.assertTrue(pp.isreadable(safe),
                            "expected isreadable for %r" % (safe,)) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:34,代碼來源:test_pprint.py

示例5: test_unreadable

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def test_unreadable(self):
        # Not recursive but not readable anyway
        pp = pprint.PrettyPrinter()
        for unreadable in type(3), pprint, pprint.isrecursive:
            # module-level convenience functions
            self.assertFalse(pprint.isrecursive(unreadable),
                             "expected not isrecursive for %r" % (unreadable,))
            self.assertFalse(pprint.isreadable(unreadable),
                             "expected not isreadable for %r" % (unreadable,))
            # PrettyPrinter methods
            self.assertFalse(pp.isrecursive(unreadable),
                             "expected not isrecursive for %r" % (unreadable,))
            self.assertFalse(pp.isreadable(unreadable),
                             "expected not isreadable for %r" % (unreadable,)) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:16,代碼來源:test_pprint.py

示例6: test_basic

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def test_basic(self):
        # Verify .isrecursive() and .isreadable() w/o recursion
        pp = pprint.PrettyPrinter()
        for safe in (2, 2.0, 2j, "abc", [3], (2,2), {3: 3}, uni("yaddayadda"),
                     self.a, self.b):
            # module-level convenience functions
            self.assertFalse(pprint.isrecursive(safe),
                             "expected not isrecursive for %r" % (safe,))
            self.assertTrue(pprint.isreadable(safe),
                            "expected isreadable for %r" % (safe,))
            # PrettyPrinter methods
            self.assertFalse(pp.isrecursive(safe),
                             "expected not isrecursive for %r" % (safe,))
            self.assertTrue(pp.isreadable(safe),
                            "expected isreadable for %r" % (safe,)) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:17,代碼來源:test_pprint.py

示例7: test_knotted

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def test_knotted(self):
        # Verify .isrecursive() and .isreadable() w/ recursion
        # Tie a knot.
        self.b[67] = self.a
        # Messy dict.
        self.d = {}
        self.d[0] = self.d[1] = self.d[2] = self.d

        verify = self.assert_
        pp = pprint.PrettyPrinter()

        for icky in self.a, self.b, self.d, (self.d, self.d):
            verify(pprint.isrecursive(icky), "expected isrecursive")
            verify(not pprint.isreadable(icky),  "expected not isreadable")
            verify(pp.isrecursive(icky), "expected isrecursive")
            verify(not pp.isreadable(icky),  "expected not isreadable")

        # Break the cycles.
        self.d.clear()
        del self.a[:]
        del self.b[:]

        for safe in self.a, self.b, self.d, (self.d, self.d):
            # module-level convenience functions
            verify(not pprint.isrecursive(safe),
                   "expected not isrecursive for %r" % (safe,))
            verify(pprint.isreadable(safe),
                   "expected isreadable for %r" % (safe,))
            # PrettyPrinter methods
            verify(not pp.isrecursive(safe),
                   "expected not isrecursive for %r" % (safe,))
            verify(pp.isreadable(safe),
                   "expected isreadable for %r" % (safe,)) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:35,代碼來源:test_pprint.py

示例8: test_unreadable

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def test_unreadable(self):
        # Not recursive but not readable anyway
        verify = self.assert_
        pp = pprint.PrettyPrinter()
        for unreadable in type(3), pprint, pprint.isrecursive:
            # module-level convenience functions
            verify(not pprint.isrecursive(unreadable),
                   "expected not isrecursive for %r" % (unreadable,))
            verify(not pprint.isreadable(unreadable),
                   "expected not isreadable for %r" % (unreadable,))
            # PrettyPrinter methods
            verify(not pp.isrecursive(unreadable),
                   "expected not isrecursive for %r" % (unreadable,))
            verify(not pp.isreadable(unreadable),
                   "expected not isreadable for %r" % (unreadable,)) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:17,代碼來源:test_pprint.py

示例9: isrecursive

# 需要導入模塊: import pprint [as 別名]
# 或者: from pprint import isrecursive [as 別名]
def isrecursive(self, object):
        return isrecursive(object) 
開發者ID:tommikaikkonen,項目名稱:prettyprinter,代碼行數:4,代碼來源:__init__.py


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