File: test_circle.py

package info (click to toggle)
python-mne 1.3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 100,172 kB
  • sloc: python: 166,349; pascal: 3,602; javascript: 1,472; sh: 334; makefile: 236
file content (29 lines) | stat: -rw-r--r-- 1,056 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
#          Denis Engemann <denis.engemann@gmail.com>
#          Martin Luessi <mluessi@nmr.mgh.harvard.edu>
#
# License: Simplified BSD


import pytest
import matplotlib

from mne.viz import plot_channel_labels_circle


@pytest.mark.filterwarnings('ignore:invalid value encountered in greater_equal'
                            ':RuntimeWarning')
def test_plot_channel_labels_circle():
    """Test plotting channel labels in a circle."""
    fig, axes = plot_channel_labels_circle(
        dict(brain=['big', 'great', 'smart']),
        colors=dict(big='r', great='y', smart='b'))
    texts = [child.get_text() for child in axes.get_children()
             if isinstance(child, matplotlib.text.Text)]
    for text in ('brain', 'big', 'great', 'smart'):
        assert text in texts
    # check inputs
    with pytest.raises(ValueError, match='No color provided'):
        plot_channel_labels_circle(
            dict(brain=['big', 'great', 'smart']),
            colors=dict(big='r', great='y'))