-
Notifications
You must be signed in to change notification settings - Fork 118
Update ViewService.py #1271
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
base: master
Are you sure you want to change the base?
Update ViewService.py #1271
Conversation
Added `get_element_names` parameter to `get_native_view` function
TM1py/Services/ViewService.py
Outdated
return self.get_native_view(cube_name=cube_name, view_name=view_name, private=private) | ||
|
||
def get_native_view(self, cube_name: str, view_name: str, private=False, **kwargs) -> NativeView: | ||
def get_native_view(self, cube_name: str, view_name: str, private=False, get_element_names: bool = True, **kwargs) -> NativeView: |
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.
Maybe rename to skip_element_names
with default False
.
In most other tm1py functions, we use the skip terminology for optional behaviour changes.
I realized afterwards that I also wanted to change the Element properties, so I made it so that you can set the element properties. If you don't want the element names, you can pass an empty list. Although it's a little less clear how to exclude names, it's more in line with other parts of TM1py when it comes to object properties and it's more flexible |
I like this. Thank you! please add a test case and we can merge it |
Added test cases for retrieving different element properties
Added element_properties argument to the generic "get" function. For MDXViews, it is ignored
I added a test case, and I also added the argument to the generic "get" function (which the test case also tests) |
self.assertIsInstance(view, NativeView) | ||
self.assertEqual(view.name, self.native_view_name) | ||
self.assertIsInstance(native_view, NativeView) | ||
self.assertEqual(view, native_view) |
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.
I think here we're not actually testing that the response is different depending on the element_properties
provided.
I think it would make sense to create new, separate test cases for common element_properties
values.
If we leave this test as is, it will provide good confirmation that the default behavior hasn't changed.
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.
Oh okay, that makes sense. In that case I may need some help with creating the tests. I am unsure how these self.assert functions work/how to use them for this pull request
Added
get_element_names
parameter toget_native_view
function