Skip to content

Commit

Permalink
some linting
Browse files Browse the repository at this point in the history
  • Loading branch information
fsoubelet committed Oct 24, 2024
1 parent a1b4aba commit c2f211a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def _tfs_complex_file() -> pathlib.Path:
return INPUTS_DIR / "complex.tfs"


@pytest.fixture()
@pytest.fixture
def _tfs_madng_file() -> pathlib.Path:
"""A TFS file withboth complex values and booleans, in headers and columns."""
return INPUTS_DIR / "madng.tfs"
Expand Down
1 change: 0 additions & 1 deletion tests/test_reader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pathlib

import pytest
import numpy as np
from pandas.api import types as pdtypes
from pandas.core.arrays.string_ import StringDtype
from pandas.testing import assert_frame_equal
Expand Down
2 changes: 1 addition & 1 deletion tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_warn_unphysical_values_in_headers(self, _tfs_dataframe, validation_mode
df = _tfs_dataframe
df.headers["NANVALUE"] = np.nan # make sure there is a NaN in there
validate(df, compatibility=validation_mode)

for record in caplog.records:
assert record.levelname == "WARNING"
assert "contains non-physical values in headers" in caplog.text
Expand Down
4 changes: 1 addition & 3 deletions tests/test_writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
import pathlib
import random
import string

Expand All @@ -9,7 +8,6 @@
from cpymad.madx import Madx
from pandas._testing import assert_dict_equal
from pandas.testing import assert_frame_equal, assert_series_equal
from pymadng import MAD

import tfs
from tfs import TfsDataFrame, read_tfs, write_tfs
Expand Down Expand Up @@ -216,7 +214,7 @@ def test_tfs_write_read_with_complex(self, _tfs_dataframe_complex, tmp_path):
def test_tfs_write_with_nil_in_headers(self, _tfs_dataframe, tmp_path):
df = _tfs_dataframe
df.headers["WRITETONIL"] = None

write_location = tmp_path / "test.tfs"
write_tfs(write_location, df, validate="madng")

Expand Down
2 changes: 1 addition & 1 deletion tfs/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def write_tfs(
# to floats, and don't try to convert strings to its special StringDtype (as then 'None'
# would be transformed into <pd.NA> and if we write this to file we are very much cooked.)
# Overall we do not care to infer specialized dtypes, just that it makes the best inference
# to valid dtypes (i.e. an object column should be inferred as strings if that makes sense).
# to valid dtypes (i.e. an object column should be inferred as strings if that makes sense).
data_frame = data_frame.convert_dtypes(convert_integer=False, convert_floating=False, convert_string=None)

if save_index:
Expand Down

0 comments on commit c2f211a

Please sign in to comment.