From 96fad22cac0962f138d5ee35284ea85287309425 Mon Sep 17 00:00:00 2001 From: Adam Ormondroyd <52655393+AdamOrmondroyd@users.noreply.github.com> Date: Wed, 27 Sep 2023 23:41:42 +0100 Subject: [PATCH] Ignore "You are using [hist/kde] as a plot kind" warnings (#342) * Ignore "You are using [hist/kde] as a plot kind" warnings * hedge bets that #341 will merge first lol --- README.rst | 2 +- anesthetic/_version.py | 2 +- tests/test_samples.py | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.rst b/README.rst index 6d05d9a2..e59d3737 100644 --- a/README.rst +++ b/README.rst @@ -2,7 +2,7 @@ anesthetic: nested sampling post-processing =========================================== :Authors: Will Handley and Lukas Hergt -:Version: 2.3.3 +:Version: 2.3.4 :Homepage: https://github.com/handley-lab/anesthetic :Documentation: http://anesthetic.readthedocs.io/ diff --git a/anesthetic/_version.py b/anesthetic/_version.py index 8a242cd3..6ec85d61 100644 --- a/anesthetic/_version.py +++ b/anesthetic/_version.py @@ -1 +1 @@ -__version__ = '2.3.3' +__version__ = '2.3.4' diff --git a/tests/test_samples.py b/tests/test_samples.py index 815bbd65..d9e3d401 100644 --- a/tests/test_samples.py +++ b/tests/test_samples.py @@ -1,6 +1,7 @@ import anesthetic.examples._matplotlib_agg # noqa: F401 import pytest +from contextlib import nullcontext from math import floor, ceil import numpy as np from pandas import MultiIndex @@ -823,7 +824,9 @@ def test_stats(): def test_masking_1d(kind): pc = read_chains("./tests/example_data/pc") mask = pc['x0'].to_numpy() > 0 - pc[mask].plot_1d(['x0', 'x1', 'x2'], kind=kind) + with pytest.warns(UserWarning) if kind in ['kde', + 'hist'] else nullcontext(): + pc[mask].plot_1d(['x0', 'x1', 'x2'], kind=kind) @pytest.mark.parametrize('kind', ['kde', 'scatter', 'scatter_2d', 'kde_2d', @@ -831,7 +834,8 @@ def test_masking_1d(kind): def test_masking_2d(kind): pc = read_chains("./tests/example_data/pc") mask = pc['x0'].to_numpy() > 0 - pc[mask].plot_2d(['x0', 'x1', 'x2'], kind={'lower': kind}) + with pytest.warns(UserWarning) if kind == 'kde' else nullcontext(): + pc[mask].plot_2d(['x0', 'x1', 'x2'], kind={'lower': kind}) def test_merging():