File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ def _get_febus_version_str(hdf_fi) -> str:
7575 # Hopefully this is the file version...
7676 version = unbyte (source .attrs .get ("Version" , version )).split ("." )[0 ]
7777 is_febus = is_febus and expected_source_attrs .issubset (set (source .attrs ))
78- if is_febus :
78+ if inst_keys and is_febus :
7979 return version
8080 return ""
8181
Original file line number Diff line number Diff line change 77from pathlib import Path
88from typing import TypeVar
99
10+ import h5py
1011import numpy as np
1112import pandas as pd
1213import pytest
@@ -260,6 +261,14 @@ def test_implements(self):
260261class TestGetFormat :
261262 """Tests to ensure formats can be retrieved."""
262263
264+ @pytest .fixture (scope = "class" )
265+ def empty_h5_path (self , tmpdir_factory ):
266+ """Create an empty HDF5 file."""
267+ path = tmpdir_factory .mktemp ("empty" ) / "empty.h5"
268+ with h5py .File (path , "w" ):
269+ pass
270+ return path
271+
263272 def test_not_known (self , dummy_text_file ):
264273 """Ensure a non-path/str object raises."""
265274 with pytest .raises (UnknownFiberFormatError ):
@@ -279,6 +288,11 @@ def test_fiberio_directory(self, tmp_path_factory):
279288 assert fiber_io .name == name
280289 assert fiber_io .version == version
281290
291+ def test_empty_hdf5_no_format (self , empty_h5_path ):
292+ """Ensure the empty hdf5 dorsen't have a format."""
293+ with pytest .raises (UnknownFiberFormatError ):
294+ dc .get_format (empty_h5_path )
295+
282296
283297class TestScan :
284298 """Tests for scanning fiber files."""
You can’t perform that action at this time.
0 commit comments