Skip to content

Commit

Permalink
Fix JET and minor things
Browse files Browse the repository at this point in the history
  • Loading branch information
albertomercurio committed Jun 26, 2024
1 parent e228fe9 commit bb99b86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/qobj/quantum_object.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function QuantumObject(
type = Operator # default type

Check warning on line 150 in src/qobj/quantum_object.jl

View check run for this annotation

Codecov / codecov/patch

src/qobj/quantum_object.jl#L149-L150

Added lines #L149 - L150 were not covered by tests
end

if !isa(type, Operator) && !isa(type, SuperOperator) && !isa(type, Bra) && !isa(type, OperatorBra)
if type != Operator && type != SuperOperator && type != Bra && type != OperatorBra
throw(

Check warning on line 154 in src/qobj/quantum_object.jl

View check run for this annotation

Codecov / codecov/patch

src/qobj/quantum_object.jl#L153-L154

Added lines #L153 - L154 were not covered by tests
ArgumentError(
"The argument type must be Operator, SuperOperator, Bra or OperatorBra if the input array is a matrix.",
Expand Down Expand Up @@ -187,7 +187,7 @@ function QuantumObject(
type = Ket # default type

Check warning on line 187 in src/qobj/quantum_object.jl

View check run for this annotation

Codecov / codecov/patch

src/qobj/quantum_object.jl#L186-L187

Added lines #L186 - L187 were not covered by tests
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."))

Check warning on line 191 in src/qobj/quantum_object.jl

View check run for this annotation

Codecov / codecov/patch

src/qobj/quantum_object.jl#L190-L191

Added lines #L190 - L191 were not covered by tests
end

Expand Down
3 changes: 2 additions & 1 deletion test/quantum_objects.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit bb99b86

Please sign in to comment.