Skip to content

Commit

Permalink
New docstrings for locit unittest.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhosk committed Sep 26, 2023
1 parent 2863af5 commit 3b789ce
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/unit/test_locit.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,18 @@ def teardown_method(self):
pass

def test_locit_name(self):
"""
User story: As a user, I will run locit with a specified locit_name and I will expect the file to be created on disk.
"""

assert os.path.exists("data/locit-input-pha.locit.zarr")

def test_locit_ant_id(self):
"""
As a user, I will run locit with a specified antenna id. I will expect the file to be created on disk containing delays and position solutions only from that antenna id.
The multiple data structure (mds) objects have a dictionary structure; locit is run to include only the specified antenna, thus if the lists are not equal there is an error.
"""

position_mds = locit(
locit_name="data/locit-input-pha.locit.zarr",
Expand All @@ -69,6 +77,12 @@ def test_locit_ant_id(self):
assert list(position_mds.keys()) == ['ant_ea25']

def test_locit_ddi(self):
"""
As a user, I will run locit with a specified DDI. I will expect the file to be created on disk containing delays and position solutions only from that DDI.
The multiple data structure (mds) objects have a dictionary structure; locit is run to include only the specified ddi. As there are multiple antenna values
all of which should include only one ddi, we check all antennae in the list requiring that only one ddi exist for each.
"""

position_mds = locit(
locit_name="data/locit-input-pha.locit.zarr",
Expand All @@ -84,6 +98,9 @@ def test_locit_ddi(self):
assert ddi == "ddi_0"

def test_locit_fit_kterm(self):
"""
As a user, I will run locit specifying fit_kterm=True and I will expect the file to be created on disk to contain a solution for the kterm.
"""

position_mds = locit(
locit_name="data/locit-input-pha.locit.zarr",
Expand All @@ -97,6 +114,9 @@ def test_locit_fit_kterm(self):
position_mds["ant_ea25"]["ddi_0"].koff_fit

def test_locit_fit_slope(self):
"""
As a user, I will run locit specifying fit_slope=False and I will expect the file to be created on disk to contain no solution for the delay slope.
"""


position_mds = locit(
Expand All @@ -111,6 +131,9 @@ def test_locit_fit_slope(self):
position_mds["ant_ea25"]["ddi_0"].slope_fit

def test_locit_elevation_limit(self):
"""
As a user, I will run locit specifying elevation_limit=90 and I will expect locit to fail because there is no available data.
"""

failed = False

Expand All @@ -132,6 +155,9 @@ def test_locit_elevation_limit(self):
assert failed == False

def test_locit_polarization(self):
"""
As a user, I will run locit specifying polarization='R' and I will expect the file to be created on disk to contain only delays for the R polarization and position solutions derived only with the R polarization.
"""

position_mds = locit(
locit_name="data/locit-input-pha.locit.zarr",
Expand All @@ -144,6 +170,9 @@ def test_locit_polarization(self):
assert position_mds["ant_ea25"].polarization == "R"

def test_locit_combine_ddis(self):
"""
As a user I will run locit specifying combine_ddis=False and I will expect the file to be created on disk to contain delays and position solutions for all DDIs.
"""

position_mds = locit(
locit_name="data/locit-input-pha.locit.zarr",
Expand All @@ -157,6 +186,9 @@ def test_locit_combine_ddis(self):
assert list(position_mds[key].keys()) == ['DECLINATION', 'DELAYS', 'ELEVATION', 'HOUR_ANGLE', 'LST', 'MODEL']

def test_locit_overwrite(self):
"""
As a user I will run locit specifying combine_ddis=False and I will expect the file to be created on disk to contain delays and position solutions for all DDIs.
"""
initial_time = os.path.getctime("data/locit-input-pha.position.zarr")

position_mds = locit(
Expand All @@ -171,6 +203,9 @@ def test_locit_overwrite(self):
assert initial_time != modified_time

def test_locit_not_overwrite(self):
"""
As a user, I will run locit specifying overwrite=False and I will expect the file to be created on disk to be not overwritten.
"""
initial_time = os.path.getctime("data/locit-input-pha.position.zarr")

try:
Expand Down

0 comments on commit 3b789ce

Please sign in to comment.