Пример #1
0
def test_find():
    warn_ctx = WarningManager()
    warn_ctx.__enter__()
    try:
        warnings.simplefilter('ignore', DeprecationWarning)

        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 mom.um',
                                    'natural unit of mom.um in MeV/c',
                                    'natural unit of length',
                                    'natural unit of time']))
    finally:
        warn_ctx.__exit__()
Пример #2
0
def test_find():
    warn_ctx = WarningManager()
    warn_ctx.__enter__()
    try:
        warnings.simplefilter('ignore', DeprecationWarning)

        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 mom.um',
                                    'natural unit of mom.um in MeV/c',
                                    'natural unit of length',
                                    'natural unit of time']))
    finally:
        warn_ctx.__exit__()
Пример #3
0
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'
        ]))
Пример #4
0
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 mom.um',
                                'natural unit of mom.um in MeV/c',
                                'natural unit of length',
                                'natural unit of time']))
Пример #5
0
def test_find():
    with warnings.catch_warnings():
        warnings.simplefilter('ignore', DeprecationWarning)

        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 mom.um', 'natural unit of mom.um in MeV/c',
                'natural unit of length', 'natural unit of time'
            ]))
Пример #6
0
def test_find():
    with warnings.catch_warnings():
        warnings.simplefilter('ignore', DeprecationWarning)

        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 mom.um',
                                    'natural unit of mom.um in MeV/c',
                                    'natural unit of length',
                                    'natural unit of time']))
Пример #7
0
#https://docs.scipy.org/doc/scipy/reference/constants.html
from scipy import constants

#basic constants can be retrieved directly (see link for list)
c = constants.c
mu_0 = constants.mu_0

#special constants can be found
print(constants.find("light")) #>>['speed of light in vacuum']
c = constants.physical_constants["speed of light in vacuum"]

print(constants.find("proton"))
proton_mass = constants.physical_constants["proton mass"]
print(proton_mass)
Пример #8
0
def test_find_single():
    assert_equal(
        find('Wien freq', disp=False)[0],
        'Wien frequency displacement law constant')
Пример #9
0
def test_find_all():
    assert_(len(find(disp=False)) > 300)