-
Notifications
You must be signed in to change notification settings - Fork 90
Changes due to the implicit index creation #175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great work @curquiza , thank you so much!
I did a quite intense code review, sorry if there is a lot of pain in going through my review :)
I do like a lot the robust testing!
I don't actually agree with using objects in a test that are coming from (or modified by) another test, I think this is not consistent, and a test should be independet and always behave in the same way if it is called alone or in a test set. Not saying this is your fault, but maybe we can fix that or at least not introduce more entangled tests :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestions :)
There is already #170 😉 |
About the removal of |
I am sorry, I didn't see #170. But I'm glad, it means we saw both that this is clearly an issue. Feel free to ignore my comments about independent tests as they all belong to that issue! |
great, let me know if you don't and I'll do a quick PR :) do you agree with those changes @bidoubiwa ? What could be the purpose of this asserts: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
I did the changes about |
c37ee08
to
ed86de1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for this!
🌮 🌮 🌮
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great !!
bors merge |
Build succeeded: |
176: Restructure code r=curquiza a=curquiza⚠️ Should be merged after the merge of #175 Breaking change: - Make the internal method `Index.create(...)` a `@classmethod` instead of a `@staticmethod`. Why? Put the logic related to an index in the `Index` class instead of the `Client` class. See the difference between static and class methods in Python: https://stackabuse.com/pythons-classmethod-and-staticmethod-explained/. - Remove the internal method `Index.get_indexes()`. Since it's not related to only one index, this method should not be present in the `Index` class. - Make the `update()` method returns an `Index` object instead of a `dict` because it's more convenient to manipulate object instead of dict. This is consitent with `client.index('movies').fetch_info()` and `client.create_index('movies)` and `client.index('movies')` Changes: - Check the type of the responses more accurately: `assert isinstance(response, Index)` Co-authored-by: Clementine Urquizar <[email protected]>
Related to meilisearch/integration-guides#48
Here is the list of changes you have to check:
get_index()
does an HTTP call and is not the main method to use anymore.index()
methodindex()
methodget_or_create_index
with the new way of usingindex()
primary_key
attribute inIndex
class. This attribute is updated when an HTTP call to the index is done (creation, update, or fetch the info). The attribute is obviously not up-to-date when using theindex()
method: the method does not do any HTTP call. Refer to the limitation section in the main issue.info()
method intofetch_info()
to make the HTTP call explicit. Now, the right usage to get the index information isclient.get_index('movies')
orclient.index('movies').fetch_info()
.get_index
from theIndex
class because not used anymore.index.py
changes might be not visible if you don't click onload diff
: