diff options
Diffstat (limited to 'Lib/test/test_traceback.py')
-rw-r--r-- | Lib/test/test_traceback.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index ac49278..6ae8cf5 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -4619,7 +4619,31 @@ class MiscTest(unittest.TestCase): @cpython_only def test_suggestions_extension(self): # Check that the C extension is available - import _suggestions # noqa: F401 + import _suggestions + + self.assertEqual( + _suggestions._generate_suggestions( + ["hello", "world"], + "hell" + ), + "hello" + ) + self.assertEqual( + _suggestions._generate_suggestions( + ["hovercraft"], + "eels" + ), + None + ) + + # gh-131936: _generate_suggestions() doesn't accept list subclasses + class MyList(list): + pass + + with self.assertRaises(TypeError): + _suggestions._generate_suggestions(MyList(), "") + + class TestColorizedTraceback(unittest.TestCase): |