Skip to content

Commit

Permalink
Updated unit tests and removed unecessary import
Browse files Browse the repository at this point in the history
  • Loading branch information
rngeorge committed Jun 3, 2020
1 parent 7d78529 commit eed7eef
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
1 change: 0 additions & 1 deletion gwpy/table/io/losc.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

"""Fetch and parse an event catalog from GWOSC.
"""
import json
import numbers
from collections import OrderedDict

Expand Down
15 changes: 6 additions & 9 deletions gwpy/table/tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,21 +742,18 @@ def test_fetch_open_data(self):
except (URLError, SSLError) as exc: # pragma: no-cover
pytest.skip(str(exc))
assert len(table)
assert {"L_peak", "distance", "mass1"}.intersection(table.colnames)
assert {"mass_1_source", "luminosity_distance", "chi_eff"}.intersection(table.colnames)
# check unit parsing worked
assert table["distance"].unit == "Mpc"
# check that masking worked (needs table to be sorted)
gw170818 = table.loc["GW170818"]
assert isinstance(gw170818["snr_pycbc"], MaskedConstant)
assert table["luminosity_distance"].unit == "Mpc"

def test_fetch_open_data_kwargs(self):
try:
table = self.TABLE.fetch_open_data(
"GWTC-1-confident",
selection="mass1 < 5",
columns=["name", "mass1", "mass2", "distance"])
selection="mass_1_source < 5",
columns=["name","mass_1_source","mass_2_source", "luminosity_distance"])
except (URLError, SSLError) as exc: # pragma: no-cover
pytest.skip(str(exc))
assert len(table) == 1
assert table[0]["name"] == "GW170817"
assert set(table.colnames) == {"name", "mass1", "mass2", "distance"}
assert table[0]["name"] == "GW170817_R1"
assert set(table.colnames) == {"name","mass_1_source","mass_2_source", "luminosity_distance"}

0 comments on commit eed7eef

Please sign in to comment.