Fixed database typo and removed unnecessary class identifier.
This commit is contained in:
parent
00ad49a143
commit
45fb349a7d
5098 changed files with 952558 additions and 85 deletions
0
venv/Lib/site-packages/scipy/constants/tests/__init__.py
Normal file
0
venv/Lib/site-packages/scipy/constants/tests/__init__.py
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
57
venv/Lib/site-packages/scipy/constants/tests/test_codata.py
Normal file
57
venv/Lib/site-packages/scipy/constants/tests/test_codata.py
Normal file
|
@ -0,0 +1,57 @@
|
|||
from scipy.constants import constants, codata, find, value, ConstantWarning
|
||||
from numpy.testing import (assert_equal, assert_, assert_almost_equal,
|
||||
suppress_warnings)
|
||||
|
||||
|
||||
def test_find():
|
||||
keys = find('weak mixing', disp=False)
|
||||
assert_equal(keys, ['weak mixing angle'])
|
||||
|
||||
keys = find('qwertyuiop', disp=False)
|
||||
assert_equal(keys, [])
|
||||
|
||||
keys = find('natural unit', disp=False)
|
||||
assert_equal(keys, sorted(['natural unit of velocity',
|
||||
'natural unit of action',
|
||||
'natural unit of action in eV s',
|
||||
'natural unit of mass',
|
||||
'natural unit of energy',
|
||||
'natural unit of energy in MeV',
|
||||
'natural unit of momentum',
|
||||
'natural unit of momentum in MeV/c',
|
||||
'natural unit of length',
|
||||
'natural unit of time']))
|
||||
|
||||
|
||||
def test_basic_table_parse():
|
||||
c = 'speed of light in vacuum'
|
||||
assert_equal(codata.value(c), constants.c)
|
||||
assert_equal(codata.value(c), constants.speed_of_light)
|
||||
|
||||
|
||||
def test_basic_lookup():
|
||||
assert_equal('%d %s' % (codata.c, codata.unit('speed of light in vacuum')),
|
||||
'299792458 m s^-1')
|
||||
|
||||
|
||||
def test_find_all():
|
||||
assert_(len(codata.find(disp=False)) > 300)
|
||||
|
||||
|
||||
def test_find_single():
|
||||
assert_equal(codata.find('Wien freq', disp=False)[0],
|
||||
'Wien frequency displacement law constant')
|
||||
|
||||
|
||||
def test_2002_vs_2006():
|
||||
assert_almost_equal(codata.value('magn. flux quantum'),
|
||||
codata.value('mag. flux quantum'))
|
||||
|
||||
|
||||
def test_exact_values():
|
||||
# Check that updating stored values with exact ones worked.
|
||||
with suppress_warnings() as sup:
|
||||
sup.filter(ConstantWarning)
|
||||
for key in codata.exact_values:
|
||||
assert_((codata.exact_values[key][0] - value(key)) / value(key) == 0)
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
from numpy.testing import assert_equal, assert_allclose
|
||||
import scipy.constants as sc
|
||||
|
||||
|
||||
def test_convert_temperature():
|
||||
assert_equal(sc.convert_temperature(32, 'f', 'Celsius'), 0)
|
||||
assert_equal(sc.convert_temperature([0, 0], 'celsius', 'Kelvin'),
|
||||
[273.15, 273.15])
|
||||
assert_equal(sc.convert_temperature([0, 0], 'kelvin', 'c'),
|
||||
[-273.15, -273.15])
|
||||
assert_equal(sc.convert_temperature([32, 32], 'f', 'k'), [273.15, 273.15])
|
||||
assert_equal(sc.convert_temperature([273.15, 273.15], 'kelvin', 'F'),
|
||||
[32, 32])
|
||||
assert_equal(sc.convert_temperature([0, 0], 'C', 'fahrenheit'), [32, 32])
|
||||
assert_allclose(sc.convert_temperature([0, 0], 'c', 'r'), [491.67, 491.67],
|
||||
rtol=0., atol=1e-13)
|
||||
assert_allclose(sc.convert_temperature([491.67, 491.67], 'Rankine', 'C'),
|
||||
[0., 0.], rtol=0., atol=1e-13)
|
||||
assert_allclose(sc.convert_temperature([491.67, 491.67], 'r', 'F'),
|
||||
[32., 32.], rtol=0., atol=1e-13)
|
||||
assert_allclose(sc.convert_temperature([32, 32], 'fahrenheit', 'R'),
|
||||
[491.67, 491.67], rtol=0., atol=1e-13)
|
||||
assert_allclose(sc.convert_temperature([273.15, 273.15], 'K', 'R'),
|
||||
[491.67, 491.67], rtol=0., atol=1e-13)
|
||||
assert_allclose(sc.convert_temperature([491.67, 0.], 'rankine', 'kelvin'),
|
||||
[273.15, 0.], rtol=0., atol=1e-13)
|
||||
|
||||
|
||||
def test_lambda_to_nu():
|
||||
assert_equal(sc.lambda2nu(sc.speed_of_light), 1)
|
||||
|
||||
|
||||
def test_nu_to_lambda():
|
||||
assert_equal(sc.nu2lambda(1), sc.speed_of_light)
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue