Skip to content

Commit

Permalink
Merge pull request #11 from Kristianuruplarsen/master
Browse files Browse the repository at this point in the history
bugfix: get_tables
  • Loading branch information
elben10 authored Mar 11, 2020
2 parents ccfa7f1 + 6bb7d96 commit bb34756
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pydst/pydst.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ def get_tables(self, subjects=None, inactive_tables=False, lang=None):
'format': 'JSON',
'includeInactive': 'true' if inactive_tables else None
}

if not subjects is None:
query_dict['subjects'] = subjects


url = utils.construct_url(self.base_url,
self.version,
Expand Down
6 changes: 6 additions & 0 deletions tests/test_pydst.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,9 @@ def test_no_inactive_tables_if_false():

def test_inactive_tables_if_true():
assert pydst.Dst().get_tables(inactive_tables=True).active.all() == False


# test that calling pydst.Dst().get_tables with specified subjects only returns
# a subset of the full tables list
def test_get_tables_can_filter():
assert pydst.Dst().get_tables(subjects = ['02']).shape != pydst.Dst().get_tables().shape

0 comments on commit bb34756

Please sign in to comment.