def setUp(self):

        # Test AssertionError
        with self.assertRaises(AssertionError):
            dis.Weibull(k=-1, lmbda=1)
        with self.assertRaises(AssertionError):
            dis.Weibull(k=1, lmbda=-1)

        # For the later tests
        self.d1 = dis.Weibull(k=0.5, lmbda=1., name="MyWeibull")
    def test_methods(self):
        d1 = dis.Weibull(k=0.5, lmbda=1., name="MyWeibull")

        assert list(d1.pdf([1, 2])) == [0.18393972058572117, 0.08595474576918094]
        assert list(d1.cdf([1, 2])) == [0.6321205588285577, 0.7568832655657858]
        assert d1.var(p=0.1) == pytest.approx(0.011100838259683056, 1e-12)
        assert d1.cvar(p=0.1) == pytest.approx(2.2218218695753356, 1e-12)
    def test_attributes(self):
        d1 = dis.Weibull(k=0.5, lmbda=1., name="MyWeibull")

        assert d1.type == 'Weibull'
        assert d1.support == 'R+'

        assert d1.k == 0.5
        assert d1.lmbda == 1.

        assert d1.mean == 2.0
        assert d1.variance == 20.0
        assert d1.std == pytest.approx(4.47213595499958, 1e-12)
        assert d1.skewness == pytest.approx(6.6187612133993765, 1e-12)
        assert d1.kurtosis == pytest.approx(87.71999999999998, 1e-12)
        assert d1.median == pytest.approx(0.4804530139182014, 1e-12)
        assert d1.mode == 0
        assert d1.entropy == pytest.approx(1.1159315156584124, 1e-12)
        assert d1.name == "MyWeibull"
 def test_negative_lambda_raises_error(self):
     with pytest.raises(AssertionError):
         dis.Weibull(k=1, lmbda=-1)