Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Clarify default behaviour of extract / Add tests for matching strings #142

Merged
merged 13 commits into from
Nov 1, 2016
Merged

Clarify default behaviour of extract / Add tests for matching strings #142

merged 13 commits into from
Nov 1, 2016

Conversation

DavidCEllis
Copy link
Contributor

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).

@DavidCEllis
Copy link
Contributor Author

DavidCEllis commented Oct 30, 2016

Note that I don't think #141 or #129 can be resolved fully without either changing how WRatio works or replacing it as the default processor.

@josegonzalez
Copy link
Contributor

@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 :)

@josegonzalez josegonzalez merged commit 844ef63 into seatgeek:master Nov 1, 2016
@josegonzalez
Copy link
Contributor

Released in 0.13.0.

@josegonzalez josegonzalez mentioned this pull request Nov 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Finding best matches in a list gives wrong results.
2 participants