Skip to content

Commit a8422cd

Browse files
committed
fix error handling test
1 parent d867894 commit a8422cd

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

applpy/algebra.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def product(random_variable_1, random_variable_2):
189189
2. random_variable_2: A random variable
190190
Output: 1. The product of random_variable_1 and random_variable_2
191191
"""
192-
if random_variable_1.functional_form != random_variable_2.functional_form:
192+
if random_variable_1.domain_type != random_variable_2.domain_type:
193193
raise RVError("both random variables must have the same functional form")
194194

195195
if random_variable_1.is_continuous():

test_applpy/unit/test_rv.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def test_bootstrap_rv_creates_discrete_pdf_with_frequencies():
104104
assert rv.support == [1, 2, 3]
105105
assert rv.func == [Rational(1, 4), Rational(1, 4), Rational(1, 2)]
106106

107+
107108
def test_fast_rv_round_trip_conversion_methods():
108109
rv = _discrete_pdf_bernoulli()
109110

@@ -192,8 +193,8 @@ def test_two_rv_operations_for_continuous_and_discrete():
192193
def test_two_rv_operations_error_paths():
193194
discrete = _discrete_pdf()
194195

195-
with pytest.raises(RVError, match="both random variables must be discrete"):
196-
product_discrete(_uniform_continuous_pdf(), discrete)
196+
with pytest.raises(RVError, match="both random variables must have the same functional form"):
197+
_uniform_continuous_pdf() * discrete
197198

198199

199200
def test_plotting_and_misc_utility_paths():

0 commit comments

Comments
 (0)