Coverage for notation/tests/test_css_color_3.py: 100%

1"""Define the unit tests for the :mod:`colour.notation.css_color_3` module."""

2

3 from __future__ import annotations

4

5 import numpy as np

6

7 from colour.constants import TOLERANCE_ABSOLUTE_TESTS

8 from colour.notation import keyword_to_RGB_CSSColor3

9

10 __author__ = "Colour Developers"

11 __copyright__ = "Copyright 2013 Colour Developers"

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

13 __maintainer__ = "Colour Developers"

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

15 __status__ = "Production"

16

17 __all__ = [

18 "TestKeywordToRGBCSSColor3",

19]

20

21

22 class TestKeywordToRGBCSSColor3:

23 """

24 Define :func:`colour.notation.css_color_3.keyword_to_RGB_CSSColor3`

25 definition unit tests methods.

26 """

27

28 def test_keyword_to_RGB_CSSColor3(self) -> None:

29 """

30 Test :func:`colour.notation.css_color_3.keyword_to_RGB_CSSColor3`

31 definition.

32 """

33

34 np.testing.assert_array_equal(

35 keyword_to_RGB_CSSColor3("black"), np.array([0, 0, 0])

36 )

37

38 np.testing.assert_array_equal(

39 keyword_to_RGB_CSSColor3("white"), np.array([1, 1, 1])

40 )

41

42 np.testing.assert_allclose(

43 keyword_to_RGB_CSSColor3("aliceblue"),

44 np.array([0.94117647, 0.97254902, 1.00000000]),

45 atol=TOLERANCE_ABSOLUTE_TESTS,

46 )