From 8c6f362e1faaab0681e0d87deeae05e79da9b9f8 Mon Sep 17 00:00:00 2001 From: pattonw Date: Wed, 9 Aug 2023 19:24:37 -0700 Subject: [PATCH] remove sample tests --- src/napari_cellulus/_tests/test_reader.py | 31 ---------------- .../_tests/test_sample_data.py | 7 ---- src/napari_cellulus/_tests/test_widget.py | 36 ------------------- src/napari_cellulus/_tests/test_writer.py | 7 ---- 4 files changed, 81 deletions(-) delete mode 100644 src/napari_cellulus/_tests/test_reader.py delete mode 100644 src/napari_cellulus/_tests/test_sample_data.py delete mode 100644 src/napari_cellulus/_tests/test_widget.py delete mode 100644 src/napari_cellulus/_tests/test_writer.py diff --git a/src/napari_cellulus/_tests/test_reader.py b/src/napari_cellulus/_tests/test_reader.py deleted file mode 100644 index 8cabaa5..0000000 --- a/src/napari_cellulus/_tests/test_reader.py +++ /dev/null @@ -1,31 +0,0 @@ -import numpy as np - -from napari_cellulus import napari_get_reader - - -# tmp_path is a pytest fixture -def test_reader(tmp_path): - """An example of how you might test your plugin.""" - - # write some fake data using your supported file format - my_test_file = str(tmp_path / "myfile.npy") - original_data = np.random.rand(20, 20) - np.save(my_test_file, original_data) - - # try to read it back in - reader = napari_get_reader(my_test_file) - assert callable(reader) - - # make sure we're delivering the right format - layer_data_list = reader(my_test_file) - assert isinstance(layer_data_list, list) and len(layer_data_list) > 0 - layer_data_tuple = layer_data_list[0] - assert isinstance(layer_data_tuple, tuple) and len(layer_data_tuple) > 0 - - # make sure it's the same as it started - np.testing.assert_allclose(original_data, layer_data_tuple[0]) - - -def test_get_reader_pass(): - reader = napari_get_reader("fake.file") - assert reader is None diff --git a/src/napari_cellulus/_tests/test_sample_data.py b/src/napari_cellulus/_tests/test_sample_data.py deleted file mode 100644 index 7daa5fb..0000000 --- a/src/napari_cellulus/_tests/test_sample_data.py +++ /dev/null @@ -1,7 +0,0 @@ -# from napari_cellulus import make_sample_data - -# add your tests here... - - -def test_something(): - pass diff --git a/src/napari_cellulus/_tests/test_widget.py b/src/napari_cellulus/_tests/test_widget.py deleted file mode 100644 index 66140e2..0000000 --- a/src/napari_cellulus/_tests/test_widget.py +++ /dev/null @@ -1,36 +0,0 @@ -import numpy as np - -from napari_cellulus import ExampleQWidget, example_magic_widget - - -# make_napari_viewer is a pytest fixture that returns a napari viewer object -# capsys is a pytest fixture that captures stdout and stderr output streams -def test_example_q_widget(make_napari_viewer, capsys): - # make viewer and add an image layer using our fixture - viewer = make_napari_viewer() - viewer.add_image(np.random.random((100, 100))) - - # create our widget, passing in the viewer - my_widget = ExampleQWidget(viewer) - - # call our widget method - my_widget._on_click() - - # read captured output and check that it's as we expected - captured = capsys.readouterr() - assert captured.out == "napari has 1 layers\n" - - -def test_example_magic_widget(make_napari_viewer, capsys): - viewer = make_napari_viewer() - layer = viewer.add_image(np.random.random((100, 100))) - - # this time, our widget will be a MagicFactory or FunctionGui instance - my_widget = example_magic_widget() - - # if we "call" this object, it'll execute our function - my_widget(viewer.layers[0]) - - # read captured output and check that it's as we expected - captured = capsys.readouterr() - assert captured.out == f"you have selected {layer}\n" diff --git a/src/napari_cellulus/_tests/test_writer.py b/src/napari_cellulus/_tests/test_writer.py deleted file mode 100644 index 92fd9a1..0000000 --- a/src/napari_cellulus/_tests/test_writer.py +++ /dev/null @@ -1,7 +0,0 @@ -# from napari_cellulus import write_single_image, write_multiple - -# add your tests here... - - -def test_something(): - pass