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


Python dbm.ndbm方法代碼示例

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


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

示例1: test_install_aliases

# 需要導入模塊: from future.moves import dbm [as 別名]
# 或者: from future.moves.dbm import ndbm [as 別名]
def test_install_aliases(self):
        """
        Does the install_aliases() interface monkey-patch urllib etc. successfully?
        """
        from future.standard_library import remove_hooks, install_aliases
        remove_hooks()
        install_aliases()

        from collections import Counter, OrderedDict   # backported to Py2.6
        from collections import UserDict, UserList, UserString

        # Requires Python dbm support:
        # import dbm
        # import dbm.dumb
        # import dbm.gnu
        # import dbm.ndbm

        from itertools import filterfalse, zip_longest

        from subprocess import check_output    # backported to Py2.6
        from subprocess import getoutput, getstatusoutput

        from sys import intern

        # test_support may not be available (e.g. on Anaconda Py2.6):
        # import test.support

        import urllib.error
        import urllib.parse
        import urllib.request
        import urllib.response
        import urllib.robotparser

        self.assertTrue('urlopen' in dir(urllib.request)) 
開發者ID:hughperkins,項目名稱:kgsgo-dataset-preprocessor,代碼行數:36,代碼來源:test_standard_library.py

示例2: test_future_moves_dbm

# 需要導入模塊: from future.moves import dbm [as 別名]
# 或者: from future.moves.dbm import ndbm [as 別名]
def test_future_moves_dbm(self):
        """
        Do the dbm imports work?
        """
        from future.moves import dbm
        dbm.ndbm
        from future.moves.dbm import dumb
        try:
            # Is gdbm available on Py2? If so, ensure dbm.gnu is available too:
            import gdbm
        except ImportError:
            pass
        else:
            from future.moves.dbm import gnu
        from future.moves.dbm import ndbm


# Running the following tkinter test causes the following bizzare test failure:
#
# ======================================================================
# FAIL: test_open_default_encoding (future.tests.test_builtins.BuiltinTest)
# ----------------------------------------------------------------------
# Traceback (most recent call last):
#   File "/home/user/Install/BleedingEdge/python-future/future/tests/test_builtins.py", line 1219, in test_open_default_encoding
#     self.assertEqual(fp.encoding, current_locale_encoding)
# AssertionError: 'ANSI_X3.4-1968' != 'ISO-8859-1'
#
# ----------------------------------------------------------------------
#
#     def test_future_moves_tkinter(self):
#         """
#         Do the tkinter imports work?
#         """
#         from future.moves import tkinter
#         from future.moves.tkinter import dialog
#         from future.moves.tkinter import filedialog
#         from future.moves.tkinter import scrolledtext
#         from future.moves.tkinter import simpledialog
#         from future.moves.tkinter import tix
#         from future.moves.tkinter import constants
#         from future.moves.tkinter import dnd
#         from future.moves.tkinter import colorchooser
#         from future.moves.tkinter import commondialog
#         from future.moves.tkinter import font
#         from future.moves.tkinter import messagebox 
開發者ID:hughperkins,項目名稱:kgsgo-dataset-preprocessor,代碼行數:47,代碼來源:test_standard_library.py


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