Coverage for plotting/tm3018/tests/test_components.py: 100%

49 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-16 22:49 +1300

1"""Define the unit tests for the :mod:`colour.plotting.tm3018.components` module.""" 

2 

3from __future__ import annotations 

4 

5from matplotlib.axes import Axes 

6from matplotlib.figure import Figure 

7 

8from colour.colorimetry import SDS_ILLUMINANTS 

9from colour.plotting.tm3018.components import ( 

10 plot_16_bin_bars, 

11 plot_colour_fidelity_indexes, 

12 plot_colour_vector_graphic, 

13 plot_local_chroma_shifts, 

14 plot_local_colour_fidelities, 

15 plot_local_hue_shifts, 

16 plot_spectra_ANSIIESTM3018, 

17) 

18from colour.quality import ( 

19 colour_fidelity_index_ANSIIESTM3018, 

20) 

21 

22__author__ = "Colour Developers" 

23__copyright__ = "Copyright 2013 Colour Developers" 

24__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" 

25__maintainer__ = "Colour Developers" 

26__email__ = "colour-developers@colour-science.org" 

27__status__ = "Production" 

28 

29__all__ = [ 

30 "TestPlotSpectraANSIIESTM3018", 

31 "TestPlotColourVectorGraphic", 

32 "TestPlot16BinBars", 

33 "TestPlotLocalChromaShifts", 

34 "TestPlotLocalHueShifts", 

35 "TestPlotLocalColourFidelities", 

36 "TestPlotColourFidelityIndexes", 

37] 

38 

39SPECIFICATION_ANSIIESTM3018 = colour_fidelity_index_ANSIIESTM3018( 

40 SDS_ILLUMINANTS["FL2"], True 

41) 

42 

43 

44class TestPlotSpectraANSIIESTM3018: 

45 """ 

46 Define :func:`colour.plotting.tm3018.components. 

47 plot_spectra_ANSIIESTM3018` definition unit tests methods. 

48 """ 

49 

50 def test_plot_spectra_ANSIIESTM3018(self) -> None: 

51 """ 

52 Test :func:`colour.plotting.tm3018.components.\ 

53plot_spectra_ANSIIESTM3018` definition. 

54 """ 

55 

56 figure, axes = plot_spectra_ANSIIESTM3018(SPECIFICATION_ANSIIESTM3018) 

57 

58 assert isinstance(figure, Figure) 

59 assert isinstance(axes, Axes) 

60 

61 

62class TestPlotColourVectorGraphic: 

63 """ 

64 Define :func:`colour.plotting.tm3018.components.\ 

65plot_colour_vector_graphic` definition unit tests methods. 

66 """ 

67 

68 def test_plot_colour_vector_graphic(self) -> None: 

69 """ 

70 Test :func:`colour.plotting.tm3018.components.\ 

71plot_colour_vector_graphic` definition. 

72 """ 

73 

74 figure, axes = plot_colour_vector_graphic(SPECIFICATION_ANSIIESTM3018) 

75 

76 assert isinstance(figure, Figure) 

77 assert isinstance(axes, Axes) 

78 

79 

80class TestPlot16BinBars: 

81 """ 

82 Define :func:`colour.plotting.tm3018.components.plot_16_bin_bars` 

83 definition unit tests methods. 

84 """ 

85 

86 def test_plot_16_bin_bars(self) -> None: 

87 """ 

88 Test :func:`colour.plotting.tm3018.components.plot_16_bin_bars` 

89 definition. 

90 """ 

91 

92 figure, axes = plot_16_bin_bars(range(16), "{0}") 

93 

94 assert isinstance(figure, Figure) 

95 assert isinstance(axes, Axes) 

96 

97 

98class TestPlotLocalChromaShifts: 

99 """ 

100 Define :func:`colour.plotting.tm3018.components.plot_local_chroma_shifts` 

101 definition unit tests methods. 

102 """ 

103 

104 def test_plot_local_chroma_shifts(self) -> None: 

105 """ 

106 Test :func:`colour.plotting.tm3018.components.\ 

107plot_local_chroma_shifts` definition. 

108 """ 

109 

110 figure, axes = plot_local_chroma_shifts(SPECIFICATION_ANSIIESTM3018) 

111 

112 assert isinstance(figure, Figure) 

113 assert isinstance(axes, Axes) 

114 

115 

116class TestPlotLocalHueShifts: 

117 """ 

118 Define :func:`colour.plotting.tm3018.components.plot_local_hue_shifts` 

119 definition unit tests methods. 

120 """ 

121 

122 def test_plot_local_hue_shifts(self) -> None: 

123 """ 

124 Test :func:`colour.plotting.tm3018.components.\ 

125plot_local_hue_shifts` definition. 

126 """ 

127 

128 figure, axes = plot_local_hue_shifts(SPECIFICATION_ANSIIESTM3018) 

129 

130 assert isinstance(figure, Figure) 

131 assert isinstance(axes, Axes) 

132 

133 

134class TestPlotLocalColourFidelities: 

135 """ 

136 Define :func:`colour.plotting.tm3018.components. 

137 plot_local_colour_fidelities` definition unit tests methods. 

138 """ 

139 

140 def test_plot_local_colour_fidelities(self) -> None: 

141 """ 

142 Test :func:`colour.plotting.tm3018.components.\ 

143plot_local_colour_fidelities` definition. 

144 """ 

145 

146 figure, axes = plot_local_colour_fidelities(SPECIFICATION_ANSIIESTM3018) 

147 

148 assert isinstance(figure, Figure) 

149 assert isinstance(axes, Axes) 

150 

151 

152class TestPlotColourFidelityIndexes: 

153 """ 

154 Define :func:`colour.plotting.tm3018.components.\ 

155plot_colour_fidelity_indexes` definition unit tests methods. 

156 """ 

157 

158 def test_plot_colour_fidelity_indexes(self) -> None: 

159 """ 

160 Test :func:`colour.plotting.tm3018.components.\ 

161plot_colour_fidelity_indexes` definition. 

162 """ 

163 

164 figure, axes = plot_colour_fidelity_indexes(SPECIFICATION_ANSIIESTM3018) 

165 

166 assert isinstance(figure, Figure) 

167 assert isinstance(axes, Axes)