コード例 #1
0
ファイル: test_units.py プロジェクト: xiki-tempula/alchemlyb
def test_nounit():
    '''Test no unit error'''
    dataset = load_benzene()
    dhdl = extract_dHdl(dataset['data']['Coulomb'][0], 310)
    dhdl.attrs.pop('energy_unit', None)
    with pytest.raises(TypeError):
        to_kT(dhdl)
コード例 #2
0
ファイル: test_units.py プロジェクト: xiki-tempula/alchemlyb
def test_noT():
    '''Test no temperature error'''
    dataset = load_benzene()
    dhdl = extract_dHdl(dataset['data']['Coulomb'][0], 310)
    dhdl.attrs.pop('temperature', None)
    with pytest.raises(TypeError):
        to_kT(dhdl)
コード例 #3
0
ファイル: test_units.py プロジェクト: xiki-tempula/alchemlyb
 def test_unknown2kt(self, dhdl):
     dhdl.attrs['energy_unit'] = 'ddd'
     with pytest.raises(ValueError):
         to_kT(dhdl)
コード例 #4
0
ファイル: test_units.py プロジェクト: xiki-tempula/alchemlyb
 def test_kcal2kt_number(self, dhdl):
     dhdl.attrs['energy_unit'] = 'kcal/mol'
     new_dhdl = to_kT(dhdl)
     assert 21.0 == pytest.approx(new_dhdl.iloc[0, 0], 0.1)
コード例 #5
0
ファイル: test_units.py プロジェクト: xiki-tempula/alchemlyb
 def test_kcal2kt_unit(self, dhdl):
     dhdl.attrs['energy_unit'] = 'kcal/mol'
     new_dhdl = to_kT(dhdl)
     assert new_dhdl.attrs['energy_unit'] == 'kT'
コード例 #6
0
ファイル: test_units.py プロジェクト: xiki-tempula/alchemlyb
 def test_kt2kt_unit(self, dhdl):
     new_dhdl = to_kT(dhdl)
     assert new_dhdl.attrs['energy_unit'] == 'kT'
コード例 #7
0
ファイル: test_units.py プロジェクト: xiki-tempula/alchemlyb
 def test_kt2kt_number(self, dhdl):
     new_dhdl = to_kT(dhdl)
     assert 12.9 == pytest.approx(new_dhdl.iloc[0, 0], 0.1)
コード例 #8
0
ファイル: test_units.py プロジェクト: xiki-tempula/alchemlyb
def test_setT():
    '''Test setting temperature.'''
    df = pd.DataFrame(data={'col1': [1, 2]})
    df.attrs = {'temperature': 300, 'energy_unit': 'kT'}
    new = to_kT(df, 310)
    assert new.attrs['temperature'] == 310