From c9a087f5bce4ebf0433e078313d78acefb8a8469 Mon Sep 17 00:00:00 2001 From: Justin Willmert Date: Thu, 14 Jan 2021 18:50:03 -0600 Subject: [PATCH] Do not try to show attributes of an Attribute --- src/show.jl | 2 +- test/plain.jl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/show.jl b/src/show.jl index 02faaa687..cda739aa6 100644 --- a/src/show.jl +++ b/src/show.jl @@ -191,7 +191,7 @@ function _show_tree(io::IO, obj::Union{File,Group,Dataset,Datatype,Attributes,At return nothing end - if attributes + if attributes && !isa(obj, Attribute) obj′ = obj isa Attributes ? obj.parent : obj h5a_iterate(obj′, H5_INDEX_NAME, H5_ITER_INC) do _, cname, _, _ depth_check() && return herr_t(1) diff --git a/test/plain.jl b/test/plain.jl index 12e7af96b..3e501f016 100644 --- a/test/plain.jl +++ b/test/plain.jl @@ -847,6 +847,10 @@ HDF5.show_tree(iobuf, hfile["dtype"]) @test occursin(r""" 📄 HDF5.Datatype: /dtype""", String(take!(buf))) +HDF5.show_tree(iobuf, hfile["inner/data"]["mode"], attributes = true) +@test occursin(r""" +🏷️ HDF5.Attribute: mode""", String(take!(buf))) + # configurable options # no emoji icons