def test_plugable_fail():
    """ Tests for the pluggable form """
    d1 = Distribution("AB", [0.5, 0.5])
    d2 = Distribution("BC", [0.5, 0.5])
    f = jensen_divergence(renyi_entropy)
    with pytest.raises(ditException):
        f(d1, d2)
def test_plugable():
    """ Tests for the pluggable form """
    d1 = Distribution("AB", [0.5, 0.5])
    d2 = Distribution("BC", [0.5, 0.5])
    f = jensen_divergence(renyi_entropy)
    val1 = f([d1, d2], order=1)
    val2 = f([d1, d2], [0.5, 0.5], 1)
    val3 = JSD([d1, d2])
    assert val1 == pytest.approx(val2)
    assert val1 == pytest.approx(val3)
    assert val2 == pytest.approx(val3)