Python support.get_attribute方法代码示例

本文整理汇总了Python中test.support.get_attribute方法的典型用法代码示例。如果您正苦于以下问题:Python support.get_attribute方法的具体用法?Python support.get_attribute怎么用?Python support.get_attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在test.support的用法示例。


Python support.get_attribute方法代码示例

在下文中一共展示了support.get_attribute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_attribute

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_get_attribute(self):
        self.assertEqual(support.get_attribute(self, "test_get_attribute"),
                        self.test_get_attribute)
        self.assertRaises(unittest.SkipTest, support.get_attribute, self, "foo")
        with self.assertRaisesRegexp(unittest.SkipTest, 'unittest'):
            support.get_attribute(unittest, 'foo')
        with self.assertRaisesRegexp(unittest.SkipTest, 'ClassicClass'):
            support.get_attribute(ClassicClass, 'foo')
        with self.assertRaisesRegexp(unittest.SkipTest, 'ClassicClass'):
            support.get_attribute(ClassicClass(), 'foo')
        with self.assertRaisesRegexp(unittest.SkipTest, 'NewStyleClass'):
            support.get_attribute(NewStyleClass, 'foo')
        with self.assertRaisesRegexp(unittest.SkipTest, 'NewStyleClass'):
            support.get_attribute(NewStyleClass(), 'foo') 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:test_test_support.py

示例2: test_get_attribute

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_get_attribute(self):
        self.assertEqual(support.get_attribute(self, "test_get_attribute"),
                        self.test_get_attribute)
        self.assertRaises(unittest.SkipTest, support.get_attribute, self, "foo") 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:6,代码来源:test_support.py

示例3: test_symlink_keywords

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_symlink_keywords(self):
        symlink = support.get_attribute(os, "symlink")
        try:
            symlink(src='target', dst=support.TESTFN,
                target_is_directory=False, dir_fd=None)
        except (NotImplementedError, OSError):
            pass  # No OS support or unprivileged user


# Test attributes on return values from os.*stat* family. 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:12,代码来源:test_os.py

示例4: test_connect_starttls

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_connect_starttls(self):
        support.get_attribute(smtplib, 'SMTP_SSL')
        context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
        with support.transient_internet(self.testServer):
            server = smtplib.SMTP(self.testServer, self.remotePort)
            try:
                server.starttls(context=context)
            except smtplib.SMTPException as e:
                if e.args[0] == 'STARTTLS extension not supported by server.':
                    unittest.skip(e.args[0])
                else:
                    raise
            server.ehlo()
            server.quit() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:16,代码来源:test_smtpnet.py

示例5: test_connect

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_connect(self):
        support.get_attribute(smtplib, 'SMTP_SSL')
        with support.transient_internet(self.testServer):
            server = smtplib.SMTP_SSL(self.testServer, self.remotePort)
            server.ehlo()
            server.quit() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:8,代码来源:test_smtpnet.py

示例6: test_connect_default_port

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_connect_default_port(self):
        support.get_attribute(smtplib, 'SMTP_SSL')
        with support.transient_internet(self.testServer):
            server = smtplib.SMTP_SSL(self.testServer)
            server.ehlo()
            server.quit() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:8,代码来源:test_smtpnet.py

示例7: test_connect_using_sslcontext_verified

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_connect_using_sslcontext_verified(self):
        with support.transient_internet(self.testServer):
            can_verify = check_ssl_verifiy(self.testServer, self.remotePort)
            if not can_verify:
                self.skipTest("SSL certificate can't be verified")

        support.get_attribute(smtplib, 'SMTP_SSL')
        context = ssl.create_default_context()
        with support.transient_internet(self.testServer):
            server = smtplib.SMTP_SSL(self.testServer, self.remotePort, context=context)
            server.ehlo()
            server.quit() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:14,代码来源:test_smtpnet.py

示例8: test_refleaks_in_classmethod___init__

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_refleaks_in_classmethod___init__(self):
        gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')
        cm = classmethod(None)
        refs_before = gettotalrefcount()
        for i in range(100):
            cm.__init__(None)
        self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10) 
开发者ID:bkerler,项目名称:android_universal,代码行数:9,代码来源:test_descr.py

示例9: test_refleaks_in_staticmethod___init__

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_refleaks_in_staticmethod___init__(self):
        gettotalrefcount = support.get_attribute(sys, 'gettotalrefcount')
        sm = staticmethod(None)
        refs_before = gettotalrefcount()
        for i in range(100):
            sm.__init__(None)
        self.assertAlmostEqual(gettotalrefcount() - refs_before, 0, delta=10) 
开发者ID:bkerler,项目名称:android_universal,代码行数:9,代码来源:test_descr.py

示例10: test_interrupted_write

# 需要导入模块: from test import support [as 别名]
# 或者: from test.support import get_attribute [as 别名]
def test_interrupted_write(self):
        # BaseHandler._write() and _flush() have to write all data, even if
        # it takes multiple send() calls.  Test this by interrupting a send()
        # call with a Unix signal.
        threading = support.import_module("threading")
        pthread_kill = support.get_attribute(signal, "pthread_kill")

        def app(environ, start_response):
            start_response("200 OK", [])
            return [bytes(support.SOCK_MAX_SIZE)]

        class WsgiHandler(NoLogRequestHandler, WSGIRequestHandler):
            pass

        server = make_server(support.HOST, 0, app, handler_class=WsgiHandler)
        self.addCleanup(server.server_close)
        interrupted = threading.Event()

        def signal_handler(signum, frame):
            interrupted.set()

        original = signal.signal(signal.SIGUSR1, signal_handler)
        self.addCleanup(signal.signal, signal.SIGUSR1, original)
        received = None
        main_thread = threading.get_ident()

        def run_client():
            http = HTTPConnection(*server.server_address)
            http.request("GET", "/")
            with http.getresponse() as response:
                response.read(100)
                # The main thread should now be blocking in a send() system
                # call.  But in theory, it could get interrupted by other
                # signals, and then retried.  So keep sending the signal in a
                # loop, in case an earlier signal happens to be delivered at
                # an inconvenient moment.
                while True:
                    pthread_kill(main_thread, signal.SIGUSR1)
                    if interrupted.wait(timeout=float(1)):
                        break
                nonlocal received
                received = len(response.read())
            http.close()

        background = threading.Thread(target=run_client)
        background.start()
        server.handle_request()
        background.join()
        self.assertEqual(received, support.SOCK_MAX_SIZE - 100) 
开发者ID:ShikyoKira,项目名称:Project-New-Reign---Nemesis-Main,代码行数:51,代码来源:test_wsgiref.py

本文标签属性:

示例:示例英语

代码:代码编程

Python:python怎么读

上一篇:Python quaternions.quat2mat方法代码示例
下一篇:肖凯中个人资料及其影响(肖凯中个人资料)

为您推荐