Coverage for plotting/tests/test_quality.py: 100%

1"""Define the unit tests for the :mod:`colour.plotting.quality` 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 (

9 SDS_ILLUMINANTS,

10 SDS_LIGHT_SOURCES,

11 SpectralShape,

12 reshape_sd,

13)

14 from colour.plotting import (

15 plot_multi_sds_colour_quality_scales_bars,

16 plot_multi_sds_colour_rendering_indexes_bars,

17 plot_single_sd_colour_quality_scale_bars,

18 plot_single_sd_colour_rendering_index_bars,

19)

20 from colour.plotting.quality import plot_colour_quality_bars

21 from colour.quality import colour_quality_scale

22

23 __author__ = "Colour Developers"

24 __copyright__ = "Copyright 2013 Colour Developers"

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

26 __maintainer__ = "Colour Developers"

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

28 __status__ = "Production"

29

30 __all__ = [

31 "TestPlotColourQualityBars",

32 "TestPlotSingleSdColourRenderingIndexBars",

33 "TestPlotMultiSdsColourRenderingIndexesBars",

34 "TestPlotSingleSdColourQualityScaleBars",

35 "TestPlotMultiSdsColourQualityScalesBars",

36]

37

38

39 class TestPlotColourQualityBars:

40 """

41 Define :func:`colour.plotting.quality.plot_colour_quality_bars` definition

42 unit tests methods.

43 """

44

45 def test_plot_colour_quality_bars(self) -> None:

46 """

47 Test :func:`colour.plotting.quality.plot_colour_quality_bars`

48 definition.

49 """

50

51 illuminant = SDS_ILLUMINANTS["FL2"]

52 light_source = SDS_LIGHT_SOURCES["Kinoton 75P"]

53 light_source = reshape_sd(light_source, SpectralShape(360, 830, 1))

54 cqs_i = colour_quality_scale(illuminant, additional_data=True)

55 cqs_l = colour_quality_scale(light_source, additional_data=True)

56

57 figure, axes = plot_colour_quality_bars([cqs_i, cqs_l])

58

59 assert isinstance(figure, Figure)

60 assert isinstance(axes, Axes)

61

62

63 class TestPlotSingleSdColourRenderingIndexBars:

64 """

65 Define :func:`colour.plotting.quality.\

66 plot_single_sd_colour_rendering_index_bars` definition unit tests methods.

67 """

68

69 def test_plot_single_sd_colour_rendering_index_bars(self) -> None:

70 """

71 Test :func:`colour.plotting.quality.\

72 plot_single_sd_colour_rendering_index_bars` definition.

73 """

74

75 figure, axes = plot_single_sd_colour_rendering_index_bars(

76 SDS_ILLUMINANTS["FL2"]

77 )

78

79 assert isinstance(figure, Figure)

80 assert isinstance(axes, Axes)

81

82

83 class TestPlotMultiSdsColourRenderingIndexesBars:

84 """

85 Define :func:`colour.plotting.quality.\

86 plot_multi_sds_colour_rendering_indexes_bars` definition unit tests methods.

87 """

88

89 def test_plot_multi_sds_colour_rendering_indexes_bars(self) -> None:

90 """

91 Test :func:`colour.plotting.quality.\

92 plot_multi_sds_colour_rendering_indexes_bars` definition.

93 """

94

95 figure, axes = plot_multi_sds_colour_rendering_indexes_bars(

96 [SDS_ILLUMINANTS["FL2"], SDS_LIGHT_SOURCES["Kinoton 75P"]]

97 )

98

99 assert isinstance(figure, Figure)

100 assert isinstance(axes, Axes)

101

102

103 class TestPlotSingleSdColourQualityScaleBars:

104 """

105 Define :func:`colour.plotting.quality.\

106 plot_single_sd_colour_quality_scale_bars` definition unit tests methods.

107 """

108

109 def test_plot_single_sd_colour_quality_scale_bars(self) -> None:

110 """

111 Test :func:`colour.plotting.quality.\

112 plot_single_sd_colour_quality_scale_bars` definition.

113 """

114

115 figure, axes = plot_single_sd_colour_quality_scale_bars(SDS_ILLUMINANTS["FL2"])

116

117 assert isinstance(figure, Figure)

118 assert isinstance(axes, Axes)

119

120

121 class TestPlotMultiSdsColourQualityScalesBars:

122 """

123 Define :func:`colour.plotting.quality.\

124 plot_multi_sds_colour_quality_scales_bars` definition unit tests methods.

125 """

126

127 def test_plot_multi_sds_colour_quality_scales_bars(self) -> None:

128 """

129 Test :func:`colour.plotting.quality.\

130 plot_multi_sds_colour_quality_scales_bars` definition.

131 """

132

133 figure, axes = plot_multi_sds_colour_quality_scales_bars(

134 [SDS_ILLUMINANTS["FL2"], SDS_LIGHT_SOURCES["Kinoton 75P"]]

135 )

136

137 assert isinstance(figure, Figure)

138 assert isinstance(axes, Axes)