-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
44 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import pathlib | ||
|
||
import numpy as np | ||
|
||
from brainglobe_napari_io.cellfinder import ( | ||
reader_xml, | ||
writer_xml, | ||
writer_multiple_xml, | ||
) | ||
|
||
test_data_dir = pathlib.Path(__file__) / ".." / "data" | ||
|
||
|
||
def test_xml_roundrip(tmpdir): | ||
# Check that a read in XML file can also be written back out | ||
xml_file = test_data_dir / "cell_classification.xml" | ||
layers = reader_xml.xml_reader(xml_file) | ||
layer = layers[0] | ||
|
||
for layer in layers: | ||
paths = writer_xml.write_points_to_xml( | ||
str(tmpdir / "single.xml"), layer[0], layer[1] | ||
) | ||
assert len(paths) == 1 | ||
assert isinstance(paths[0], str) | ||
|
||
paths = writer_multiple_xml.write_multiple_points_to_xml( | ||
str(tmpdir / "multiple.xml"), layers | ||
) | ||
assert len(paths) == 1 | ||
assert isinstance(paths[0], str) | ||
assert reader_xml.is_cellfinder_xml(paths[0]) |