|
|
|
@ -179,6 +179,39 @@ def test_parse_file(example_file):
@@ -179,6 +179,39 @@ def test_parse_file(example_file):
|
|
|
|
|
assert result["Exposure.Id"][0] == 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_parse_file_raises_error(example_dir): |
|
|
|
|
from sensospot_data.parser import parse_file |
|
|
|
|
|
|
|
|
|
csv_file = ( |
|
|
|
|
example_dir / EXAMPLE_DIR_WITH_PARAMS / "should_raise_value_error.csv" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
with pytest.raises(ValueError): |
|
|
|
|
parse_file(csv_file) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_silenced_parse_file_returns_data_frame(example_file): |
|
|
|
|
from sensospot_data.parser import _silenced_parse_file |
|
|
|
|
|
|
|
|
|
result = _silenced_parse_file(example_file) |
|
|
|
|
|
|
|
|
|
assert result["Well.Row"][0] == "A" |
|
|
|
|
assert result["Well.Column"][0] == 1 |
|
|
|
|
assert result["Exposure.Id"][0] == 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_silenced_parse_file_returns_none_on_error(example_dir): |
|
|
|
|
from sensospot_data.parser import _silenced_parse_file |
|
|
|
|
|
|
|
|
|
csv_file = ( |
|
|
|
|
example_dir / EXAMPLE_DIR_WITH_PARAMS / "should_raise_value_error.csv" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
result = _silenced_parse_file(csv_file) |
|
|
|
|
|
|
|
|
|
assert result is None |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.parametrize( |
|
|
|
|
"file_list", |
|
|
|
|
[ |
|
|
|
@ -225,7 +258,7 @@ def test_list_csv_files(example_dir):
@@ -225,7 +258,7 @@ def test_list_csv_files(example_dir):
|
|
|
|
|
|
|
|
|
|
result = list(list_csv_files(example_dir / EXAMPLE_DIR_WITH_PARAMS)) |
|
|
|
|
|
|
|
|
|
assert len(result) == 36 * 3 |
|
|
|
|
assert len(result) == (36 * 3) + 1 # 36 wells, 3 exposure + one error file |
|
|
|
|
assert all(str(item).endswith(".csv") for item in result) |
|
|
|
|
assert all(not item.stem.startswith(".") for item in result) |
|
|
|
|
|
|
|
|
|