예제 #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