diff --git a/test/sectors.jl b/test/sectors.jl index f02e8f86..24557caf 100644 --- a/test/sectors.jl +++ b/test/sectors.jl @@ -4,9 +4,6 @@ using TensorKitSectors: TensorKitSectors as TKS @testsuite "Basic properties" I -> begin s = (randsector(I), randsector(I), randsector(I)) - @test Base.eval(Main, Meta.parse(sprint(show, I))) == I - @test Base.eval(Main, Meta.parse(TensorKitSectors.type_repr(I))) == I - @test Base.eval(Main, Meta.parse(sprint(show, s[1]))) == s[1] @test @testinferred(hash(s[1])) == hash(deepcopy(s[1])) @test @testinferred(unit(s[1])) == @testinferred(unit(I)) @testinferred dual(s[1]) @@ -37,6 +34,18 @@ using TensorKitSectors: TensorKitSectors as TKS @testinferred(⊗(s..., s...)) end +@testsuite "Show and parse" I -> begin + # test in the parent module of where the test is defined + _module = parentmodule(@__MODULE__) + _eval(x) = Base.eval(_module, x) + _sprint(x) = sprint(show, x; context = (:module => _module)) + @test _eval(Meta.parse(_sprint(I))) == I + @test _eval(Meta.parse(TKS.type_repr(I))) == I + for a in smallset(I) + @test _eval(Meta.parse(_sprint(a))) == a + end +end + @testsuite "Value iterator" I -> begin @test eltype(values(I)) == I sprev = unit(I)