Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up temporary files #374

Merged
merged 5 commits into from
Mar 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
anesthetic: nested sampling post-processing
===========================================
:Authors: Will Handley and Lukas Hergt
:Version: 2.8.2
:Version: 2.8.3
:Homepage: https://github.com/handley-lab/anesthetic
:Documentation: http://anesthetic.readthedocs.io/

Expand Down
2 changes: 1 addition & 1 deletion anesthetic/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.8.2'
__version__ = '2.8.3'
4 changes: 2 additions & 2 deletions tests/test_labelled_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,8 @@ def test_drop_labels(lframe_index):
assert nolabels.drop_labels() is not nolabels


def test_read_csv():
filename = 'mcmc_ldf.csv'
def test_read_csv(tmp_path):
filename = tmp_path / 'mcmc_ldf.csv'

lframe = LabelledDataFrame(np.random.rand(3, 3),
index=['A', 'B', 'C'],
Expand Down
13 changes: 7 additions & 6 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,22 +311,23 @@ def test_path(root):


@pytest.mark.parametrize('root', ['pc', 'gd'])
def test_read_csv(root):
def test_read_csv(tmp_path, root):
filename = tmp_path / f'{root}.csv'
samples = read_chains(f'./tests/example_data/{root}')
samples.to_csv(f'{root}.csv')
samples.to_csv(filename)

samples_ = read_csv(f'{root}.csv')
samples_ = read_csv(filename)
samples_.root = samples.root
assert_frame_equal(samples, samples_)

samples_ = read_csv(f'{root}')
samples_ = read_csv(filename)
samples_.root = samples.root
assert_frame_equal(samples, samples_)

samples_ = read_chains(f'{root}.csv')
samples_ = read_chains(filename)
samples_.root = samples.root
assert_frame_equal(samples, samples_)

samples_ = read_chains(f'{root}')
samples_ = read_chains(filename)
samples_.root = samples.root
assert_frame_equal(samples, samples_)
4 changes: 2 additions & 2 deletions tests/test_weighted_labelled_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pandas


def test_read_csv():
filename = 'mcmc_wldf.csv'
def test_read_csv(tmp_path):
filename = tmp_path / 'mcmc_wldf.csv'

wlframe = WeightedLabelledDataFrame(np.random.rand(3, 3),
index=[0, 1, 2],
Expand Down
4 changes: 2 additions & 2 deletions tests/test_weighted_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,8 +1008,8 @@ def test_style(mcmc_wdf):
ax = mcmc_wdf.plot.scatter_2d('x', 'y', style='c')


def test_read_csv(mcmc_wdf):
filename = 'mcmc_wdf.csv'
def test_read_csv(tmp_path, mcmc_wdf):
filename = tmp_path / 'mcmc_wdf.csv'

mcmc_wdf.to_csv(filename)
mcmc_wdf_ = read_csv(filename)
Expand Down
Loading