Skip to content

Commit bf0e8aa

Browse files
committed
Add some tests.
1 parent e0efc44 commit bf0e8aa

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

Lib/test/test_traceback.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4619,7 +4619,20 @@ 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(_suggestions._generate_suggestions(["hello", "world"], "hell"),
4625+
"hello")
4626+
self.assertEqual(_suggestions._generate_suggestions(["hovercraft"], "eels"),
4627+
None)
4628+
4629+
# gh-131936: _Py_CalculateSuggestions wanted exactly a list
4630+
class MyList(list):
4631+
def __getitem__(self, *_):
4632+
raise RuntimeError("evil")
4633+
4634+
self.assertEqual(_suggestions._generate_suggestions(MyList(["spanish", "inquisition"]), "spani"),
4635+
"spanish")
46234636

46244637

46254638
class TestColorizedTraceback(unittest.TestCase):

0 commit comments

Comments
 (0)