Skip to content

Commit

Permalink
fix 1.0 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf committed Jul 3, 2021
1 parent 0fd4d94 commit 56a13e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/UnROOT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ include("bootstrap.jl")
include("root.jl")
include("custom.jl")

if VERSION < v"1.2"
hasproperty(x, s::Symbol) = s in fieldnames(typeof(x))
end

end # module
2 changes: 1 addition & 1 deletion src/root.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function autointerp_T(branch, leaf)
if hasproperty(branch, :fClassName)
classname = branch.fClassName # the C++ class name, such as "vector<int>"
m = match(r"vector<(.*)>", classname)
isnothing(m) && error("Cannot understand fClassName: $classname.")
m===nothing && error("Cannot understand fClassName: $classname.")
elname = m[1]
elname = endswith(elname, "_t") ? lowercase(chop(elname; tail=2)) : elname # Double_t -> double
try
Expand Down
6 changes: 3 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,13 @@ end
@testset "NanoAOD" begin
rootfile = ROOTFile(joinpath(SAMPLES_DIR, "NanoAODv5_sample.root"))
event = array(rootfile, "Events/event")
@test event[begin:3] == UInt64[12423832, 12423821, 12423834]
@test event[1:3] == UInt64[12423832, 12423821, 12423834]
Electron_dxy = array(rootfile, "Events/Electron_dxy")
@test eltype(Electron_dxy) == Vector{Float32}
@test Electron_dxy[begin:3] [Float32[0.0003705], Float32[-0.00981903], Float32[]]
@test Electron_dxy[1:3] [Float32[0.0003705], Float32[-0.00981903], Float32[]]
HLT_Mu3_PFJet40 = array(rootfile, "Events/HLT_Mu3_PFJet40")
@test eltype(HLT_Mu3_PFJet40) == Bool
@test HLT_Mu3_PFJet40[begin:3] == [false, true, false]
@test HLT_Mu3_PFJet40[1:3] == [false, true, false]
end

@testset "readbasketsraw()" begin
Expand Down

0 comments on commit 56a13e9

Please sign in to comment.