当前位置: 首页>>代码示例>>Python>>正文


Python support.check_impl_detail函数代码示例

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


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

示例1: test_no_len_for_infinite_repeat

 def test_no_len_for_infinite_repeat(self):
     # The repeat() object can also be infinite
     if support.check_impl_detail(pypy=True):
         # 3.4 (PEP 424) behavior
         self.assertEqual(len(repeat(None)), NotImplemented)
     else:
         self.assertRaises(TypeError, len, repeat(None))
开发者ID:Qointum,项目名称:pypy,代码行数:7,代码来源:test_iterlen.py

示例2: test_invalid_sum

 def test_invalid_sum(self):
     pos = dict(lineno=2, col_offset=3)
     m = ast.Module([ast.Expr(ast.expr(**pos), **pos)])
     with self.assertRaises(TypeError) as cm:
         compile(m, "<test>", "exec")
     if support.check_impl_detail():
         self.assertIn("but got <_ast.expr", str(cm.exception))
开发者ID:timm,项目名称:timmnix,代码行数:7,代码来源:test_ast.py

示例3: test_builtin_function

 def test_builtin_function(self):
     eq = self.assertEqual
     # Functions
     eq(repr(hash), "<built-in function hash>")
     # Methods
     if check_impl_detail(pypy=False):
         self.assertTrue(repr("".split).startswith("<built-in method split of str object at 0x"))
开发者ID:Qointum,项目名称:pypy,代码行数:7,代码来源:test_reprlib.py

示例4: test_invalid_identitifer

 def test_invalid_identitifer(self):
     m = ast.Module([ast.Expr(ast.Name(42, ast.Load()))])
     ast.fix_missing_locations(m)
     with self.assertRaises(TypeError) as cm:
         compile(m, "<test>", "exec")
     if support.check_impl_detail():
         self.assertIn("identifier must be of type str", str(cm.exception))
开发者ID:timm,项目名称:timmnix,代码行数:7,代码来源:test_ast.py

示例5: test_basic_script

 def test_basic_script(self):
     with temp_dir() as script_dir:
         script_name = _make_test_script(script_dir, 'script')
         package = '' if support.check_impl_detail(pypy=True) else None
         self._check_script(script_name, script_name, script_name,
                            script_dir, package,
                            importlib.machinery.SourceFileLoader)
开发者ID:timm,项目名称:timmnix,代码行数:7,代码来源:test_cmd_line_script.py

示例6: test_one

def test_one(n):
    global mutate, dict1, dict2, dict1keys, dict2keys

    # Fill the dicts without mutating them.
    mutate = 0
    dict1keys = fill_dict(dict1, range(n), n)
    dict2keys = fill_dict(dict2, range(n), n)

    # Enable mutation, then compare the dicts so long as they have the
    # same size.
    mutate = 1
    if verbose:
        print("trying w/ lengths", len(dict1), len(dict2), end=' ')
    while dict1 and len(dict1) == len(dict2):
        if verbose:
            print(".", end=' ')
        try:
            c = dict1 == dict2
        except RuntimeError:
            # CPython never raises RuntimeError here, but other implementations
            # might, and it's fine.
            if check_impl_detail(cpython=True):
                raise
    if verbose:
        print()
开发者ID:rfk,项目名称:talk-pypyjs-what-how-why,代码行数:25,代码来源:test_mutants.py

示例7: test_invalid_string

 def test_invalid_string(self):
     m = ast.Module([ast.Expr(ast.Str(42))])
     ast.fix_missing_locations(m)
     with self.assertRaises(TypeError) as cm:
         compile(m, "<test>", "exec")
     if support.check_impl_detail():
         self.assertIn("string must be of type str or uni", str(cm.exception))
开发者ID:timm,项目名称:timmnix,代码行数:7,代码来源:test_ast.py

示例8: test_main

def test_main(verbose=None):
    from test import test_code
    run_doctest(test_code, verbose)
    tests = [CodeTest, CodeConstsTest, CodeWeakRefTest]
    if check_impl_detail(cpython=True) and ctypes is not None:
        tests.append(CoExtra)
    run_unittest(*tests)
开发者ID:1st1,项目名称:cpython,代码行数:7,代码来源:test_code.py

示例9: test_popitem

    def test_popitem(self):
        # dict.popitem()
        for copymode in -1, +1:
            # -1: b has same structure as a
            # +1: b is a.copy()
            for log2size in range(12):
                size = 2**log2size
                a = {}
                b = {}
                for i in range(size):
                    a[repr(i)] = i
                    if copymode < 0:
                        b[repr(i)] = i
                if copymode > 0:
                    b = a.copy()
                for i in range(size):
                    ka, va = ta = a.popitem()
                    self.assertEqual(va, int(ka))
                    kb, vb = tb = b.popitem()
                    self.assertEqual(vb, int(kb))
                    if support.check_impl_detail():
                        self.assertFalse(copymode < 0 and ta != tb)
                self.assertFalse(a)
                self.assertFalse(b)

        d = {}
        self.assertRaises(KeyError, d.popitem)
开发者ID:wdv4758h,项目名称:ZipPy,代码行数:27,代码来源:test_dict.py

示例10: test_c_buffer_raw

    def test_c_buffer_raw(self):
        buf = c_buffer(32)

        buf.raw = memoryview(b"Hello, World")
        self.assertEqual(buf.value, b"Hello, World")
        if support.check_impl_detail():
            self.assertRaises(TypeError, setattr, buf, "value", memoryview(b"abc"))
        self.assertRaises(ValueError, setattr, buf, "raw", memoryview(b"x" * 100))
开发者ID:timm,项目名称:timmnix,代码行数:8,代码来源:test_strings.py

示例11: test_select_mutated

 def test_select_mutated(self):
     a = []
     class F:
         def fileno(self):
             del a[-1]
             return sys.__stdout__.fileno()
     a[:] = [F()] * 10
     result = select.select([], a, [])
     # CPython: 'a' ends up with 5 items, because each fileno()
     # removes an item and at the middle the iteration stops.
     # PyPy: 'a' ends up empty, because the iteration is done on
     # a copy of the original list: fileno() is called 10 times.
     if support.check_impl_detail(cpython=True):
         self.assertEqual(len(result[1]), 5)
         self.assertEqual(len(a), 5)
     if support.check_impl_detail(pypy=True):
         self.assertEqual(len(result[1]), 10)
         self.assertEqual(len(a), 0)
开发者ID:renstrom,项目名称:gevent,代码行数:18,代码来源:test_select.py

示例12: testOpenDel

 def testOpenDel(self):
     # "Test opening and deleting a file many times"
     self.createTempFile()
     for i in range(10000):
         if support.check_impl_detail(pypy=True):
             with BZ2File(self.filename) as o:
                 pass
         else:
             o = BZ2File(self.filename)
             del o
开发者ID:wdv4758h,项目名称:ZipPy,代码行数:10,代码来源:test_bz2.py

示例13: test_script_compiled

 def test_script_compiled(self):
     with temp_dir() as script_dir:
         script_name = _make_test_script(script_dir, 'script')
         py_compile.compile(script_name, doraise=True)
         os.remove(script_name)
         pyc_file = support.make_legacy_pyc(script_name)
         package = '' if support.check_impl_detail(pypy=True) else None
         self._check_script(pyc_file, pyc_file,
                            pyc_file, script_dir, package,
                            importlib.machinery.SourcelessFileLoader)
开发者ID:timm,项目名称:timmnix,代码行数:10,代码来源:test_cmd_line_script.py

示例14: test_bad_indentation

 def test_bad_indentation(self):
     err = self.get_exception_format(self.syntax_error_bad_indentation,
                                     IndentationError)
     self.assertEqual(len(err), 4)
     self.assertEqual(err[1].strip(), "print(2)")
     if check_impl_detail():
         # on CPython, there is a "^" at the end of the line on PyPy,
         # there is a "^" too, but at the start, more logically
         self.assertIn("^", err[2])
         self.assertEqual(err[1].find(")"), err[2].find("^"))
开发者ID:Qointum,项目名称:pypy,代码行数:10,代码来源:test_traceback.py

示例15: test_issue9319

 def test_issue9319(self):
     path = os.path.dirname(__file__)
     try:
         imp.find_module("badsyntax_pep3120", [path])
     except SyntaxError:
         pass
     else:
         # PyPy's find_module won't raise a SyntaxError when checking
         # the file's magic encoding comment, the point of the test
         # is to ensure no seg fault anyway
         self.assertTrue(support.check_impl_detail(cpython=False))
开发者ID:wdv4758h,项目名称:ZipPy,代码行数:11,代码来源:test_imp.py


注:本文中的test.support.check_impl_detail函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。