forked from ArchipelagoMW/Archipelago
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Fix auto-fill in the text client when clicking on a hint sugges…
…tion (ArchipelagoMW#3267)
- Loading branch information
Showing
4 changed files
with
64 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import unittest | ||
|
||
from Utils import get_intended_text, get_input_text_from_response | ||
|
||
|
||
class TestClient(unittest.TestCase): | ||
def test_autofill_hint_from_fuzzy_hint(self) -> None: | ||
tests = ( | ||
("item", ["item1", "item2"]), # Multiple close matches | ||
("itm", ["item1", "item21"]), # No close match, multiple option | ||
("item", ["item1"]), # No close match, single option | ||
("item", ["\"item\" 'item' (item)"]), # Testing different special characters | ||
) | ||
|
||
for input_text, possible_answers in tests: | ||
item_name, usable, response = get_intended_text(input_text, possible_answers) | ||
self.assertFalse(usable, "This test must be updated, it seems get_fuzzy_results behavior changed") | ||
|
||
hint_command = get_input_text_from_response(response, "hint") | ||
self.assertIsNotNone(hint_command, | ||
"The response to fuzzy hints is no longer recognized by the hint autofill") | ||
self.assertEqual(hint_command, f"!hint {item_name}", | ||
"The hint command autofilled by the response is not correct") |