summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/.ruff.toml1
-rw-r--r--Lib/test/test__opcode.py10
2 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/.ruff.toml b/Lib/test/.ruff.toml
index 329a3b4..ed10855 100644
--- a/Lib/test/.ruff.toml
+++ b/Lib/test/.ruff.toml
@@ -11,7 +11,6 @@ extend-exclude = [
"encoded_modules/module_iso_8859_1.py",
"encoded_modules/module_koi8_r.py",
# TODO Fix: F811 Redefinition of unused name
- "test__opcode.py",
"test_buffer.py",
"test_ctypes/test_arrays.py",
"test_ctypes/test_functions.py",
diff --git a/Lib/test/test__opcode.py b/Lib/test/test__opcode.py
index c1f612d..10f04b6 100644
--- a/Lib/test/test__opcode.py
+++ b/Lib/test/test__opcode.py
@@ -8,6 +8,14 @@ from _opcode import stack_effect
class OpListTests(unittest.TestCase):
+ def check_bool_function_result(self, func, ops, expected):
+ for op in ops:
+ if isinstance(op, str):
+ op = dis.opmap[op]
+ with self.subTest(opcode=op, func=func):
+ self.assertIsInstance(func(op), bool)
+ self.assertEqual(func(op), expected)
+
def test_invalid_opcodes(self):
invalid = [-100, -1, 255, 512, 513, 1000]
self.check_bool_function_result(_opcode.is_valid, invalid, False)
@@ -47,7 +55,7 @@ class OpListTests(unittest.TestCase):
check_function(self, _opcode.has_exc, dis.hasexc)
-class OpListTests(unittest.TestCase):
+class StackEffectTests(unittest.TestCase):
def test_stack_effect(self):
self.assertEqual(stack_effect(dis.opmap['POP_TOP']), -1)
self.assertEqual(stack_effect(dis.opmap['BUILD_SLICE'], 0), -1)