Esempio n. 1
0
 def test_cls_get_position(self):
     v = Valve()
     assert v.position == 0
Esempio n. 2
0
 def test_sys_flow_rate_str_press(self):
     with pytest.raises(ValueError):
         v = Valve(drop="a")
Esempio n. 3
0
 def test_sys_flow_rate_str_coeff(self):
     with pytest.raises(ValueError):
         v = Valve(flow_coeff="a")
Esempio n. 4
0
 def test_sys_flow_rate_zero_coeff(self):
     v = Valve(flow_coeff=0.0, drop=7.5)
     with pytest.raises(ValueError) as excinfo:
         v.valve_flow_out(v.Cv, v.deltaP)
     exception_msg = excinfo.value.args[0]
     assert exception_msg == "Input values must be > 0."
Esempio n. 5
0
 def test_sys_flow_rate_neg_press(self):
     v = Valve(drop=-30.0)
     with pytest.raises(ValueError) as excinfo:
         v.valve_flow_out(v.Cv, v.deltaP)
     exception_msg = excinfo.value.args[0]
     assert exception_msg == "Input values must be > 0."
Esempio n. 6
0
 def test_sys_flow_rate_expected(self):
     v = Valve(flow_coeff=15.0, drop=7.5)
     v.valve_flow_out(v.Cv, v.deltaP)
     assert v.flow_out == 41.07919181288746
Esempio n. 7
0
 def test_calc_coeff_expected(self):
     v = Valve()
     v.calc_coeff(2)
     assert v.Cv == 60.0
Esempio n. 8
0
 def test_press_drop_neg(self):
     v = Valve(flow_coeff=15.0, sys_flow_out=-100)
     v.press_drop(v.flow_out)
     assert v.deltaP == 44.44444444444445
Esempio n. 9
0
 def test_press_drop_str(self):
     """Checks for correct Exception thrown if non-number argument used"""
     v = Valve(flow_coeff=15.0)
     with pytest.raises(TypeError):
         v.deltaP("a")
Esempio n. 10
0
 def test_calc_coeff_str(self):
     """Checks for correct Exception thrown if non-number argument used"""
     v = Valve()
     with pytest.raises(TypeError):
         v.calc_coeff("a")
Esempio n. 11
0
 def test_press_drop_zero(self):
     v = Valve(flow_coeff=15.0)
     v.press_drop(0)
     assert v.deltaP == 0
Esempio n. 12
0
 def test_calc_coeff_zero(self):
     v = Valve()
     v.calc_coeff(0)
     assert v.Cv == 0.0
Esempio n. 13
0
 def test_close(self):
     v = Valve(position=100)
     v.close()
     assert v.position == 0
Esempio n. 14
0
 def test_calc_coeff_neg(self):
     v = Valve()
     v.calc_coeff(-2)
     assert v.Cv == 60.0
Esempio n. 15
0
 def test_open(self):
     v = Valve()
     v.open()
     assert v.position == 100
Esempio n. 16
0
 def test_cls_change_position(self):
     v = Valve()
     v.position = 100
     assert v.position == 100