Coverage for difference/tests/test_stress.py: 100%

1"""Define the unit tests for the :mod:`colour.difference.stress` 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.difference import index_stress

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 "TestIndexStress",

19]

20

21

22 class TestIndexStress:

23 """

24 Define :func:`colour.difference.stress.index_stress_Garcia2007` definition

25 unit tests methods.

26 """

27

28 def test_index_stress(self) -> None:

29 """

30 Test :func:`colour.difference.stress.index_stress_Garcia2007`

31 definition.

32 """

33

34 d_E = np.array([2.0425, 2.8615, 3.4412])

35 d_V = np.array([1.2644, 1.2630, 1.8731])

36

37 np.testing.assert_allclose(

38 index_stress(d_E, d_V),

39 0.121170939369957,

40 atol=TOLERANCE_ABSOLUTE_TESTS,

41 )