示例#1
0
 def test_cls_get_position(self):
     v = Valve()
     assert v.position == 0
示例#2
0
 def test_sys_flow_rate_str_press(self):
     with pytest.raises(ValueError):
         v = Valve(drop="a")
示例#3
0
 def test_sys_flow_rate_str_coeff(self):
     with pytest.raises(ValueError):
         v = Valve(flow_coeff="a")
示例#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."
示例#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."
示例#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
示例#7
0
 def test_calc_coeff_expected(self):
     v = Valve()
     v.calc_coeff(2)
     assert v.Cv == 60.0
示例#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
示例#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")
示例#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")
示例#11
0
 def test_press_drop_zero(self):
     v = Valve(flow_coeff=15.0)
     v.press_drop(0)
     assert v.deltaP == 0
示例#12
0
 def test_calc_coeff_zero(self):
     v = Valve()
     v.calc_coeff(0)
     assert v.Cv == 0.0
示例#13
0
 def test_close(self):
     v = Valve(position=100)
     v.close()
     assert v.position == 0
示例#14
0
 def test_calc_coeff_neg(self):
     v = Valve()
     v.calc_coeff(-2)
     assert v.Cv == 60.0
示例#15
0
 def test_open(self):
     v = Valve()
     v.open()
     assert v.position == 100
示例#16
0
 def test_cls_change_position(self):
     v = Valve()
     v.position = 100
     assert v.position == 100