Skip to content

Commit

Permalink
unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
smcguire-cmu committed Nov 25, 2024
1 parent 21bb0d1 commit 527d187
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 7 additions & 2 deletions src/lsdb/catalog/dataset/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ def __repr__(self):
return self._ddf.__repr__()

def _repr_html_(self):
# pylint: disable=protected-access
data = self._repr_data().to_html(max_rows=5, show_dimensions=False, notebook=True)
return f"<div><strong>lsdb Catalog {self.name}:</strong></div>{data}<div>The catalog has been loaded <strong>lazily</strong>, meaning no data has been read, only the catalog schema</div>"
return (
f"<div><strong>lsdb Catalog {self.name}:</strong></div>"
f"{data}"
f"<div>The catalog has been loaded <strong>lazily</strong>, meaning no data has been read, only "
f"the catalog schema</div>"
)

def _repr_data(self):
# pylint: disable=protected-access
return self._ddf._repr_data()

Check warning on line 43 in src/lsdb/catalog/dataset/dataset.py

View check run for this annotation

Codecov / codecov/patch

src/lsdb/catalog/dataset/dataset.py#L43

Added line #L43 was not covered by tests

def compute(self) -> npd.NestedFrame:
Expand Down
7 changes: 4 additions & 3 deletions tests/lsdb/catalog/test_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ def test_catalog_repr_equals_ddf_repr(small_sky_order1_catalog):
assert repr(small_sky_order1_catalog) == repr(small_sky_order1_catalog._ddf)


def test_catalog_html_repr_equals_ddf_html_repr(small_sky_order1_catalog):
def test_catalog_html_repr(small_sky_order1_catalog):
full_html = small_sky_order1_catalog._repr_html_()
assert small_sky_order1_catalog.name in full_html
# this is a _healpix_29 that's in the data
assert "3170534137668829184" in full_html
assert str(small_sky_order1_catalog.get_ordered_healpix_pixels()[0]) in full_html
assert str(small_sky_order1_catalog.get_ordered_healpix_pixels()[-1]) in full_html
assert "The catalog has been loaded <strong>lazily</strong>" in full_html


def test_catalog_compute_equals_ddf_compute(small_sky_order1_catalog):
Expand Down

0 comments on commit 527d187

Please sign in to comment.