Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #295 #311

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/runtests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
shell: bash -l {0}
if: matrix.os == 'macos-latest'
run: |
python -m pip install --upgrade --no-deps --force-reinstall tables
python -m pip install --upgrade --force-reinstall tables

# Runs test suite and calculates coverage
- name: run test suite
Expand Down
11 changes: 6 additions & 5 deletions dascore/core/spool.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,11 +561,12 @@ def __init__(self, data: PatchType | Sequence[PatchType] | None = None):
def __rich__(self):
base = super().__rich__()
df = self._df
t1, t2 = df["time_min"].min(), df["time_max"].max()
tmin = get_nice_text(t1)
tmax = get_nice_text(t2)
duration = get_nice_text(t2 - t1)
base += Text(f"\n Time Span: <{duration}> {tmin} to {tmax}")
if len(df):
t1, t2 = df["time_min"].min(), df["time_max"].max()
tmin = get_nice_text(t1)
tmax = get_nice_text(t2)
duration = get_nice_text(t2 - t1)
base += Text(f"\n Time Span: <{duration}> {tmin} to {tmax}")
return base

def _load_patch(self, kwargs) -> Self:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_core/test_spool.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ def test_updated_spool_eq(self, random_spool):
"""Ensure updating the spool doesnt change equality."""
assert random_spool == random_spool.update()

def test_empty_spool_str(self):
"""Ensure and empty spool has a string rep. See #295."""
spool = dc.spool([])
spool_str = str(spool)
assert "Spool" in spool_str


class TestSpoolEquals:
"""Tests for spool equality."""
Expand Down
Loading