@@ -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)
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' ))
270283end
271284
0 commit comments