Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some extra tests #58

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/atoms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function Atoms(system::AbstractSystem{D})
atom_data = Dict{Symbol,Any}(
:atomic_symbol => atomic_symbols,
:atomic_number => Int.(atomic_number(system, :)), # gets messy if not Int
:species => s,
:species => s,
:mass => mass(system, :)
)
atom_data[:position] = map(1:n_atoms) do at
Expand Down
7 changes: 4 additions & 3 deletions test/atomsbase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ end
end

@testset "Warning about setting invalid data" begin
species = ChemicalSpecies.([:D, :H, :C, :N, :He])
system = make_test_system(; extra_sysprop=(md=3u"u", symboldata=:abc),
extra_atprop=(massdata=3ones(5)u"u",
atomic_symbol=[:D, :H, :C, :N, :He])).system
extra_atprop=(massdata=3ones(5)u"u", species)).system
atoms = @test_logs((:warn, r"Unitful quantity massdata is not yet"),
(:warn, r"Writing quantities of type Symbol"),
(:warn, r"Unitful quantity md is not yet"),
(:warn, r"Mismatch between atomic numbers and atomic symbols"),
match_mode=:any, ExtXYZ.write_dict(Atoms(system)))

@test atoms["arrays"]["species"] == ["H", "H", "C", "N", "He"]
Expand Down Expand Up @@ -188,4 +189,4 @@ end
finally
isfile(fname) && rm(fname)
end
end
end
Loading