Coverage for colour/difference/tests/test_stress.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.difference.stress` module.""" 

2 

3from __future__ import annotations 

4 

5import numpy as np 

6 

7from colour.constants import TOLERANCE_ABSOLUTE_TESTS 

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

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