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

16 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2025-11-15 19:01 +1300

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

2 

3from __future__ import annotations 

4 

5import numpy as np 

6 

7from colour.constants import TOLERANCE_ABSOLUTE_TESTS 

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

22class 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 )