Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea72ced

Browse files
Address review: use setUpClass in test_call; don't skip everything
1 parentfde9548 commitea72ced

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎Lib/test/test_call.py‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,10 @@ class FastCallTests(unittest.TestCase):
482482
]
483483

484484
# Add all the calling conventions and variants of C callables
485-
defsetUp(self):
486-
_testcapi=import_helper.import_module("_testcapi")
485+
@classmethod
486+
defsetUpClass(cls):
487+
if_testcapiisNone:
488+
return
487489
_instance=_testcapi.MethInstance()
488490
forobj,expected_selfin (
489491
(_testcapi,_testcapi),# module-level function
@@ -492,7 +494,7 @@ def setUp(self):
492494
(_testcapi.MethClass(),_testcapi.MethClass),# class method on inst.
493495
(_testcapi.MethStatic,None),# static method
494496
):
495-
self.CALLS_POSARGS.extend([
497+
cls.CALLS_POSARGS.extend([
496498
(obj.meth_varargs, (1,2), (expected_self, (1,2))),
497499
(obj.meth_varargs_keywords,
498500
(1,2), (expected_self, (1,2),NULL_OR_EMPTY)),
@@ -506,7 +508,7 @@ def setUp(self):
506508
(obj.meth_o, (123, ), (expected_self,123)),
507509
])
508510

509-
self.CALLS_KWARGS.extend([
511+
cls.CALLS_KWARGS.extend([
510512
(obj.meth_varargs_keywords,
511513
(1,2), {'x':'y'}, (expected_self, (1,2), {'x':'y'})),
512514
(obj.meth_varargs_keywords,
@@ -527,6 +529,7 @@ def check_result(self, result, expected):
527529
expected= (*expected[:-1],result[-1])
528530
self.assertEqual(result,expected)
529531

532+
@unittest.skipIf(_testcapiisNone,"requires _testcapi")
530533
deftest_vectorcall_dict(self):
531534
# Test PyObject_VectorcallDict()
532535

@@ -546,6 +549,7 @@ def test_vectorcall_dict(self):
546549
result=_testcapi.pyobject_fastcalldict(func,args,kwargs)
547550
self.check_result(result,expected)
548551

552+
@unittest.skipIf(_testcapiisNone,"requires _testcapi")
549553
deftest_vectorcall(self):
550554
# Test PyObject_Vectorcall()
551555

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp