在python中运行单元测试时出现属性错误

时间:2019-05-02 17:47:17

标签: python python-unittest nose

我正在使用鼻子2在python中运行我的代码的单元测试。我收到AttributeError
        使用的方程式:

    .. math::
        \frac{dX}{dz}= \frac {\beta a_f a_z (x_s^w -x)} {m_{avct}}


def dX_dz_unsaturated(self,Merkel_number, height, X, T_w, m_avct):        

    WaterInlet = AirVapour(T_w, T_w,self.initParams['P_ai'])
    Xs_w = WaterInlet.humidity[0]
    alpha_beta_Az = self.alpha_beta_Az(Merkel_number, height)
    return alpha_beta_Az *(Xs_w-X)/m_avct

这是单元测试代码,我正在运行该代码来检查上述代码。

def test_dX_dz_unsaturated(self):
    self.assertAlmostEqual(Klimanek_equation.dM_dz_unsaturated
                    (self,1.5,1.5,0.011, 320),       
                    25.369,
                    places = 1)

当我用鼻子检查我的代码时,出现以下错误:

"alpha_beta_Az = self.alpha_beta_Az(Merkel_number, height)
AttributeError: 'Test_klimanek_equation' object has no attribute 'alpha_beta_Az'

0 个答案:

没有答案