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

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

2

3 from __future__ import annotations

4

5 from matplotlib.axes import Axes

6 from matplotlib.figure import Figure

7

8 from colour.colorimetry import SDS_ILLUMINANTS

9 from 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)

18 from 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

39 SPECIFICATION_ANSIIESTM3018 = colour_fidelity_index_ANSIIESTM3018(

40 SDS_ILLUMINANTS["FL2"], True

41)

42

43

44 class 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.\

53 plot_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

62 class TestPlotColourVectorGraphic:

63 """

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

65 plot_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.\

71 plot_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

80 class 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

98 class 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.\

107 plot_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

116 class 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.\

125 plot_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

134 class 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.\

143 plot_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

152 class TestPlotColourFidelityIndexes:

153 """

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

155 plot_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.\

161 plot_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)