Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
vhaasteren committed Nov 9, 2023
1 parent 74ec30f commit 8b75650
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
6 changes: 3 additions & 3 deletions enterprise/pulsar.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,9 @@ def Pulsar(*args, **kwargs):
if timing_package is None:
if t2 is not None:
timing_package = "tempo2"
elif pint is not None: # pragma: no cover
elif pint is not None: # pragma: no cover
timing_package = "pint"
else: # pragma: no cover
else: # pragma: no cover
raise ValueError("No timing package available with which to load a pulsar")

# get current directory
Expand All @@ -707,7 +707,7 @@ def Pulsar(*args, **kwargs):
tim_name=reltimfile,
)
elif timing_package.lower() == "pint":
if pint is None: # pragma: no cover
if pint is None: # pragma: no cover
raise ValueError("PINT requested but PINT is not available")
if (clk is not None) and (bipm_version is None):
bipm_version = clk.split("(")[1][:-1]
Expand Down
22 changes: 18 additions & 4 deletions tests/test_pulsar.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,33 @@ class TestTimingPackageExceptions(unittest.TestCase):
def test_unkown_timing_package(self):
# initialize Pulsar class
with self.assertRaises(ValueError):
self.psr = Pulsar(datadir + "/B1855+09_NANOGrav_9yv1.gls.par", datadir + "/B1855+09_NANOGrav_9yv1.tim", timing_package='foobar')
self.psr = Pulsar(
datadir + "/B1855+09_NANOGrav_9yv1.gls.par",
datadir + "/B1855+09_NANOGrav_9yv1.tim",
timing_package="foobar",
)

def test_clk_but_no_bipm(self):
self.psr = Pulsar(datadir + "/B1855+09_NANOGrav_9yv1.gls.par", datadir + "/B1855+09_NANOGrav_9yv1.tim", clk='TT(BIPM2020)', timing_package='pint')
self.psr = Pulsar(
datadir + "/B1855+09_NANOGrav_9yv1.gls.par",
datadir + "/B1855+09_NANOGrav_9yv1.tim",
clk="TT(BIPM2020)",
timing_package="pint",
)


class TestPulsar(unittest.TestCase):
@classmethod
def setUpClass(cls):
"""Setup the Pulsar object."""

# initialize Pulsar class
cls.psr = Pulsar(datadir + "/B1855+09_NANOGrav_9yv1.gls.par", datadir + "/B1855+09_NANOGrav_9yv1.tim", drop_t2pulsar=True)
cls.psr_nodrop = Pulsar(datadir + "/B1855+09_NANOGrav_9yv1.gls.par", datadir + "/B1855+09_NANOGrav_9yv1.tim", drop_t2pulsar=False)
cls.psr = Pulsar(
datadir + "/B1855+09_NANOGrav_9yv1.gls.par", datadir + "/B1855+09_NANOGrav_9yv1.tim", drop_t2pulsar=True
)
cls.psr_nodrop = Pulsar(
datadir + "/B1855+09_NANOGrav_9yv1.gls.par", datadir + "/B1855+09_NANOGrav_9yv1.tim", drop_t2pulsar=False
)

@classmethod
def tearDownClass(cls):
Expand Down

0 comments on commit 8b75650

Please sign in to comment.