Skip to content

Commit

Permalink
Merge pull request #69 from hoverinc/fix-TableauFileObjects-pop
Browse files Browse the repository at this point in the history
Fixed recursion bug with TableauFileObjects.pop(), and added a test
  • Loading branch information
JustinGrilli authored Oct 24, 2023
2 parents 711d8aa + 101248b commit 94bca91
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
long_description=readme,
long_description_content_type='text/markdown',
name="tableau_utilities",
version="2.0.68",
version="2.0.69",
packages=[
'tableau_utilities',
'tableau_utilities.general',
Expand Down
4 changes: 2 additions & 2 deletions tableau_utilities/tableau_file/tableau_file_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ def pop(self, item):
Returns: The Tableau FileObject
"""
if isinstance(item, int):
return self.pop(item)
return super().pop(item)
else:
return self.pop(self.index(item))
return super().pop(self.index(item))

def xml(self):
""" Returns the TableauFileObjects as an XML Element """
Expand Down
15 changes: 15 additions & 0 deletions tableau_utilities/test_tableau_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ def test_column_attributes():
assert value == getattr(column2, attr)


# TableauFileObjects().pop()
def test_tableau_file_objects_pop():
column = tfo.Column(**{
'name': '[FRIENDLY_CALC]',
'caption': 'Friendly Calc',
'datatype': 'integer',
'type': 'ordinal',
'role': 'dimension',
'desc': 'Nice and friendly',
})
columns = tfo.TableauFileObjects([column])
columns.pop(column)
assert len(columns) == 0


# Datasource().DatasourceItems
def test_datasource_items():
shutil.copyfile(f'resources/{EXTRACT_PATH}', EXTRACT_PATH)
Expand Down

0 comments on commit 94bca91

Please sign in to comment.