@@ -7,6 +7,7 @@ using ITensors:
77 ITensor,
88 Order,
99 QN,
10+ TagSet,
1011 ⊕ ,
1112 δ,
1213 addtags,
102103 @test storage (A) isa NDTensors. EmptyStorage{NDTensors. EmptyNumber}
103104 end
104105
106+ @testset " show" begin
107+ i = Index {Int} (1 , 2 , ITensors. Neither, TagSet (), 0 )
108+ a = ITensor ([1 , 2 ], i)
109+ function res_show (prefix = " " )
110+ return " ITensor ord=1\n Dim 1: (dim=2|id=1)\n " *
111+ " $(prefix) Dense{Float64, Vector{Float64}}\n " *
112+ " 2-element\n 1.0\n 2.0\n "
113+ end
114+ @test sprint (show, a) in (res_show (), res_show (" NDTensors." ))
115+ @test sprint (show, a; context = :compact => true ) == " ((dim=2|id=1),)"
116+ function res_show_text (prefix = " " )
117+ return " ITensor ord=1 (dim=2|id=1)\n " *
118+ " $(prefix) Dense{Float64, Vector{Float64}}"
119+ end
120+ @test sprint (show, MIME " text/plain" (), a) in
121+ (res_show_text (), res_show_text (" NDTensors." ))
122+ end
123+
105124 @testset " diag" for ElType in (Float32, Float64, ComplexF32, ComplexF64)
106125 i, j = Index .(2 , (" i" , " j" ))
107126 A = random_itensor (ElType, i, j)
0 commit comments