@@ -29,17 +29,25 @@ def test_fuzzy_score():
2929 """Test the fuzzy subsequence matcher."""
3030 # Empty query matches anything with a neutral score
3131 assert fuzzy_score ("" , "anything" ) == 0
32- # Contiguous and non- contiguous subsequences match
32+ # A plain substring (single contiguous run) matches, even mid-word
3333 assert fuzzy_score ("fft" , "processing › fourier analysis › fft" ) is not None
34+ assert fuzzy_score ("rota" , "rotate" ) is not None
35+ assert fuzzy_score ("bration" , "calibration" ) is not None
36+ # Acronym-style matches where every run starts at a word boundary match
3437 assert fuzzy_score ("fan" , "fourier analysis" ) is not None
3538 # A missing character or an over-long query does not match
3639 assert fuzzy_score ("xyz" , "fourier analysis" ) is None
3740 assert fuzzy_score ("abcdef" , "abc" ) is None
38- # A contiguous match scores higher than a scattered one
41+ # Scattered mid-word noise is rejected: "rota" must not match paths that
42+ # merely contain r, o, t, a as scattered mid-word runs
43+ assert fuzzy_score ("rota" , "edit › annotations › import annotations" ) is None
44+ assert fuzzy_score ("rota" , "analysis › horizontal projection" ) is None
45+ assert fuzzy_score ("abc" , "a1b2c3 def" ) is None
46+ # A contiguous match scores higher than a boundary-run one
3947 contiguous = fuzzy_score ("abc" , "abc def" )
40- scattered = fuzzy_score ("abc" , "a1b2c3 def " )
41- assert contiguous is not None and scattered is not None
42- assert contiguous > scattered
48+ boundary = fuzzy_score ("abc" , "a b c " )
49+ assert contiguous is not None and boundary is not None
50+ assert contiguous > boundary
4351
4452
4553def test_collect_commands ():
0 commit comments