Skip to content

Commit

Permalink
Merge pull request #28 from d-chambers/coord_repr
Browse files Browse the repository at this point in the history
Fix repr for integer valued InterpCoordinate.
  • Loading branch information
atrabattoni authored Dec 26, 2024
2 parents 5fdf29b + c8962ef commit 99ba7fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/test_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,11 @@ def test_len(self):
)
assert len(InterpCoordinate(dict(tie_indices=[], tie_values=[]))) == 0

def test_repr(self):
# TODO
pass
@pytest.mark.parametrize("valid_input", valid)
def test_repr(self, valid_input):
coord = InterpCoordinate(data=valid_input)
my_coord = repr(coord)
assert isinstance(my_coord, str)

def test_equals(self):
coord1 = InterpCoordinate({"tie_indices": [0, 8], "tie_values": [100.0, 900.0]})
Expand Down
2 changes: 2 additions & 0 deletions xdas/core/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,8 @@ def __repr__(self):
start = format_datetime(self.tie_values[0])
end = format_datetime(self.tie_values[-1])
return f"{start} to {end}"
else:
return f"{self.tie_values[0]} to {self.tie_values[-1]}"

def __getitem__(self, item):
if isinstance(item, slice):
Expand Down

0 comments on commit 99ba7fd

Please sign in to comment.