Skip to content

Commit

Permalink
pythongh-110923: Don't silently skip tests in test__opcode.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Oct 16, 2023
1 parent c2192a2 commit 6951f13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion Lib/test/.ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 9 additions & 1 deletion Lib/test/test__opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@


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)
Expand Down Expand Up @@ -47,7 +55,7 @@ def check_function(self, func, expected):
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)
Expand Down

0 comments on commit 6951f13

Please sign in to comment.