From 852c9d077da8f1869d10ab693d4aada208c9e99f Mon Sep 17 00:00:00 2001 From: Viljar Femoen Date: Thu, 13 Jun 2024 14:18:34 +0200 Subject: [PATCH] Increase test coverage --- pyxem/signals/indexation_results.py | 2 +- .../tests/signals/test_indexation_results.py | 52 +++++++++++++++++-- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/pyxem/signals/indexation_results.py b/pyxem/signals/indexation_results.py index b854b70fe..3bfb917e3 100644 --- a/pyxem/signals/indexation_results.py +++ b/pyxem/signals/indexation_results.py @@ -772,7 +772,7 @@ def to_ipf_correlation_heatmap_markers( This will not look good if the rotations used in the simulation(s) consists of multiple different regions in the IPF. - + """ phase_idx_signal = hs.signals.Signal1D(self.to_phase_index()) phases = self.simulation.phases diff --git a/pyxem/tests/signals/test_indexation_results.py b/pyxem/tests/signals/test_indexation_results.py index 97b443ae2..3aae69683 100644 --- a/pyxem/tests/signals/test_indexation_results.py +++ b/pyxem/tests/signals/test_indexation_results.py @@ -368,18 +368,62 @@ def test_to_crystal_map_error(self, simple_multi_rot_orientation_result): with pytest.raises(ValueError): rotations = orientations.to_crystal_map() - def test_plot_over_signal(self, simple_multi_rot_orientation_result): + @pytest.mark.parametrize("add_vector_markers", [False, True]) + @pytest.mark.parametrize("add_ipf_markers", [False, True]) + @pytest.mark.parametrize("add_ipf_correlation_heatmap", [False, True]) + @pytest.mark.parametrize("add_ipf_colorkey", [False, True]) + @pytest.mark.parametrize( + "vector_kwargs", [None, {"annotate": False}, {"annotate": True}] + ) + def test_plot_over_single_phase_signal( + self, + simple_multi_rot_orientation_result, + add_vector_markers, + add_ipf_markers, + add_ipf_correlation_heatmap, + add_ipf_colorkey, + vector_kwargs, + ): orientations, rotations, s = simple_multi_rot_orientation_result - orientations.plot_over_signal(s) + orientations.plot_over_signal( + s, + add_vector_markers=add_vector_markers, + add_ipf_markers=add_ipf_markers, + add_ipf_correlation_heatmap=add_ipf_correlation_heatmap, + add_ipf_colorkey=add_ipf_colorkey, + vector_kwargs=vector_kwargs, + ) - def test_plot_over_signal_multi_phase(self, multi_phase_orientation_result): + @pytest.mark.parametrize("add_vector_markers", [False, True]) + @pytest.mark.parametrize("add_ipf_markers", [False, True]) + @pytest.mark.parametrize("add_ipf_correlation_heatmap", [False, True]) + @pytest.mark.parametrize("add_ipf_colorkey", [False, True]) + @pytest.mark.parametrize( + "vector_kwargs", [None, {"annotate": False}, {"annotate": True}] + ) + def test_plot_over_multi_phase_signal( + self, + multi_phase_orientation_result, + add_vector_markers, + add_ipf_markers, + add_ipf_correlation_heatmap, + add_ipf_colorkey, + vector_kwargs, + ): # Mock signal s = hs.signals.Signal2D( np.zeros(multi_phase_orientation_result.data.shape[:-2])[ ..., np.newaxis, np.newaxis ] ) - multi_phase_orientation_result.plot_over_signal(s) + multi_phase_orientation_result.plot_over_signal( + s, + add_vector_markers=add_vector_markers, + add_ipf_markers=add_ipf_markers, + add_ipf_correlation_heatmap=add_ipf_correlation_heatmap, + add_ipf_colorkey=add_ipf_colorkey, + vector_kwargs=vector_kwargs, + ) def test_to_ipf_correlation_heatmap_markers_single_phase( self, simple_multi_rot_orientation_result