Skip to content

Commit

Permalink
Fix unit tests after not allowing conditioning on mutable that are no…
Browse files Browse the repository at this point in the history
…t cond vars
  • Loading branch information
nabriis committed Feb 9, 2024
1 parent bb6fe73 commit bfdbfe3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/test_abstract_distribution_density.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ def test_conditioning_on_main_parameter():
def test_conditioning_kwarg_as_mutable_var():
""" This checks if we allow kwargs for a distribution that has no conditioning variables. """
x = cuqi.distribution.Gaussian(mean=1, cov=1)
x = x(cov=2) #This should be ok and not throw an error
assert x.cov == 2
with pytest.raises(ValueError):
x = x(cov=2) #This should raise error since no cond vars

def test_conditioning_both_args_kwargs():
""" This tests that we throw error if we accidentally provide arg and kwarg for same variable. """
Expand Down Expand Up @@ -172,7 +172,7 @@ def test_cond_positional_and_kwargs():
""" Test conditioning for both positional and kwargs """
x = cuqi.distribution.Gaussian(cov=lambda s:s, geometry=1)

logd = x(mean=3, cov=7).logd(13)
logd = x(mean=3, s=7).logd(13)

# Conditioning full positional
assert x(3, 7, 13).value == logd
Expand All @@ -181,10 +181,10 @@ def test_cond_positional_and_kwargs():
assert x(3)(7)(13).value == logd

# Conditioning full kwargs
assert x(mean=3, cov=7, x=13).value == logd
assert x(mean=3, cov=7)(x=13).value == logd
assert x(mean=3)(cov=7, x=13).value == logd
assert x(mean=3)(cov=7)(x=13).value == logd
assert x(mean=3, s=7, x=13).value == logd
assert x(mean=3, s=7)(x=13).value == logd
assert x(mean=3)(s=7, x=13).value == logd
assert x(mean=3)(s=7)(x=13).value == logd

# Conditioning partial positional
assert x(3, s=7, x=13).value == logd
Expand Down

0 comments on commit bfdbfe3

Please sign in to comment.