From 37844ba49edcf030462a7d8a0be69422ed47da48 Mon Sep 17 00:00:00 2001 From: Felix Soubelet Date: Wed, 16 Sep 2020 16:34:10 +0200 Subject: [PATCH] enhancement(#47): BREAKING CHANGES - capitalize plane letter in file naming for consistency accross pylhc packages - change hardcoded test input file names according to the new behavior - change hardcoded test expected results according to the new behavior - bump tfs-pandas version as 2.0.0 as discussed today --- tests/inputs/{file_x.tfs => file_X.tfs} | 0 tests/inputs/{file_y.tfs => file_Y.tfs} | 0 tests/test_collection.py | 10 +++++----- tests/test_handler.py | 4 ++-- tfs/__init__.py | 2 +- tfs/collection.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) rename tests/inputs/{file_x.tfs => file_X.tfs} (100%) rename tests/inputs/{file_y.tfs => file_Y.tfs} (100%) diff --git a/tests/inputs/file_x.tfs b/tests/inputs/file_X.tfs similarity index 100% rename from tests/inputs/file_x.tfs rename to tests/inputs/file_X.tfs diff --git a/tests/inputs/file_y.tfs b/tests/inputs/file_Y.tfs similarity index 100% rename from tests/inputs/file_y.tfs rename to tests/inputs/file_Y.tfs diff --git a/tests/test_collection.py b/tests/test_collection.py index b49c7539..b480eb09 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -15,7 +15,7 @@ class CollectionTest(TfsCollection): file = Tfs("file_{}.tfs") nofile = Tfs("nofile_{}.tfs") - filex = Tfs("file_x.tfs", two_planes=False) + filex = Tfs("file_X.tfs", two_planes=False) value = 10 def get_filename(self, template, plane=""): @@ -40,7 +40,7 @@ def test_read_str_input(_input_dir_str: str, _tfs_x: TfsDataFrame, _tfs_y: TfsDa def test_write(_tfs_x: TfsDataFrame, _tfs_y: TfsDataFrame, _output_dir: str): c = CollectionTest(_output_dir) - file_x_path = pathlib.Path(_output_dir) / "nofile_x.tfs" + file_x_path = pathlib.Path(_output_dir) / "nofile_X.tfs" assert not file_x_path.is_file() c.nofile_x = _tfs_x # will not throw error, but does nothing @@ -52,7 +52,7 @@ def test_write(_tfs_x: TfsDataFrame, _tfs_y: TfsDataFrame, _output_dir: str): assert_frame_equal(_tfs_x, c.nofile_x) c.nofile["y"] = _tfs_y - file_y_path = pathlib.Path(_output_dir) / "nofile_y.tfs" + file_y_path = pathlib.Path(_output_dir) / "nofile_Y.tfs" assert file_y_path.is_file() assert_frame_equal(_tfs_y, c.nofile["y"]) @@ -73,12 +73,12 @@ def test_maybe_str_input(_input_dir_str: str): @pytest.fixture() def _tfs_x() -> TfsDataFrame: - return read_tfs(CURRENT_DIR / "inputs" / "file_x.tfs").set_index("NAME", drop=False) + return read_tfs(CURRENT_DIR / "inputs" / "file_X.tfs").set_index("NAME", drop=False) @pytest.fixture() def _tfs_y() -> TfsDataFrame: - return read_tfs(CURRENT_DIR / "inputs" / "file_y.tfs").set_index("NAME", drop=False) + return read_tfs(CURRENT_DIR / "inputs" / "file_Y.tfs").set_index("NAME", drop=False) @pytest.fixture() diff --git a/tests/test_handler.py b/tests/test_handler.py index e46cb77e..6fd99035 100644 --- a/tests/test_handler.py +++ b/tests/test_handler.py @@ -179,12 +179,12 @@ def test_fail_on_spaces_headers(): @pytest.fixture() def _tfs_file_pathlib() -> pathlib.Path: - return CURRENT_DIR / "inputs" / "file_x.tfs" + return CURRENT_DIR / "inputs" / "file_X.tfs" @pytest.fixture() def _tfs_file_str() -> str: - return os.path.join(os.path.dirname(__file__), "inputs", "file_x.tfs") + return os.path.join(os.path.dirname(__file__), "inputs", "file_X.tfs") @pytest.fixture() diff --git a/tfs/__init__.py b/tfs/__init__.py index 1a0ddb1f..fac26a04 100644 --- a/tfs/__init__.py +++ b/tfs/__init__.py @@ -1,6 +1,6 @@ """Exposes TfsDataFrame, read_tfs and write_tfs directly in tfs namespace.""" from tfs.handler import read_tfs, write_tfs, TfsDataFrame -__version__ = "1.0.5" +__version__ = "2.0.0" # aliases read = read_tfs write = write_tfs diff --git a/tfs/collection.py b/tfs/collection.py index 64cc48f4..ebbbce1f 100644 --- a/tfs/collection.py +++ b/tfs/collection.py @@ -216,8 +216,8 @@ def setter_funct(self, tfs_data): def _define_property_two_planes(args, kwargs) -> tuple: x_kwargs = dict(kwargs) y_kwargs = dict(kwargs) - x_kwargs["plane"] = "x" - y_kwargs["plane"] = "y" + x_kwargs["plane"] = "X" + y_kwargs["plane"] = "Y" def x_getter_funct(self): return _getter(self, *args, **x_kwargs)