Update test_api_helpers.py for new processor functions #146
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates test_api_helpers.py to allow it to function after the string and Unicode processor functions are updated to return inner functions, so that they can adjust to the state of the CapsLock LED.
Changes
Add two context object classes, so that the behavior of
to_US_keystrokes
andunicode_keystrokes
can be evaluated after they are turned into functions that return functions (that return lists). In the simple case, the function can just have(ctx)
added on the end. In the case whereto_US_keystrokes
is given a non-ASCII character to process, it returns a list with the Unicode inner function inside, so that needs to be extracted from the list returned byto_US_keystrokes
and then given the context object in a new call, finally getting the combo list returned by the inner function ofunicode_keystrokes
.One context object class is for the normal state of CapsLock OFF, the other is for testing the behavior when CapsLock is ON. Some test conditions have been added to test the CapsLock ON behavior.
All tests are passing for me.
Related to issue #128, and pull request #129 (which will close issue #128).
Checklist