Skip to content

Commit e5ca087

Browse files
committed
Add a test.
1 parent ec39835 commit e5ca087

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

Lib/test/test_traceback.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4619,7 +4619,31 @@ def test_levenshtein_distance_short_circuit(self):
46194619
@cpython_only
46204620
def test_suggestions_extension(self):
46214621
# Check that the C extension is available
4622-
import _suggestions # noqa: F401
4622+
import _suggestions
4623+
4624+
self.assertEqual(
4625+
_suggestions._generate_suggestions(
4626+
["hello", "world"],
4627+
"hell"
4628+
),
4629+
"hello"
4630+
)
4631+
self.assertEqual(
4632+
_suggestions._generate_suggestions(
4633+
["hovercraft"],
4634+
"eels"
4635+
),
4636+
None
4637+
)
4638+
4639+
# gh-131936: _generate_suggestions didn't check for exactly a list
4640+
class MyList(list):
4641+
pass
4642+
4643+
with self.assertRaises(TypeError):
4644+
_suggestions._generate_suggestions(MyList(), "")
4645+
4646+
46234647

46244648

46254649
class TestColorizedTraceback(unittest.TestCase):

0 commit comments

Comments
 (0)