Skip to content
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

Implement equality on Cell objects #1061

Closed
chisvi opened this issue Jun 14, 2022 · 3 comments · Fixed by #1063
Closed

Implement equality on Cell objects #1061

chisvi opened this issue Jun 14, 2022 · 3 comments · Fixed by #1063

Comments

@chisvi
Copy link
Contributor

chisvi commented Jun 14, 2022

Is your feature request related to a problem? Please describe.
When writing tests for code that makes use of gspread, we found a pretty tedious task to compare Cell objects, since there's no way to directly compare one instance to another.

Describe the solution you'd like
Be able to comparte Cell objects instances (e.g. cell == another_cell). Taking a look at the code, two Cell instances should be equal when they are placed in the same row and col and contain the same value, so it should be easy to implement the corresponding __eq__ method.

Describe alternatives you've considered
Right now, as a workaround, we're doing assertions on each Cell instance attributes (e.g. cell.row == another_cell.row and cell.col == another_cell.col and cell.value == another_cell.value).

Additional context
I've seen that this feature was already requested here, but was closed without an answer to this request, therefore I decided to open a specific feature request for it.

@lavigne958 lavigne958 self-assigned this Jun 14, 2022
@lavigne958 lavigne958 added Feature Request good first issue Need investigation This issue needs to be tested or investigated labels Jun 14, 2022
@lavigne958 lavigne958 added this to the 5.5.0 milestone Jun 14, 2022
@lavigne958
Copy link
Collaborator

Hi this is a nice feature.

I can definitely add it to gspread.

Yes it was requested a long time ago but back in that days the API used to represent objects using XML and a Cell object required a complete XML tree or now it's a simple API call that results a JSON with a list of values (meaning I don't want to blame the people that decided not to do it back in that days 😉 )

@chisvi
Copy link
Contributor Author

chisvi commented Jun 14, 2022

That's great! I would like to contribute by adding this feature if that's ok 🙂

@lavigne958
Copy link
Collaborator

sure 😃 , please feel free to contribute, there is a contributing guidelines.

Feel free to fork this repo and add a PR I'll review it.

@lavigne958 lavigne958 removed the Need investigation This issue needs to be tested or investigated label Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants