Skip to content

Commit 4ad88fe

Browse files
AlexWaygoodaisk
authored andcommitted
pythongh-110923: Fix silently skipped tests in test__opcode.py (python#110926)
1 parent d309a96 commit 4ad88fe

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Lib/test/.ruff.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ extend-exclude = [
1111
"encoded_modules/module_iso_8859_1.py",
1212
"encoded_modules/module_koi8_r.py",
1313
# TODO Fix: F811 Redefinition of unused name
14-
"test__opcode.py",
1514
"test_buffer.py",
1615
"test_ctypes/test_arrays.py",
1716
"test_ctypes/test_functions.py",

Lib/test/test__opcode.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99

1010
class OpListTests(unittest.TestCase):
11+
def check_bool_function_result(self, func, ops, expected):
12+
for op in ops:
13+
if isinstance(op, str):
14+
op = dis.opmap[op]
15+
with self.subTest(opcode=op, func=func):
16+
self.assertIsInstance(func(op), bool)
17+
self.assertEqual(func(op), expected)
18+
1119
def test_invalid_opcodes(self):
1220
invalid = [-100, -1, 255, 512, 513, 1000]
1321
self.check_bool_function_result(_opcode.is_valid, invalid, False)
@@ -47,7 +55,7 @@ def check_function(self, func, expected):
4755
check_function(self, _opcode.has_exc, dis.hasexc)
4856

4957

50-
class OpListTests(unittest.TestCase):
58+
class StackEffectTests(unittest.TestCase):
5159
def test_stack_effect(self):
5260
self.assertEqual(stack_effect(dis.opmap['POP_TOP']), -1)
5361
self.assertEqual(stack_effect(dis.opmap['BUILD_SLICE'], 0), -1)

0 commit comments

Comments
 (0)