Skip to content

Commit

Permalink
we skip this test on Windows as pymadng and MADNG are not available t…
Browse files Browse the repository at this point in the history
…here
  • Loading branch information
fsoubelet committed Dec 5, 2024
1 parent 2c3d2db commit 0cb944e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tests/test_writer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging
import random
import string
import sys

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -67,7 +68,9 @@ def test_madx_reads_written_tfsdataframes(self, _bigger_tfs_dataframe, tmp_path)
# of numpy.array_equal to allow for (very) small relative numerical differences on loading
for column in dframe.columns:
assert column in madx.table.test_table
assert_series_equal(pd.Series(madx.table.test_table[column]), dframe[column], check_names=False)
assert_series_equal(
pd.Series(madx.table.test_table[column]), dframe[column], check_names=False
)

def test_tfs_write_empty_index_dataframe(self, tmp_path):
df = TfsDataFrame(
Expand Down Expand Up @@ -230,8 +233,10 @@ def test_tfs_write_read_madng_like(self, _tfs_dataframe_madng, tmp_path):
new = read_tfs(write_location)
assert_tfs_frame_equal(_tfs_dataframe_madng, new, check_exact=False) # float precision can be an issue

@pytest.mark.skipif(sys.platform == "win32", reason="MAD-NG not available on Windows")
def test_tfs_write_madng_compatible_is_read_by_madng(self, _tfs_dataframe_madng, tmp_path):
from pymadng import MAD

write_location = tmp_path / "test.tfs"
write_tfs(write_location, _tfs_dataframe_madng, validate="madng") # has all MAD-NG features
assert write_location.is_file()
Expand Down Expand Up @@ -323,7 +328,8 @@ def test_list_column_dataframe_fails_writes(self, _list_column_in_dataframe: Tfs
write_location = tmp_path / "test.tfs"
# This df raises in validate because of list colnames
with pytest.raises(
IterableInDataFrameError, match="Lists or tuple elements are not accepted in a TfsDataFrame"
IterableInDataFrameError,
match="Lists or tuple elements are not accepted in a TfsDataFrame",
):
write_tfs(write_location, list_col_tfs)

Expand Down

0 comments on commit 0cb944e

Please sign in to comment.