diff --git a/src/qobj/quantum_object.jl b/src/qobj/quantum_object.jl index dcabf0d2..f231de70 100644 --- a/src/qobj/quantum_object.jl +++ b/src/qobj/quantum_object.jl @@ -150,7 +150,7 @@ function QuantumObject( type = Operator # default type end - if !isa(type, Operator) && !isa(type, SuperOperator) && !isa(type, Bra) && !isa(type, OperatorBra) + if type != Operator && type != SuperOperator && type != Bra && type != OperatorBra throw( ArgumentError( "The argument type must be Operator, SuperOperator, Bra or OperatorBra if the input array is a matrix.", @@ -187,7 +187,7 @@ function QuantumObject( type = Ket # default type end - if !isa(type, Ket) && !isa(type, OperatorKet) + if type != Ket && type != OperatorKet throw(ArgumentError("The argument type must be Ket or OperatorKet if the input array is a vector.")) end diff --git a/test/quantum_objects.jl b/test/quantum_objects.jl index 9855897f..440817fa 100644 --- a/test/quantum_objects.jl +++ b/test/quantum_objects.jl @@ -24,6 +24,7 @@ # @test_logs (:warn, "The norm of the input data is not one.") QuantumObject(a) @test_throws ArgumentError Qobj(a, type = Operator) @test_throws ArgumentError Qobj(a, type = SuperOperator) + @test_throws ArgumentError Qobj(a, type = OperatorBra) @test_throws ArgumentError Qobj(a', type = Ket) @test_throws DomainError Qobj(a', type = Operator) @test_throws DomainError Qobj(a', type = SuperOperator) @@ -32,7 +33,7 @@ @test_throws DomainError Qobj(a', dims = [2]) a2 = Qobj(a', type = Bra) a3 = Qobj(a) - @test a3' == a2 + @test dag(a3) == a2 # Here we are also testing the dag function @test isket(a2) == false @test isbra(a2) == true @test isoper(a2) == false diff --git a/test/runtests.jl b/test/runtests.jl index 049cf46c..2044736b 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -26,11 +26,11 @@ core_tests = [ "wigner.jl", ] -# if ((GROUP == "All") || (GROUP == "Code-Quality")) && (VERSION >= v"1.9") -# Pkg.add(["Aqua", "JET"]) -# include(joinpath(testdir, "aqua.jl")) -# include(joinpath(testdir, "jet.jl")) -# end +if ((GROUP == "All") || (GROUP == "Code-Quality")) && (VERSION >= v"1.9") + Pkg.add(["Aqua", "JET"]) + include(joinpath(testdir, "aqua.jl")) + include(joinpath(testdir, "jet.jl")) +end if (GROUP == "All") || (GROUP == "Core") QuantumToolbox.about()