This repository has been archived by the owner on Aug 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 875
Clarify default behaviour of extract / Add tests for matching strings #142
Merged
Conversation
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
Added support for hypothesis to travis config. Hypothesis based tests are skipped on Python 2.6 and pypy3. Added .hypothesis/ folder to gitignore
…to change in the future. Added warning if the processor reduces the input query to an empty string.
Removed redundant check from test.
…s as a processor.
Reordered test imports
@DavidCEllis Ping me in a week if I haven't reviewed by then. This will definitely require at least a minor release - wow I haven't done a major - but I need to understand a bit whats going on. Thanks for the extra tests! Much appreciated :) |
Released in 0.13.0. |
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
I've made a number of changes aimed at fixing or clarifying some of the issues relating to how the functions in 'process' work (and testing them).
I'm not suggesting this for an immediate merge. With these changes I've attempted to maintain current behaviour other than making sure processors are applied if provided - and applied to both query and choices. I have not changed any of the tests that existed before and they all still pass.
This should close #77 and #129 (although in the latter case it merely issues a warning explaining what is going on).
There's some reorganisation of the extract functions - default behaviours are now provided as default arguments in the extract processes. I think this helps make it clear what processes are being used without having to look inside the functions.
If the processor is going to turn the query into an empty string it now issues a UserWarning as nothing will match - it might be worth turning this into an exception.
I've also added some tests to make sure that identical strings are always returned as a match. Other strings may also be returned due to processing/partial matches but the identical string should always be in the list.
These new tests use pytest and Hypothesis. I've separated them out into their own test files so they won't interfere with running the test suite without pytest or Hypothesis (also the hypothesis tests are very slow compared to the other tests). The Travis config has been edited to install hypothesis (skipped on python 2.6 / pypy3 as Hypothesis does not support these versions of python).