File: test_density.py

package info (click to toggle)
python-periodictable 1.5.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 2,884 kB
  • sloc: python: 8,509; makefile: 97; sh: 91; javascript: 7
file content (21 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from periodictable import elements

def test():
    assert elements.Cm.density == 13.51
    assert elements.Cm.density_caveat == "calculated"
    assert elements.Cm.density_units == "g/cm^3"
    assert elements.D.density == elements.H.density * elements.D.mass/elements.H.mass

    # check number density and unit cell width
    assert abs(elements.Ca.interatomic_distance - 3.50166387163) < 1e-10
    assert abs(elements.Fe.number_density - 8.4910635606518029e+22) < 1e12
    assert elements.Ca.interatomic_distance_units == "angstrom"
    assert elements.Fe.number_density_units == "1/cm^3"

    #elements.list('symbol','density','density_caveat', format="%3s %10s   %s")

    #import mass
    #mass.init()
    #elements.list('symbol','interatomic_distance')

if __name__ == "__main__": test()