Skip to content

Commit

Permalink
enhancement(#47): BREAKING CHANGES
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
fsoubelet committed Sep 16, 2020
1 parent a987e95 commit 37844ba
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions tests/test_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=""):
Expand All @@ -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
Expand All @@ -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"])

Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions tests/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion tfs/__init__.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions tfs/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 37844ba

Please sign in to comment.