def test_Debye_length(): r"""Test the Debye_length function in parameters.py.""" assert Debye_length(T_e, n_e).unit.is_equivalent(u.m) assert np.isclose(Debye_length(1 * u.eV, 1 * u.cm**-3).value, 7.43, atol=0.005) with pytest.warns(u.UnitsWarning): Debye_length(5, 5 * u.m**-3) with pytest.raises(u.UnitTypeError): Debye_length(56 * u.kg, 5 * u.m**-3) with pytest.raises(ValueError): Debye_length(5 * u.eV, -5 * u.m**-3) with pytest.raises(ValueError): Debye_length(-45 * u.K, 5 * u.m**-3) Tarr2 = np.array([1, 2]) * u.K narr3 = np.array([1, 2, 3]) * u.m**-3 with pytest.raises(ValueError): Debye_length(Tarr2, narr3) with pytest.warns(u.UnitsWarning): assert Debye_length(2.0, 2.0) == Debye_length(2.0 * u.K, 2.0 * u.m**-3) with pytest.warns(u.UnitsWarning): assert Debye_length(2.0 * u.K, 2.0) == Debye_length(2.0, 2.0 * u.m**-3) assert_can_handle_nparray(Debye_length)
def time_Debye_length(self): Debye_length(5e6 * u.K, 5e15 * u.m**-3)