• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

colour-science / colour / 9579473519

19 Jun 2024 09:20AM UTC coverage: 2.36% (-97.6%) from 99.978%
9579473519

push

github

KelSolaar
Test only `colour/volume/tests`.

952 of 40339 relevant lines covered (2.36%)

0.02 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/colour/plotting/tests/test_section.py
1
"""Define the unit tests for the :mod:`colour.plotting.section` module."""
2

3

4
from matplotlib.axes import Axes
×
5
from matplotlib.figure import Figure
×
6

7
from colour.geometry import primitive_cube
×
8
from colour.models import RGB_COLOURSPACE_sRGB, RGB_to_XYZ
×
9
from colour.plotting import (
×
10
    plot_RGB_colourspace_section,
11
    plot_visible_spectrum_section,
12
)
13
from colour.plotting.section import (
×
14
    plot_hull_section_colours,
15
    plot_hull_section_contour,
16
)
17
from colour.utilities import is_trimesh_installed
×
18

19
__author__ = "Colour Developers"
×
20
__copyright__ = "Copyright 2013 Colour Developers"
×
21
__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
×
22
__maintainer__ = "Colour Developers"
×
23
__email__ = "colour-developers@colour-science.org"
×
24
__status__ = "Production"
×
25

26
__all__ = [
×
27
    "TestPlotHullSectionColours",
28
    "TestPlotHullSectionContour",
29
    "TestPlotVisibleSpectrumSection",
30
    "TestPlotRGBColourspaceSection",
31
]
32

33

34
class TestPlotHullSectionColours:
×
35
    """
36
    Define :func:`colour.plotting.section.plot_hull_section_colours`
37
    definition unit tests methods.
38
    """
39

40
    def test_plot_hull_section_colours(self):
×
41
        """
42
        Test :func:`colour.plotting.section.plot_hull_section_colours`
43
        definition.
44
        """
45

46
        if not is_trimesh_installed():  # pragma: no cover
47
            return
48

49
        import trimesh
×
50

51
        vertices, faces, _outline = primitive_cube(1, 1, 1, 64, 64, 64)
×
52
        XYZ_vertices = RGB_to_XYZ(vertices["position"] + 0.5, RGB_COLOURSPACE_sRGB)
×
53
        hull = trimesh.Trimesh(XYZ_vertices, faces, process=False)
×
54

55
        figure, axes = plot_hull_section_colours(hull)
×
56

57
        assert isinstance(figure, Figure)
×
58
        assert isinstance(axes, Axes)
×
59

60
        figure, axes = plot_hull_section_colours(hull, axis="+x")
×
61

62
        assert isinstance(figure, Figure)
×
63
        assert isinstance(axes, Axes)
×
64

65
        figure, axes = plot_hull_section_colours(hull, axis="+y")
×
66

67
        assert isinstance(figure, Figure)
×
68
        assert isinstance(axes, Axes)
×
69

70

71
class TestPlotHullSectionContour:
×
72
    """
73
    Define :func:`colour.plotting.section.plot_hull_section_contour`
74
    definition unit tests methods.
75
    """
76

77
    def test_plot_hull_section_contour(self):
×
78
        """
79
        Test :func:`colour.plotting.section.plot_hull_section_contour`
80
        definition.
81
        """
82

83
        if not is_trimesh_installed():  # pragma: no cover
84
            return
85

86
        import trimesh
×
87

88
        vertices, faces, _outline = primitive_cube(1, 1, 1, 64, 64, 64)
×
89
        XYZ_vertices = RGB_to_XYZ(vertices["position"] + 0.5, RGB_COLOURSPACE_sRGB)
×
90
        hull = trimesh.Trimesh(XYZ_vertices, faces, process=False)
×
91

92
        figure, axes = plot_hull_section_contour(hull)
×
93

94
        assert isinstance(figure, Figure)
×
95
        assert isinstance(axes, Axes)
×
96

97

98
class TestPlotVisibleSpectrumSection:
×
99
    """
100
    Define :func:`colour.plotting.section.plot_visible_spectrum_section`
101
    definition unit tests methods.
102
    """
103

104
    def test_plot_visible_spectrum_section(self):
×
105
        """
106
        Test :func:`colour.plotting.section.plot_visible_spectrum_section`
107
        definition.
108
        """
109

110
        if not is_trimesh_installed():  # pragma: no cover
111
            return
112

113
        figure, axes = plot_visible_spectrum_section()
×
114

115
        assert isinstance(figure, Figure)
×
116
        assert isinstance(axes, Axes)
×
117

118

119
class TestPlotRGBColourspaceSection:
×
120
    """
121
    Define :func:`colour.plotting.section.plot_RGB_colourspace_section`
122
    definition unit tests methods.
123
    """
124

125
    def test_plot_RGB_colourspace_section(self):
×
126
        """
127
        Test :func:`colour.plotting.section.plot_RGB_colourspace_section`
128
        definition.
129
        """
130

131
        if not is_trimesh_installed():  # pragma: no cover
132
            return
133

134
        figure, axes = plot_RGB_colourspace_section("sRGB")
×
135

136
        assert isinstance(figure, Figure)
×
137
        assert isinstance(axes, Axes)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc