Skip to content

Commit 6878e20

Browse files
committed
Split off show-and-parse tests
1 parent 1753362 commit 6878e20

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

test/sectors.jl

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ using TensorKitSectors: TensorKitSectors as TKS
44

55
@testsuite "Basic properties" I -> begin
66
s = (randsector(I), randsector(I), randsector(I))
7-
@test Base.eval(Main, Meta.parse(sprint(show, I))) == I
8-
@test Base.eval(Main, Meta.parse(TensorKitSectors.type_repr(I))) == I
9-
@test Base.eval(Main, Meta.parse(sprint(show, s[1]))) == s[1]
107
@test @testinferred(hash(s[1])) == hash(deepcopy(s[1]))
118
@test @testinferred(unit(s[1])) == @testinferred(unit(I))
129
@testinferred dual(s[1])
@@ -37,6 +34,18 @@ using TensorKitSectors: TensorKitSectors as TKS
3734
@testinferred((s..., s...))
3835
end
3936

37+
@testsuite "Show and parse" I -> begin
38+
# test in the parent module of where the test is defined
39+
_module = parentmodule(@__MODULE__)
40+
_eval(x) = Base.eval(_module, x)
41+
_sprint(x) = sprint(show, x; context = (:module => _module))
42+
@test _eval(Meta.parse(_sprint(I))) == I
43+
@test _eval(Meta.parse(TKS.type_repr(I))) == I
44+
for a in smallset(I)
45+
@test _eval(Meta.parse(_sprint(a))) == a
46+
end
47+
end
48+
4049
@testsuite "Value iterator" I -> begin
4150
@test eltype(values(I)) == I
4251
sprev = unit(I)

0 commit comments

Comments
 (0)