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

#27: Added getitem method and test #29

Merged

Conversation

umitbuyuksahin
Copy link
Contributor

Fixes: #27

@umitbuyuksahin umitbuyuksahin self-assigned this May 10, 2022
@umitbuyuksahin umitbuyuksahin merged commit 30e18e8 into master May 10, 2022
@umitbuyuksahin umitbuyuksahin deleted the feature/#27-make-mockcontextrunwrapper-subscriptable branch May 10, 2022 08:19
def __getattr__(self, name):
return self._mock_context.__getattr__(name)

def __getitem__(self, item):
return self._mock_context._data[item]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@umitbuyuksahin I am not sure, if this is correct for all cases, because I think, getitem is only available in case you have a variadic udf and in that case, you don't have getattr. Also, the columns names for variadic udfs are only number, in the current implementation they can be anything. A proper solution would have been to introduce an option to the MockMetadata that you want to mock a variadic udf. Please, add an issue to this project to fix this.

Copy link
Contributor Author

@umitbuyuksahin umitbuyuksahin May 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getattr is not available for variadic while getitem is available for both case.
The ticket(#30) is created for that

MarleneKress79789 pushed a commit that referenced this pull request May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Product feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make MockContextRunWrapper subscriptable
3 participants