示例#1
0
 def test_works_for_nu_and_lamda(self):
     mu, lam = mu_lambda(nu=0.3, lam=1)
     assert mu == pytest.approx(0.4 / 0.6)
     assert lam == pytest.approx(1)
示例#2
0
 def test_works_for_mu_and_lambda_themselves(self):
     mu, lam = mu_lambda(mu=2, lam=3)
     assert mu == pytest.approx(2)
     assert lam == pytest.approx(3)
示例#3
0
 def test_works_for_nu_and_mu(self):
     mu, lam = mu_lambda(nu=0.3, mu=0.7)
     assert mu == pytest.approx(0.7)
     assert lam == pytest.approx(2 * 0.7 * 0.3 / 0.4)
示例#4
0
 def test_works_for_E_and_lam(self):
     mu, lam = mu_lambda(E=2, lam=1)
     assert mu == pytest.approx((2 - 3 + 17**0.5) / 4)
     assert lam == pytest.approx(lam)
示例#5
0
 def test_works_for_E_and_mu(self):
     mu, lam = mu_lambda(E=2, mu=0.7)
     assert mu == pytest.approx(0.7)
     assert lam == pytest.approx(0.7 * 0.6 / (2.1 - 2))
示例#6
0
 def test_works_for_E_and_nu(self):
     mu, lam = mu_lambda(E=2, nu=0.3)
     assert mu == pytest.approx(1 / 1.3)
     assert lam == pytest.approx(2 * 0.3 / 1.3 / 0.4)
示例#7
0
 def test_with_wrong_number_of_args_it_fails(self):
     with pytest.raises(ValueError):
         mu_lambda(E=1, nu=0.3, mu=4)
         mu_lambda(E=1)