Skip to content

Commit db80ca8

Browse files
committed
make spaces tests multifusion-friendly
1 parent 61fa786 commit db80ca8

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

test/symmetries/spaces.jl

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,21 @@ end
220220
@test eval_show(typeof(V)) == typeof(V)
221221
# space with no sectors
222222
@test dim(@constinferred(zerospace(V))) == 0
223-
# space with a single sector
224-
W = @constinferred GradedSpace(unit(I) => 1)
225-
@test W == GradedSpace(unit(I) => 1, randsector(I) => 0)
223+
# space with unit(s)
224+
if isa(UnitStyle(I), GenericUnit)
225+
W = @constinferred GradedSpace(unit => 1 for unit in allunits(I))
226+
dict = Dict((unit => 1 for unit in allunits(I))..., randsector(I) => 0)
227+
@test W == GradedSpace(dict)
228+
@test @constinferred(zerospace(V)) == GradedSpace(unit => 0 for unit in allunits(I))
229+
# randsector never returns trivial sector, so this cannot error
230+
@test_throws ArgumentError("Sector $(allunits(I)[1]) appears multiple times") GradedSpace(allunits(I)[1] => 1, randsector(I) => 0, allunits(I)[1] => 3)
231+
else
232+
W = @constinferred GradedSpace(unit(I) => 1)
233+
@test W == GradedSpace(unit(I) => 1, randsector(I) => 0)
234+
@test @constinferred(zerospace(V)) == GradedSpace(unit(I) => 0)
235+
@test_throws ArgumentError("Sector $(unit(I)) appears multiple times") GradedSpace(unit(I) => 1, randsector(I) => 0, unit(I) => 3)
236+
end
226237
@test @constinferred(unitspace(V)) == W == unitspace(typeof(V))
227-
@test @constinferred(zerospace(V)) == GradedSpace(unit(I) => 0)
228-
# randsector never returns trivial sector, so this cannot error
229-
@test_throws ArgumentError GradedSpace(unit(I) => 1, randsector(I) => 0, unit(I) => 3)
230238
@test eval_show(W) == W
231239
@test isa(V, VectorSpace)
232240
@test isa(V, ElementarySpace)
@@ -265,7 +273,12 @@ end
265273
@test V == @constinferred infimum(V, (V, V))
266274
@test V (V, V)
267275
@test !(V (V, V))
268-
@test infimum(V, GradedSpace(unit(I) => 3)) == GradedSpace(unit(I) => 2)
276+
if isa(UnitStyle(I), GenericUnit)
277+
u = allunits(I)[1]
278+
else
279+
u = unit(I)
280+
end
281+
@test infimum(V, GradedSpace(u => 3)) == GradedSpace(u => 2)
269282
@test_throws SpaceMismatch ((V, V'))
270283
end
271284

0 commit comments

Comments
 (0)