Skip to content

Commit

Permalink
TST: change asserts for Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
mj-will committed Mar 11, 2024
1 parent 9845dce commit 093d3eb
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions tests/test_flows/test_base_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ def test_base_flow_abstract_methods():
"""Assert an error is raised if the methods are not implemented."""
with pytest.raises(TypeError) as excinfo:
BaseFlow()
assert "instantiate abstract class BaseFlow with abstract method" in str(
excinfo.value
)
assert "instantiate abstract class BaseFlow" in str(excinfo.value)


@pytest.mark.parametrize(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_flowsampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ def test_run_ins_redraw(flow_sampler):
compute_initial_posterior=True,
)

assert ns.draw_posterior_samples.has_calls(
ns.draw_posterior_samples.assert_has_calls(
[
call(
sampling_method="importance_sampling", use_final_samples=False
Expand Down
5 changes: 1 addition & 4 deletions tests/test_gw/test_distance_converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ def test_converter_error():
"""Assert an error is raised if the methods are not implemented"""
with pytest.raises(TypeError) as excinfo:
DistanceConverter()
assert (
"abstract methods from_uniform_parameter, to_uniform_parameter"
in str(excinfo.value)
)
assert "abstract methods" in str(excinfo.value)


def test_converter_to_uniform_parameter_error(base_converter):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_proposal/test_base_proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_init_with_draw():
model = Mock()
with pytest.raises(TypeError) as excinfo:
Proposal(model)
assert "class Proposal with abstract method" in str(excinfo.value)
assert "class Proposal with" in str(excinfo.value)


def test_initialised(proposal):
Expand Down

0 comments on commit 093d3eb

Please sign in to comment.