Skip to content

Commit

Permalink
Enable ANN checks.
Browse files Browse the repository at this point in the history
Add type annotations to unit tests.
  • Loading branch information
KelSolaar committed Dec 21, 2024
1 parent 72a2906 commit b2c4504
Show file tree
Hide file tree
Showing 284 changed files with 3,830 additions and 3,222 deletions.
2 changes: 1 addition & 1 deletion colour/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@
class colour(ModuleAPI):
"""Define a class acting like the *colour* module."""

def __getattr__(self, attribute) -> Any:
def __getattr__(self, attribute: str) -> Any:
"""Return the value from the attribute with given name."""

return super().__getattr__(attribute)
Expand Down
6 changes: 4 additions & 2 deletions colour/adaptation/tests/test__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Define the unit tests for the :mod:`colour.adaptation` module."""

from __future__ import annotations

import numpy as np

from colour.adaptation import chromatic_adaptation
Expand All @@ -24,7 +26,7 @@ class TestChromaticAdaptation:
tests methods.
"""

def test_chromatic_adaptation(self):
def test_chromatic_adaptation(self) -> None:
"""Test :func:`colour.adaptation.chromatic_adaptation` definition."""

XYZ = np.array([0.20654008, 0.12197225, 0.05136952])
Expand Down Expand Up @@ -68,7 +70,7 @@ def test_chromatic_adaptation(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_chromatic_adaptation(self):
def test_domain_range_scale_chromatic_adaptation(self) -> None:
"""
Test :func:`colour.adaptation.chromatic_adaptation` definition domain
and range scale support.
Expand Down
10 changes: 6 additions & 4 deletions colour/adaptation/tests/test_cie1994.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Define the unit tests for the :mod:`colour.adaptation.cie1994` module."""

from __future__ import annotations

from itertools import product

import numpy as np
Expand All @@ -26,7 +28,7 @@ class TestChromaticAdaptationCIE1994:
definition unit tests methods.
"""

def test_chromatic_adaptation_CIE1994(self):
def test_chromatic_adaptation_CIE1994(self) -> None:
"""
Test :func:`colour.adaptation.cie1994.chromatic_adaptation_CIE1994`
definition.
Expand Down Expand Up @@ -71,7 +73,7 @@ def test_chromatic_adaptation_CIE1994(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_chromatic_adaptation_CIE1994(self):
def test_n_dimensional_chromatic_adaptation_CIE1994(self) -> None:
"""
Test :func:`colour.adaptation.cie1994.chromatic_adaptation_CIE1994`
definition n-dimensional arrays support.
Expand Down Expand Up @@ -117,7 +119,7 @@ def test_n_dimensional_chromatic_adaptation_CIE1994(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_chromatic_adaptation_CIE1994(self):
def test_domain_range_scale_chromatic_adaptation_CIE1994(self) -> None:
"""
Test :func:`colour.adaptation.cie1994.chromatic_adaptation_CIE1994`
definition domain and range scale support.
Expand All @@ -143,7 +145,7 @@ def test_domain_range_scale_chromatic_adaptation_CIE1994(self):
)

@ignore_numpy_errors
def test_nan_chromatic_adaptation_CIE1994(self):
def test_nan_chromatic_adaptation_CIE1994(self) -> None:
"""
Test :func:`colour.adaptation.cie1994.chromatic_adaptation_CIE1994`
definition nan support.
Expand Down
18 changes: 10 additions & 8 deletions colour/adaptation/tests/test_cmccat2000.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Define the unit tests for the :mod:`colour.adaptation.cmccat2000."""

from __future__ import annotations

from itertools import product

import numpy as np
Expand Down Expand Up @@ -30,7 +32,7 @@ class TestChromaticAdaptationForwardCMCCAT2000:
chromatic_adaptation_forward_CMCCAT2000` definition unit tests methods.
"""

def test_chromatic_adaptation_forward_CMCCAT2000(self):
def test_chromatic_adaptation_forward_CMCCAT2000(self) -> None:
"""
Test :func:`colour.adaptation.cmccat2000.\
chromatic_adaptation_forward_CMCCAT2000` definition.
Expand Down Expand Up @@ -72,7 +74,7 @@ def test_chromatic_adaptation_forward_CMCCAT2000(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_chromatic_adaptation_forward_CMCCAT2000(self):
def test_n_dimensional_chromatic_adaptation_forward_CMCCAT2000(self) -> None:
"""
Test :func:`colour.adaptation.cmccat2000.\
chromatic_adaptation_forward_CMCCAT2000` definition n-dimensional arrays
Expand Down Expand Up @@ -116,7 +118,7 @@ def test_n_dimensional_chromatic_adaptation_forward_CMCCAT2000(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self):
def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self) -> None:
"""
Test :func:`colour.adaptation.cmccat2000.\
chromatic_adaptation_forward_CMCCAT2000` definition domain and range scale
Expand Down Expand Up @@ -146,7 +148,7 @@ def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self):
)

@ignore_numpy_errors
def test_nan_chromatic_adaptation_forward_CMCCAT2000(self):
def test_nan_chromatic_adaptation_forward_CMCCAT2000(self) -> None:
"""
Test :func:`colour.adaptation.cmccat2000.\
chromatic_adaptation_forward_CMCCAT2000` definition nan support.
Expand All @@ -165,7 +167,7 @@ class TestChromaticAdaptationInverseCMCCAT2000:
chromatic_adaptation_inverse_CMCCAT2000` definition unit tests methods.
"""

def test_chromatic_adaptation_inverse_CMCCAT2000(self):
def test_chromatic_adaptation_inverse_CMCCAT2000(self) -> None:
"""
Test :func:`colour.adaptation.cmccat2000.\
chromatic_adaptation_inverse_CMCCAT2000` definition.
Expand Down Expand Up @@ -207,7 +209,7 @@ def test_chromatic_adaptation_inverse_CMCCAT2000(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_chromatic_adaptation_inverse_CMCCAT2000(self):
def test_n_dimensional_chromatic_adaptation_inverse_CMCCAT2000(self) -> None:
"""
Test :func:`colour.adaptation.cmccat2000.\
chromatic_adaptation_inverse_CMCCAT2000` definition n-dimensional arrays
Expand Down Expand Up @@ -251,7 +253,7 @@ def test_n_dimensional_chromatic_adaptation_inverse_CMCCAT2000(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self):
def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self) -> None:
"""
Test :func:`colour.adaptation.cmccat2000.\
chromatic_adaptation_inverse_CMCCAT2000` definition domain and range scale
Expand Down Expand Up @@ -281,7 +283,7 @@ def test_domain_range_scale_chromatic_adaptation_CMCCAT2000(self):
)

@ignore_numpy_errors
def test_nan_chromatic_adaptation_inverse_CMCCAT2000(self):
def test_nan_chromatic_adaptation_inverse_CMCCAT2000(self) -> None:
"""
Test :func:`colour.adaptation.cmccat2000.\
chromatic_adaptation_inverse_CMCCAT2000` definition nan support.
Expand Down
10 changes: 6 additions & 4 deletions colour/adaptation/tests/test_fairchild1990.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Define the unit tests for the :mod:`colour.adaptation.fairchild1990` module."""

from __future__ import annotations

import contextlib
from itertools import product

Expand Down Expand Up @@ -28,7 +30,7 @@ class TestChromaticAdaptationFairchild1990:
chromatic_adaptation_Fairchild1990` definition unit tests methods.
"""

def test_chromatic_adaptation_Fairchild1990(self):
def test_chromatic_adaptation_Fairchild1990(self) -> None:
"""
Test :func:`colour.adaptation.fairchild1990.\
chromatic_adaptation_Fairchild1990` definition.
Expand Down Expand Up @@ -67,7 +69,7 @@ def test_chromatic_adaptation_Fairchild1990(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_chromatic_adaptation_Fairchild1990(self):
def test_n_dimensional_chromatic_adaptation_Fairchild1990(self) -> None:
"""
Test :func:`colour.adaptation.fairchild1990.\
chromatic_adaptation_Fairchild1990` definition n-dimensional arrays support.
Expand Down Expand Up @@ -107,7 +109,7 @@ def test_n_dimensional_chromatic_adaptation_Fairchild1990(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_chromatic_adaptation_Fairchild1990(self):
def test_domain_range_scale_chromatic_adaptation_Fairchild1990(self) -> None:
"""
Test :func:`colour.adaptation.fairchild1990.\
chromatic_adaptation_Fairchild1990` definition domain and range scale support.
Expand All @@ -131,7 +133,7 @@ def test_domain_range_scale_chromatic_adaptation_Fairchild1990(self):
)

@ignore_numpy_errors
def test_nan_chromatic_adaptation_Fairchild1990(self):
def test_nan_chromatic_adaptation_Fairchild1990(self) -> None:
"""
Test :func:`colour.adaptation.fairchild1990.\
chromatic_adaptation_Fairchild1990` definition nan support.
Expand Down
18 changes: 10 additions & 8 deletions colour/adaptation/tests/test_fairchild2020.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Define the unit tests for the :mod:`colour.adaptation.fairchild2020` module.
"""

from __future__ import annotations

import unittest
from itertools import product

Expand Down Expand Up @@ -36,7 +38,7 @@ class TestMatrixChromaticAdaptationVonKries(unittest.TestCase):
matrix_chromatic_adaptation_vk20` definition unit tests methods.
"""

def test_matrix_chromatic_adaptation_vk20(self):
def test_matrix_chromatic_adaptation_vk20(self) -> None:
"""
Test :func:`colour.adaptation.fairchild2020.\
matrix_chromatic_adaptation_vk20` definition.
Expand Down Expand Up @@ -121,7 +123,7 @@ def test_matrix_chromatic_adaptation_vk20(self):
decimal=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_matrix_chromatic_adaptation_vk20(self):
def test_n_dimensional_matrix_chromatic_adaptation_vk20(self) -> None:
"""
Test :func:`colour.adaptation.fairchild2020.\
matrix_chromatic_adaptation_vk20` definition n-dimensional arrays support.
Expand Down Expand Up @@ -149,7 +151,7 @@ def test_n_dimensional_matrix_chromatic_adaptation_vk20(self):
decimal=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_matrix_chromatic_adaptation_vk20(self):
def test_domain_range_scale_matrix_chromatic_adaptation_vk20(self) -> None:
"""
Test :func:`colour.adaptation.fairchild2020.\
matrix_chromatic_adaptation_vk20` definition domain and range scale
Expand All @@ -173,7 +175,7 @@ def test_domain_range_scale_matrix_chromatic_adaptation_vk20(self):
)

@ignore_numpy_errors
def test_nan_matrix_chromatic_adaptation_vk20(self):
def test_nan_matrix_chromatic_adaptation_vk20(self) -> None:
"""
Test :func:`colour.adaptation.fairchild2020.\
matrix_chromatic_adaptation_vk20` definition nan support.
Expand All @@ -190,7 +192,7 @@ class TestChromaticAdaptationVonKries(unittest.TestCase):
definition unit tests methods.
"""

def test_chromatic_adaptation_vK20(self):
def test_chromatic_adaptation_vK20(self) -> None:
"""
Test :func:`colour.adaptation.fairchild2020.chromatic_adaptation_vK20`
definition.
Expand Down Expand Up @@ -260,7 +262,7 @@ def test_chromatic_adaptation_vK20(self):
decimal=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_chromatic_adaptation_vK20(self):
def test_n_dimensional_chromatic_adaptation_vK20(self) -> None:
"""
Test :func:`colour.adaptation.fairchild2020.chromatic_adaptation_vK20`
definition n-dimensional arrays support.
Expand Down Expand Up @@ -291,7 +293,7 @@ def test_n_dimensional_chromatic_adaptation_vK20(self):
decimal=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_chromatic_adaptation_vK20(self):
def test_domain_range_scale_chromatic_adaptation_vK20(self) -> None:
"""
Test :func:`colour.adaptation.fairchild2020.chromatic_adaptation_vK20`
definition domain and range scale support.
Expand All @@ -318,7 +320,7 @@ def test_domain_range_scale_chromatic_adaptation_vK20(self):
)

@ignore_numpy_errors
def test_nan_chromatic_adaptation_vK20(self):
def test_nan_chromatic_adaptation_vK20(self) -> None:
"""
Test :func:`colour.adaptation.fairchild2020.chromatic_adaptation_vK20`
definition nan support.
Expand Down
18 changes: 10 additions & 8 deletions colour/adaptation/tests/test_vonkries.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Define the unit tests for the :mod:`colour.adaptation.vonkries` module."""

from __future__ import annotations

from itertools import product

import numpy as np
Expand Down Expand Up @@ -30,7 +32,7 @@ class TestMatrixChromaticAdaptationVonKries:
matrix_chromatic_adaptation_VonKries` definition unit tests methods.
"""

def test_matrix_chromatic_adaptation_VonKries(self):
def test_matrix_chromatic_adaptation_VonKries(self) -> None:
"""
Test :func:`colour.adaptation.vonkries.\
matrix_chromatic_adaptation_VonKries` definition.
Expand Down Expand Up @@ -128,7 +130,7 @@ def test_matrix_chromatic_adaptation_VonKries(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_matrix_chromatic_adaptation_VonKries(self):
def test_n_dimensional_matrix_chromatic_adaptation_VonKries(self) -> None:
"""
Test :func:`colour.adaptation.vonkries.\
matrix_chromatic_adaptation_VonKries` definition n-dimensional arrays support.
Expand Down Expand Up @@ -156,7 +158,7 @@ def test_n_dimensional_matrix_chromatic_adaptation_VonKries(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_matrix_chromatic_adaptation_VonKries(self):
def test_domain_range_scale_matrix_chromatic_adaptation_VonKries(self) -> None:
"""
Test :func:`colour.adaptation.vonkries.\
matrix_chromatic_adaptation_VonKries` definition domain and range scale
Expand All @@ -179,7 +181,7 @@ def test_domain_range_scale_matrix_chromatic_adaptation_VonKries(self):
)

@ignore_numpy_errors
def test_nan_matrix_chromatic_adaptation_VonKries(self):
def test_nan_matrix_chromatic_adaptation_VonKries(self) -> None:
"""
Test :func:`colour.adaptation.vonkries.\
matrix_chromatic_adaptation_VonKries` definition nan support.
Expand All @@ -196,7 +198,7 @@ class TestChromaticAdaptationVonKries:
definition unit tests methods.
"""

def test_chromatic_adaptation_VonKries(self):
def test_chromatic_adaptation_VonKries(self) -> None:
"""
Test :func:`colour.adaptation.vonkries.chromatic_adaptation_VonKries`
definition.
Expand Down Expand Up @@ -265,7 +267,7 @@ def test_chromatic_adaptation_VonKries(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_chromatic_adaptation_VonKries(self):
def test_n_dimensional_chromatic_adaptation_VonKries(self) -> None:
"""
Test :func:`colour.adaptation.vonkries.chromatic_adaptation_VonKries`
definition n-dimensional arrays support.
Expand Down Expand Up @@ -296,7 +298,7 @@ def test_n_dimensional_chromatic_adaptation_VonKries(self):
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_domain_range_scale_chromatic_adaptation_VonKries(self):
def test_domain_range_scale_chromatic_adaptation_VonKries(self) -> None:
"""
Test :func:`colour.adaptation.vonkries.chromatic_adaptation_VonKries`
definition domain and range scale support.
Expand All @@ -319,7 +321,7 @@ def test_domain_range_scale_chromatic_adaptation_VonKries(self):
)

@ignore_numpy_errors
def test_nan_chromatic_adaptation_VonKries(self):
def test_nan_chromatic_adaptation_VonKries(self) -> None:
"""
Test :func:`colour.adaptation.vonkries.chromatic_adaptation_VonKries`
definition nan support.
Expand Down
Loading

0 comments on commit b2c4504

Please sign in to comment.