-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_exemplo_16_2.py
33 lines (26 loc) · 1.08 KB
/
test_exemplo_16_2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from exemplo_16_2 import van_der_waals, Q_
import numpy as np
# import pint
# ureg = pint.UnitRegistry()
# Q_ = ureg.Quantity
def test_valores_exemplo():
a = Q_(5.5088, 'atm * dm**6 / mol**2')
b = Q_(0.065144, 'dm**3 / mol')
temperatura = Q_(300, 'K')
pressao = Q_(200, 'atm')
resposta_esperada = Q_(0.096, 'l / mol')
assert np.isclose(van_der_waals(a, b, temperatura, pressao), resposta_esperada, atol=0.001)
def test_valores_exemplo_a_unidade_a_bar():
a = Q_(5.5818, 'bar * dm**6 / mol**2')
b = Q_(0.065144, 'dm**3 / mol')
temperatura = Q_(300, 'K')
pressao = Q_(200, 'atm')
resposta_esperada = Q_(0.096, 'l / mol')
assert np.isclose(van_der_waals(a, b, temperatura, pressao), resposta_esperada, atol=0.001)
def test_valores_exemplo_a_unidade_pressao_pascal():
a = Q_(5.5818, 'bar * dm**6 / mol**2')
b = Q_(0.065144, 'dm**3 / mol')
temperatura = Q_(300, 'K')
pressao = Q_(2.0265E7, 'Pa')
resposta_esperada = Q_(0.096, 'l / mol')
assert np.isclose(van_der_waals(a, b, temperatura, pressao), resposta_esperada, atol=0.001)