def test_with_initial_content(self): span = Span("Initial", "test") span.append("content") assert_equal( [b"<span>", b"Initial", b"test", b"content", b"</span>"], list(iter(span)), )
def item_for_dataset(name, ds): shape = " × ".join(str(n) for n in ds.shape) namespan = Span(name) namespan.add_css_classes("h5glance-dataset-name") copylink = Link("#", "[📋]") copylink.set_attribute("data-hdf5-path", ds.name) copylink.add_css_classes("h5glance-dataset-copylink") li = ListItem( namespan, " ", copylink, ": ", shape, " entries, dtype: ", make_dtype_abbr(ds.dtype) ) li.add_css_classes("h5glance-dataset") return li
def item_for_dataset(name, ds): namespan = Span(name) namespan.add_css_classes("h5glance-dataset-name") if ds is None: # h5pyd can return None dataset for external links li = ListItem(namespan) return li shape = utils.fmt_shape(ds.shape) copylink = Link("#", "[📋]") copylink.set_attribute("data-hdf5-path", ds.name) copylink.add_css_classes("h5glance-dataset-copylink") li = ListItem(namespan, " ", copylink, ": ", shape, " entries, dtype: ", make_dtype_abbr(ds.id.get_type())) li.add_css_classes("h5glance-dataset") return li
def test_with_initial_content(self): span = Span("Initial", "test") span.append("content") assert_equal([b"<span>", b"Initial", b"test", b"content", b"</span>"], list(iter(span)))
def test_without_initial_content(self): span = Span() span.append("Test") assert_equal([b"<span>", b"Test", b"</span>"], list(iter(span)))
def test_children(self): label = Label("Foo", Span()) assert_equal("<label>Foo<span></span></label>", str(label))
def test_element_child(self): cell = TableCell(Span("Content")) assert_equal('<td><span>Content</span></td>', str(cell))