From b2c4504cd6cd08e3ddae29a7581636a19061b4a6 Mon Sep 17 00:00:00 2001 From: Thomas Mansencal Date: Sat, 21 Dec 2024 20:33:15 +1300 Subject: [PATCH] Enable `ANN` checks. Add type annotations to unit tests. --- colour/__init__.py | 2 +- colour/adaptation/tests/test__init__.py | 6 +- colour/adaptation/tests/test_cie1994.py | 10 +- colour/adaptation/tests/test_cmccat2000.py | 18 +- colour/adaptation/tests/test_fairchild1990.py | 10 +- colour/adaptation/tests/test_fairchild2020.py | 18 +- colour/adaptation/tests/test_vonkries.py | 18 +- colour/adaptation/tests/test_zhai2018.py | 10 +- colour/algebra/__init__.py | 2 +- colour/algebra/common.py | 8 +- .../coordinates/tests/test_transformations.py | 38 ++-- colour/algebra/extrapolation.py | 8 +- colour/algebra/interpolation.py | 48 ++--- colour/algebra/tests/test_common.py | 54 ++--- colour/algebra/tests/test_extrapolation.py | 18 +- colour/algebra/tests/test_interpolation.py | 102 ++++----- colour/algebra/tests/test_prng.py | 2 +- colour/algebra/tests/test_regression.py | 4 +- colour/appearance/hunt.py | 12 +- colour/appearance/kim2009.py | 2 +- colour/appearance/tests/test_atd95.py | 10 +- colour/appearance/tests/test_cam16.py | 24 ++- colour/appearance/tests/test_ciecam02.py | 24 ++- colour/appearance/tests/test_ciecam16.py | 24 ++- colour/appearance/tests/test_hellwig2022.py | 24 ++- colour/appearance/tests/test_hke.py | 26 +-- colour/appearance/tests/test_hunt.py | 14 +- colour/appearance/tests/test_kim2009.py | 24 ++- colour/appearance/tests/test_llab.py | 24 ++- colour/appearance/tests/test_nayatani95.py | 10 +- colour/appearance/tests/test_rlab.py | 10 +- colour/appearance/tests/test_zcam.py | 32 +-- .../tests/test_michaelis_menten.py | 26 +-- colour/blindness/tests/test_machado2009.py | 32 +-- colour/characterisation/aces_it.py | 11 +- colour/characterisation/cameras.py | 5 +- colour/characterisation/correction.py | 20 +- colour/characterisation/displays.py | 5 +- colour/characterisation/tests/test_aces_it.py | 64 +++--- .../characterisation/tests/test_correction.py | 64 +++--- colour/colorimetry/cmfs.py | 11 +- colour/colorimetry/spectrum.py | 38 ++-- colour/colorimetry/tests/test_blackbody.py | 18 +- colour/colorimetry/tests/test_correction.py | 4 +- colour/colorimetry/tests/test_dominant.py | 42 ++-- colour/colorimetry/tests/test_generation.py | 22 +- colour/colorimetry/tests/test_illuminants.py | 10 +- colour/colorimetry/tests/test_lefs.py | 10 +- colour/colorimetry/tests/test_lightness.py | 63 +++--- colour/colorimetry/tests/test_luminance.py | 63 +++--- colour/colorimetry/tests/test_photometry.py | 8 +- colour/colorimetry/tests/test_spectrum.py | 106 +++++----- .../colorimetry/tests/test_transformations.py | 32 +-- .../tests/test_tristimulus_values.py | 54 ++--- colour/colorimetry/tests/test_uniformity.py | 2 +- colour/colorimetry/tests/test_whiteness.py | 52 ++--- colour/colorimetry/tests/test_yellowness.py | 28 +-- colour/colorimetry/uniformity.py | 3 + colour/continuous/abstract.py | 18 +- colour/continuous/multi_signals.py | 42 ++-- colour/continuous/signal.py | 39 ++-- colour/continuous/tests/test_abstract.py | 6 +- colour/continuous/tests/test_multi_signal.py | 80 +++---- colour/continuous/tests/test_signal.py | 68 +++--- colour/contrast/__init__.py | 4 +- colour/contrast/tests/test_barten1999.py | 38 ++-- colour/corresponding/datasets/breneman1987.py | 23 +- colour/corresponding/tests/test_prediction.py | 12 +- colour/difference/tests/test__init__.py | 4 +- colour/difference/tests/test_cam02_ucs.py | 8 +- colour/difference/tests/test_cam16_ucs.py | 2 + colour/difference/tests/test_delta_e.py | 62 +++--- colour/difference/tests/test_din99.py | 10 +- colour/difference/tests/test_huang2015.py | 4 +- colour/difference/tests/test_stress.py | 4 +- colour/examples/io/examples_ctl.py | 3 +- .../plotting/examples_section_plots.py | 2 +- colour/geometry/section.py | 4 +- colour/geometry/tests/test_ellipse.py | 10 +- colour/geometry/tests/test_intersection.py | 6 +- colour/geometry/tests/test_primitives.py | 10 +- colour/geometry/tests/test_section.py | 10 +- colour/geometry/tests/test_vertices.py | 10 +- colour/geometry/vertices.py | 30 +-- colour/graph/conversion.py | 22 +- colour/graph/tests/test_conversion.py | 8 +- colour/hints/__init__.py | 8 +- colour/io/__init__.py | 2 +- colour/io/fichet2021.py | 22 +- colour/io/image.py | 6 +- colour/io/luts/cinespace_csp.py | 6 +- colour/io/luts/iridas_cube.py | 6 +- colour/io/luts/lut.py | 12 +- colour/io/luts/operator.py | 8 +- colour/io/luts/sequence.py | 12 +- colour/io/luts/tests/test__init__.py | 22 +- colour/io/luts/tests/test_cinespace_csp.py | 141 +++++++++---- colour/io/luts/tests/test_common.py | 4 +- colour/io/luts/tests/test_iridas_cube.py | 11 +- colour/io/luts/tests/test_lut.py | 100 ++++----- colour/io/luts/tests/test_operator.py | 26 +-- colour/io/luts/tests/test_resolve_cube.py | 110 ++++++---- colour/io/luts/tests/test_sequence.py | 30 +-- colour/io/luts/tests/test_sony_spi1d.py | 8 +- colour/io/luts/tests/test_sony_spi3d.py | 8 +- colour/io/luts/tests/test_sony_spimtx.py | 8 +- colour/io/tests/test_ctl.py | 12 +- colour/io/tests/test_fichet2021.py | 63 +++--- colour/io/tests/test_image.py | 98 +++++---- colour/io/tests/test_ocio.py | 4 +- colour/io/tests/test_tabular.py | 12 +- colour/io/tests/test_tm2714.py | 36 ++-- colour/io/tests/test_uprtek_sekonic.py | 22 +- colour/io/tests/test_xrite.py | 2 +- colour/io/tm2714.py | 38 ++-- colour/models/cie_luv.py | 2 +- colour/models/cie_ucs.py | 2 +- colour/models/cie_xyy.py | 2 +- colour/models/hunter_lab.py | 12 +- colour/models/hunter_rdab.py | 12 +- .../models/rgb/datasets/tests/test__init__.py | 12 +- colour/models/rgb/ictcp.py | 8 +- colour/models/rgb/itut_h_273.py | 14 +- colour/models/rgb/rgb_colourspace.py | 28 +-- colour/models/rgb/tests/test_cmyk.py | 34 +-- colour/models/rgb/tests/test_common.py | 6 +- colour/models/rgb/tests/test_cylindrical.py | 50 ++--- colour/models/rgb/tests/test_derivation.py | 28 +-- colour/models/rgb/tests/test_hanbury2003.py | 18 +- colour/models/rgb/tests/test_ictcp.py | 34 +-- colour/models/rgb/tests/test_itut_h_273.py | 8 +- colour/models/rgb/tests/test_prismatic.py | 18 +- .../models/rgb/tests/test_rgb_colourspace.py | 122 +++++------ colour/models/rgb/tests/test_ycbcr.py | 42 ++-- colour/models/rgb/tests/test_ycocg.py | 14 +- .../models/rgb/transfer_functions/__init__.py | 2 +- .../rgb/transfer_functions/itur_bt_1361.py | 7 +- .../rgb/transfer_functions/itut_h_273.py | 27 ++- colour/models/rgb/transfer_functions/red.py | 2 +- .../transfer_functions/tests/test__init__.py | 6 +- .../rgb/transfer_functions/tests/test_aces.py | 52 ++--- .../tests/test_apple_log_profile.py | 16 +- .../tests/test_arib_std_b67.py | 16 +- .../rgb/transfer_functions/tests/test_arri.py | 32 +-- .../tests/test_blackmagic_design.py | 16 +- .../transfer_functions/tests/test_canon.py | 96 ++++----- .../transfer_functions/tests/test_cineon.py | 16 +- .../transfer_functions/tests/test_common.py | 14 +- .../tests/test_davinci_intermediate.py | 16 +- .../rgb/transfer_functions/tests/test_dcdm.py | 16 +- .../tests/test_dicom_gsdf.py | 16 +- .../tests/test_dji_d_log.py | 16 +- .../transfer_functions/tests/test_exponent.py | 12 +- .../tests/test_filmic_pro.py | 16 +- .../tests/test_filmlight_t_log.py | 16 +- .../tests/test_fujifilm_f_log.py | 32 +-- .../transfer_functions/tests/test_gamma.py | 6 +- .../transfer_functions/tests/test_gopro.py | 16 +- .../tests/test_itur_bt_1361.py | 16 +- .../tests/test_itur_bt_1886.py | 16 +- .../tests/test_itur_bt_2020.py | 16 +- .../tests/test_itur_bt_2100.py | 130 ++++++------ .../tests/test_itur_bt_601.py | 16 +- .../tests/test_itur_bt_709.py | 16 +- .../tests/test_itut_h_273.py | 64 +++--- .../tests/test_leica_l_log.py | 16 +- .../transfer_functions/tests/test_linear.py | 6 +- .../rgb/transfer_functions/tests/test_log.py | 34 +-- .../tests/test_nikon_n_log.py | 16 +- .../transfer_functions/tests/test_panalog.py | 16 +- .../tests/test_panasonic_vlog.py | 16 +- .../tests/test_pivoted_log.py | 16 +- .../rgb/transfer_functions/tests/test_red.py | 96 ++++----- .../tests/test_rimm_romm_rgb.py | 48 ++--- .../tests/test_smpte_240m.py | 16 +- .../rgb/transfer_functions/tests/test_sony.py | 48 ++--- .../rgb/transfer_functions/tests/test_srgb.py | 16 +- .../transfer_functions/tests/test_st_2084.py | 16 +- .../tests/test_viper_log.py | 16 +- colour/models/tests/test_cam02_ucs.py | 36 ++-- colour/models/tests/test_cam16_ucs.py | 2 + colour/models/tests/test_cie_lab.py | 18 +- colour/models/tests/test_cie_luv.py | 62 +++--- colour/models/tests/test_cie_ucs.py | 62 +++--- colour/models/tests/test_cie_uvw.py | 18 +- colour/models/tests/test_cie_xyy.py | 54 ++--- colour/models/tests/test_common.py | 38 ++-- colour/models/tests/test_din99.py | 34 +-- colour/models/tests/test_hdr_cie_lab.py | 26 +-- colour/models/tests/test_hdr_ipt.py | 26 +-- colour/models/tests/test_hunter_lab.py | 24 ++- colour/models/tests/test_hunter_rdab.py | 18 +- colour/models/tests/test_icacb.py | 18 +- colour/models/tests/test_igpgtg.py | 18 +- colour/models/tests/test_ipt.py | 26 +-- colour/models/tests/test_jzazbz.py | 34 +-- colour/models/tests/test_oklab.py | 18 +- colour/models/tests/test_osa_ucs.py | 18 +- colour/models/tests/test_prolab.py | 18 +- colour/models/tests/test_ragoo2021.py | 18 +- colour/models/tests/test_yrg.py | 34 +-- colour/notation/munsell.py | 2 +- colour/notation/tests/test_css_color_3.py | 2 +- colour/notation/tests/test_hexadecimal.py | 16 +- colour/notation/tests/test_munsell.py | 116 +++++------ colour/phenomena/tests/test_rayleigh.py | 92 ++++---- colour/plotting/colorimetry.py | 2 + colour/plotting/common.py | 11 +- colour/plotting/diagrams.py | 8 + colour/plotting/models.py | 3 +- colour/plotting/quality.py | 3 + colour/plotting/temperature.py | 5 +- colour/plotting/tests/test_blindness.py | 4 +- .../plotting/tests/test_characterisation.py | 6 +- colour/plotting/tests/test_colorimetry.py | 28 +-- colour/plotting/tests/test_common.py | 87 ++++---- colour/plotting/tests/test_corresponding.py | 4 +- colour/plotting/tests/test_diagrams.py | 24 ++- colour/plotting/tests/test_graph.py | 4 +- colour/plotting/tests/test_models.py | 40 ++-- colour/plotting/tests/test_notation.py | 6 +- colour/plotting/tests/test_phenomena.py | 6 +- colour/plotting/tests/test_quality.py | 14 +- colour/plotting/tests/test_section.py | 10 +- colour/plotting/tests/test_temperature.py | 16 +- colour/plotting/tests/test_volume.py | 10 +- colour/plotting/tm3018/components.py | 2 +- .../plotting/tm3018/tests/test_components.py | 14 +- colour/plotting/tm3018/tests/test_report.py | 10 +- colour/plotting/volume.py | 28 +-- colour/quality/__init__.py | 2 +- colour/quality/tests/test_cfi2017.py | 25 ++- colour/quality/tests/test_cqs.py | 196 ++++++++++-------- colour/quality/tests/test_cri.py | 24 ++- colour/quality/tests/test_ssi.py | 4 +- colour/quality/tests/test_tm3018.py | 15 +- colour/recovery/jakob2019.py | 4 +- colour/recovery/jiang2013.py | 3 +- colour/recovery/otsu2018.py | 16 +- colour/recovery/tests/test__init__.py | 6 +- colour/recovery/tests/test_jakob2019.py | 48 +++-- colour/recovery/tests/test_jiang2013.py | 18 +- colour/recovery/tests/test_mallett2019.py | 25 ++- colour/recovery/tests/test_meng2015.py | 10 +- colour/recovery/tests/test_otsu2018.py | 133 ++++++------ colour/recovery/tests/test_smits1999.py | 6 +- colour/temperature/ohno2013.py | 4 +- colour/temperature/tests/test_cie_d.py | 14 +- .../temperature/tests/test_hernandez1999.py | 14 +- colour/temperature/tests/test_kang2002.py | 14 +- colour/temperature/tests/test_krystek1985.py | 14 +- colour/temperature/tests/test_mccamy1992.py | 14 +- colour/temperature/tests/test_ohno2013.py | 28 +-- colour/temperature/tests/test_planck1900.py | 14 +- .../temperature/tests/test_robertson1968.py | 24 +-- colour/utilities/__init__.py | 2 +- colour/utilities/array.py | 24 ++- colour/utilities/common.py | 25 ++- colour/utilities/network.py | 55 ++--- colour/utilities/structures.py | 12 +- colour/utilities/tests/test_array.py | 156 +++++++------- colour/utilities/tests/test_callback.py | 16 +- colour/utilities/tests/test_common.py | 58 +++--- colour/utilities/tests/test_deprecated.py | 4 +- colour/utilities/tests/test_deprecation.py | 58 +++--- colour/utilities/tests/test_documentation.py | 4 +- colour/utilities/tests/test_metrics.py | 6 +- colour/utilities/tests/test_network.py | 173 ++++++++-------- colour/utilities/tests/test_structures.py | 62 +++--- colour/utilities/tests/test_verbose.py | 24 ++- colour/utilities/verbose.py | 16 +- colour/volume/tests/test_macadam_limits.py | 8 +- colour/volume/tests/test_mesh.py | 10 +- colour/volume/tests/test_pointer_gamut.py | 8 +- colour/volume/tests/test_rgb.py | 20 +- colour/volume/tests/test_spectrum.py | 12 +- docs/colour.hints.rst | 1 + pyproject.toml | 3 +- tasks.py | 32 +-- utilities/export_todo.py | 2 +- utilities/generate_plots.py | 2 +- utilities/literalise.py | 2 +- utilities/mock_for_colour.py | 2 +- utilities/unicode_to_ascii.py | 2 +- 284 files changed, 3830 insertions(+), 3222 deletions(-) diff --git a/colour/__init__.py b/colour/__init__.py index fe7258a02..ca0f660e9 100644 --- a/colour/__init__.py +++ b/colour/__init__.py @@ -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) diff --git a/colour/adaptation/tests/test__init__.py b/colour/adaptation/tests/test__init__.py index 3913219ad..22018f9aa 100644 --- a/colour/adaptation/tests/test__init__.py +++ b/colour/adaptation/tests/test__init__.py @@ -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 @@ -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]) @@ -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. diff --git a/colour/adaptation/tests/test_cie1994.py b/colour/adaptation/tests/test_cie1994.py index bbb96a54c..7d6841196 100644 --- a/colour/adaptation/tests/test_cie1994.py +++ b/colour/adaptation/tests/test_cie1994.py @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/colour/adaptation/tests/test_cmccat2000.py b/colour/adaptation/tests/test_cmccat2000.py index 4e9c809f7..dfb99102d 100644 --- a/colour/adaptation/tests/test_cmccat2000.py +++ b/colour/adaptation/tests/test_cmccat2000.py @@ -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 @@ -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. @@ -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 @@ -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 @@ -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. @@ -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. @@ -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 @@ -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 @@ -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. diff --git a/colour/adaptation/tests/test_fairchild1990.py b/colour/adaptation/tests/test_fairchild1990.py index d7fbb5b47..d6bab70aa 100644 --- a/colour/adaptation/tests/test_fairchild1990.py +++ b/colour/adaptation/tests/test_fairchild1990.py @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/colour/adaptation/tests/test_fairchild2020.py b/colour/adaptation/tests/test_fairchild2020.py index 982706242..399b9d94d 100644 --- a/colour/adaptation/tests/test_fairchild2020.py +++ b/colour/adaptation/tests/test_fairchild2020.py @@ -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 @@ -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. @@ -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. @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/colour/adaptation/tests/test_vonkries.py b/colour/adaptation/tests/test_vonkries.py index a5b0bc55e..d856fca39 100644 --- a/colour/adaptation/tests/test_vonkries.py +++ b/colour/adaptation/tests/test_vonkries.py @@ -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 @@ -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. @@ -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. @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/colour/adaptation/tests/test_zhai2018.py b/colour/adaptation/tests/test_zhai2018.py index ad42fdfdf..6bbc87fbb 100644 --- a/colour/adaptation/tests/test_zhai2018.py +++ b/colour/adaptation/tests/test_zhai2018.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.adaptation.zhai2018` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -26,7 +28,7 @@ class TestChromaticAdaptationZhai2018: definition unit tests methods. """ - def test_chromatic_adaptation_Zhai2018(self): + def test_chromatic_adaptation_Zhai2018(self) -> None: """ Test :func:`colour.adaptation.zhai2018.chromatic_adaptation_Zhai2018` definition. @@ -96,7 +98,7 @@ def test_chromatic_adaptation_Zhai2018(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_chromatic_adaptation_Zhai2018(self): + def test_n_dimensional_chromatic_adaptation_Zhai2018(self) -> None: """ Test :func:`colour.adaptation.zhai2018.chromatic_adaptation_Zhai2018` definition n-dimensional arrays support. @@ -139,7 +141,7 @@ def test_n_dimensional_chromatic_adaptation_Zhai2018(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_chromatic_adaptation_Zhai2018(self): + def test_domain_range_scale_chromatic_adaptation_Zhai2018(self) -> None: """ Test :func:`colour.adaptation.zhai2018.chromatic_adaptation_Zhai2018` definition domain and range scale support. @@ -162,7 +164,7 @@ def test_domain_range_scale_chromatic_adaptation_Zhai2018(self): ) @ignore_numpy_errors - def test_nan_chromatic_adaptation_Zhai2018(self): + def test_nan_chromatic_adaptation_Zhai2018(self) -> None: """ Test :func:`colour.adaptation.zhai2018.chromatic_adaptation_Zhai2018` definition nan support. diff --git a/colour/algebra/__init__.py b/colour/algebra/__init__.py index e5c0d248a..06b9b3408 100644 --- a/colour/algebra/__init__.py +++ b/colour/algebra/__init__.py @@ -114,7 +114,7 @@ class algebra(ModuleAPI): """Define a class acting like the *algebra* 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) diff --git a/colour/algebra/common.py b/colour/algebra/common.py index 44da82652..333753128 100644 --- a/colour/algebra/common.py +++ b/colour/algebra/common.py @@ -122,7 +122,7 @@ def set_sdiv_mode( ] | str ), -): +) -> None: """ Set *Colour* safe division function mode. @@ -212,7 +212,7 @@ def __enter__(self) -> sdiv_mode: return self - def __exit__(self, *args: Any): + def __exit__(self, *args: Any) -> None: """ Set the *Colour* safe division function mode upon exiting the context manager. @@ -371,7 +371,7 @@ def is_spow_enabled() -> bool: return _SPOW_ENABLED -def set_spow_enable(enable: bool): +def set_spow_enable(enable: bool) -> None: """ Set *Colour* safe / symmetrical power function enabled state. @@ -421,7 +421,7 @@ def __enter__(self) -> spow_enable: return self - def __exit__(self, *args: Any): + def __exit__(self, *args: Any) -> None: """ Set the *Colour* safe / symmetrical power function enabled state upon exiting the context manager. diff --git a/colour/algebra/coordinates/tests/test_transformations.py b/colour/algebra/coordinates/tests/test_transformations.py index 6595ff4ae..e5b752aa6 100644 --- a/colour/algebra/coordinates/tests/test_transformations.py +++ b/colour/algebra/coordinates/tests/test_transformations.py @@ -3,6 +3,8 @@ :mod:`colour.algebra.coordinates.transformations` module. """ +from __future__ import annotations + from itertools import product import numpy as np @@ -41,7 +43,7 @@ class TestCartesianToSpherical: cartesian_to_spherical` definition unit tests methods. """ - def test_cartesian_to_spherical(self): + def test_cartesian_to_spherical(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_spherical` definition. @@ -65,7 +67,7 @@ def test_cartesian_to_spherical(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_cartesian_to_spherical(self): + def test_n_dimensional_cartesian_to_spherical(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_spherical` definition n-dimensional arrays support. @@ -87,7 +89,7 @@ def test_n_dimensional_cartesian_to_spherical(self): ) @ignore_numpy_errors - def test_nan_cartesian_to_spherical(self): + def test_nan_cartesian_to_spherical(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_spherical` definition nan support. @@ -104,7 +106,7 @@ class TestSphericalToCartesian: spherical_to_cartesian` definition unit tests methods. """ - def test_spherical_to_cartesian(self): + def test_spherical_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ spherical_to_cartesian` definition. @@ -128,7 +130,7 @@ def test_spherical_to_cartesian(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_spherical_to_cartesian(self): + def test_n_dimensional_spherical_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ spherical_to_cartesian` definition n-dimensional arrays support. @@ -150,7 +152,7 @@ def test_n_dimensional_spherical_to_cartesian(self): ) @ignore_numpy_errors - def test_nan_spherical_to_cartesian(self): + def test_nan_spherical_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ spherical_to_cartesian` definition nan support. @@ -167,7 +169,7 @@ class TestCartesianToPolar: cartesian_to_polar` definition unit tests methods. """ - def test_cartesian_to_polar(self): + def test_cartesian_to_polar(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_polar` definition. @@ -191,7 +193,7 @@ def test_cartesian_to_polar(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_cartesian_to_polar(self): + def test_n_dimensional_cartesian_to_polar(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_polar` definition n-dimensional arrays support. @@ -213,7 +215,7 @@ def test_n_dimensional_cartesian_to_polar(self): ) @ignore_numpy_errors - def test_nan_cartesian_to_polar(self): + def test_nan_cartesian_to_polar(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_polar` definition nan support. @@ -230,7 +232,7 @@ class TestPolarToCartesian: polar_to_cartesian` definition unit tests methods. """ - def test_polar_to_cartesian(self): + def test_polar_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ polar_to_cartesian` definition. @@ -254,7 +256,7 @@ def test_polar_to_cartesian(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_polar_to_cartesian(self): + def test_n_dimensional_polar_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ polar_to_cartesian` definition n-dimensional arrays support. @@ -276,7 +278,7 @@ def test_n_dimensional_polar_to_cartesian(self): ) @ignore_numpy_errors - def test_nan_polar_to_cartesian(self): + def test_nan_polar_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ polar_to_cartesian` definition nan support. @@ -293,7 +295,7 @@ class TestCartesianToCylindrical: cartesian_to_cylindrical` definition unit tests methods. """ - def test_cartesian_to_cylindrical(self): + def test_cartesian_to_cylindrical(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_cylindrical` definition. @@ -317,7 +319,7 @@ def test_cartesian_to_cylindrical(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_cartesian_to_cylindrical(self): + def test_n_dimensional_cartesian_to_cylindrical(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_cylindrical` definition n-dimensional arrays support. @@ -339,7 +341,7 @@ def test_n_dimensional_cartesian_to_cylindrical(self): ) @ignore_numpy_errors - def test_nan_cartesian_to_cylindrical(self): + def test_nan_cartesian_to_cylindrical(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cartesian_to_cylindrical` definition nan support. @@ -356,7 +358,7 @@ class TestCylindricalToCartesian: cylindrical_to_cartesian` definition unit tests methods. """ - def test_cylindrical_to_cartesian(self): + def test_cylindrical_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cylindrical_to_cartesian` definition. @@ -380,7 +382,7 @@ def test_cylindrical_to_cartesian(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_cylindrical_to_cartesian(self): + def test_n_dimensional_cylindrical_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cylindrical_to_cartesian` definition n-dimensional arrays support. @@ -402,7 +404,7 @@ def test_n_dimensional_cylindrical_to_cartesian(self): ) @ignore_numpy_errors - def test_nan_cylindrical_to_cartesian(self): + def test_nan_cylindrical_to_cartesian(self) -> None: """ Test :func:`colour.algebra.coordinates.transformations.\ cylindrical_to_cartesian` definition nan support. diff --git a/colour/algebra/extrapolation.py b/colour/algebra/extrapolation.py index 271af7f9a..074d72e88 100644 --- a/colour/algebra/extrapolation.py +++ b/colour/algebra/extrapolation.py @@ -179,7 +179,7 @@ class instance. return self._interpolator @interpolator.setter - def interpolator(self, value: ProtocolInterpolator): + def interpolator(self, value: ProtocolInterpolator) -> None: """Setter for the **self.interpolator** property.""" attest( @@ -213,7 +213,7 @@ def method(self) -> Literal["Linear", "Constant"] | str: return self._method @method.setter - def method(self, value: Literal["Linear", "Constant"] | str): + def method(self, value: Literal["Linear", "Constant"] | str) -> None: """Setter for the **self.method** property.""" attest( @@ -244,7 +244,7 @@ def left(self) -> Real | None: return self._left @left.setter - def left(self, value: Real | None): + def left(self, value: Real | None) -> None: """Setter for the **self.left** property.""" if value is not None: @@ -274,7 +274,7 @@ def right(self) -> Real | None: return self._right @right.setter - def right(self, value: Real | None): + def right(self, value: Real | None) -> None: """Setter for the **self.right** property.""" if value is not None: diff --git a/colour/algebra/interpolation.py b/colour/algebra/interpolation.py index bb08f3251..7673ede5b 100644 --- a/colour/algebra/interpolation.py +++ b/colour/algebra/interpolation.py @@ -452,7 +452,7 @@ def x(self) -> NDArrayFloat: return self._x @x.setter - def x(self, value: ArrayLike): + def x(self, value: ArrayLike) -> None: """Setter for the **self.x** property.""" value = np.atleast_1d(value).astype(self._dtype) @@ -503,7 +503,7 @@ def y(self) -> NDArrayFloat: return self._y @y.setter - def y(self, value: ArrayLike): + def y(self, value: ArrayLike) -> None: """Setter for the **self.y** property.""" value = np.atleast_1d(value).astype(self._dtype) @@ -537,7 +537,7 @@ def window(self) -> float: return self._window @window.setter - def window(self, value: float): + def window(self, value: float) -> None: """Setter for the **self.window** property.""" attest(bool(value >= 1), '"window" must be equal to or greater than 1!') @@ -571,7 +571,7 @@ def kernel(self) -> Callable: return self._kernel @kernel.setter - def kernel(self, value: Callable): + def kernel(self, value: Callable) -> None: """Setter for the **self.kernel** property.""" attest( @@ -600,7 +600,7 @@ def kernel_kwargs(self) -> dict: return self._kernel_kwargs @kernel_kwargs.setter - def kernel_kwargs(self, value: dict): + def kernel_kwargs(self, value: dict) -> None: """Setter for the **self.kernel_kwargs** property.""" attest( @@ -629,7 +629,7 @@ def padding_kwargs(self) -> dict: return self._padding_kwargs @padding_kwargs.setter - def padding_kwargs(self, value: dict): + def padding_kwargs(self, value: dict) -> None: """Setter for the **self.padding_kwargs** property.""" attest( @@ -700,7 +700,7 @@ def _evaluate(self, x: NDArrayFloat) -> NDArrayFloat: axis=-1, ) - def _validate_dimensions(self): + def _validate_dimensions(self) -> None: """Validate that the variables dimensions are the same.""" if len(self._x) != len(self._y): @@ -709,7 +709,7 @@ def _validate_dimensions(self): f'dimensions: "{len(self._x)}", "{len(self._y)}"' ) - def _validate_interpolation_range(self, x: NDArrayFloat): + def _validate_interpolation_range(self, x: NDArrayFloat) -> None: """Validate given point to be in interpolation range.""" below_interpolation_range = x < self._x[0] @@ -838,7 +838,7 @@ def x(self) -> NDArrayFloat: return self._x @x.setter - def x(self, value: ArrayLike): + def x(self, value: ArrayLike) -> None: """Setter for the **self.x** property.""" value = cast(NDArrayFloat, np.atleast_1d(value).astype(self._dtype)) @@ -871,7 +871,7 @@ def y(self) -> NDArrayFloat: return self._y @y.setter - def y(self, value: ArrayLike): + def y(self, value: ArrayLike) -> None: """Setter for the **self.y** property.""" value = cast(NDArrayFloat, np.atleast_1d(value).astype(self._dtype)) @@ -925,7 +925,7 @@ def _evaluate(self, x: NDArrayFloat) -> NDArrayFloat: return np.interp(x, self._x, self._y) - def _validate_dimensions(self): + def _validate_dimensions(self) -> None: """Validate that the variables dimensions are the same.""" if len(self._x) != len(self._y): @@ -934,7 +934,7 @@ def _validate_dimensions(self): f'dimensions: "{len(self._x)}", "{len(self._y)}"' ) - def _validate_interpolation_range(self, x: NDArrayFloat): + def _validate_interpolation_range(self, x: NDArrayFloat) -> None: """Validate given point to be in interpolation range.""" below_interpolation_range = x < self._x[0] @@ -1061,7 +1061,7 @@ def x(self) -> NDArrayFloat: return self._x @x.setter - def x(self, value: ArrayLike): + def x(self, value: ArrayLike) -> None: """Setter for the **self.x** property.""" value = as_array(np.atleast_1d(value), self._dtype) @@ -1109,7 +1109,7 @@ def y(self) -> NDArrayFloat: return self._y @y.setter - def y(self, value: ArrayLike): + def y(self, value: ArrayLike) -> None: """Setter for the **self.y** property.""" value = as_array(np.atleast_1d(value), self._dtype) @@ -1209,7 +1209,7 @@ def _evaluate(self, x: NDArrayFloat) -> NDArrayFloat: return y[0] return y - def _validate_dimensions(self): + def _validate_dimensions(self) -> None: """Validate that the variables dimensions are the same.""" if len(self._x) != len(self._y): @@ -1218,7 +1218,7 @@ def _validate_dimensions(self): f'dimensions: "{len(self._x)}", "{len(self._y)}"' ) - def _validate_interpolation_range(self, x: NDArrayFloat): + def _validate_interpolation_range(self, x: NDArrayFloat) -> None: """Validate given point to be in interpolation range.""" below_interpolation_range = x < self._x[0] @@ -1294,7 +1294,7 @@ def y(self) -> NDArrayFloat: return self._y @y.setter - def y(self, value: ArrayLike): + def y(self, value: ArrayLike) -> None: """Setter for the **self.y** property.""" self._y = as_float_array(value) @@ -1397,7 +1397,7 @@ def x(self) -> NDArrayFloat: return self._x @x.setter - def x(self, value: ArrayLike): + def x(self, value: ArrayLike) -> None: """Setter for the **self.x** property.""" value = cast(NDArrayFloat, np.atleast_1d(value).astype(self._dtype)) @@ -1430,7 +1430,7 @@ def y(self) -> NDArrayFloat: return self._y @y.setter - def y(self, value: ArrayLike): + def y(self, value: ArrayLike) -> None: """Setter for the **self.y** property.""" value = cast(NDArrayFloat, np.atleast_1d(value).astype(self._dtype)) @@ -1461,7 +1461,7 @@ def relative_tolerance(self) -> float: return self._relative_tolerance @relative_tolerance.setter - def relative_tolerance(self, value: float): + def relative_tolerance(self, value: float) -> None: """Setter for the **self.relative_tolerance** property.""" attest( @@ -1490,7 +1490,7 @@ def absolute_tolerance(self) -> float: return self._absolute_tolerance @absolute_tolerance.setter - def absolute_tolerance(self, value: float): + def absolute_tolerance(self, value: float) -> None: """Setter for the **self.absolute_tolerance** property.""" attest( @@ -1520,7 +1520,7 @@ def default(self) -> float: return self._default @default.setter - def default(self, value: float): + def default(self, value: float) -> None: """Setter for the **self.default** property.""" attest(is_numeric(value), '"default" variable must be a "numeric"!') @@ -1580,7 +1580,7 @@ def _evaluate(self, x: NDArrayFloat) -> NDArrayFloat: return np.squeeze(values) - def _validate_dimensions(self): + def _validate_dimensions(self) -> None: """Validate that the variables dimensions are the same.""" if len(self._x) != len(self._y): @@ -1589,7 +1589,7 @@ def _validate_dimensions(self): f'dimensions: "{len(self._x)}", "{len(self._y)}"' ) - def _validate_interpolation_range(self, x: NDArrayFloat): + def _validate_interpolation_range(self, x: NDArrayFloat) -> None: """Validate given point to be in interpolation range.""" below_interpolation_range = x < self._x[0] diff --git a/colour/algebra/tests/test_common.py b/colour/algebra/tests/test_common.py index 1a7845ef9..d897296e4 100644 --- a/colour/algebra/tests/test_common.py +++ b/colour/algebra/tests/test_common.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.algebra.common` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -63,7 +65,7 @@ class TestGetSdivMode: methods. """ - def test_get_sdiv_mode(self): + def test_get_sdiv_mode(self) -> None: """Test :func:`colour.algebra.common.get_sdiv_mode` definition.""" with sdiv_mode("Numpy"): @@ -97,7 +99,7 @@ class TestSetSdivMode: methods. """ - def test_set_sdiv_mode(self): + def test_set_sdiv_mode(self) -> None: """Test :func:`colour.algebra.common.set_sdiv_mode` definition.""" with sdiv_mode(get_sdiv_mode()): @@ -132,7 +134,7 @@ class TestSdivMode: tests methods. """ - def test_sdiv_mode(self): + def test_sdiv_mode(self) -> None: """Test :func:`colour.algebra.common.sdiv_mode` definition.""" with sdiv_mode("Raise"): @@ -142,7 +144,7 @@ def test_sdiv_mode(self): assert get_sdiv_mode() == "ignore zero conversion" @sdiv_mode("Raise") - def fn_a(): + def fn_a() -> None: """:func:`sdiv_mode` unit tests :func:`fn_a` definition.""" assert get_sdiv_mode() == "raise" @@ -150,7 +152,7 @@ def fn_a(): fn_a() @sdiv_mode("Ignore Zero Conversion") - def fn_b(): + def fn_b() -> None: """:func:`sdiv_mode` unit tests :func:`fn_b` definition.""" assert get_sdiv_mode() == "ignore zero conversion" @@ -164,7 +166,7 @@ class TestSdiv: tests methods. """ - def test_sdiv(self): + def test_sdiv(self) -> None: """Test :func:`colour.algebra.common.sdiv` definition.""" a = np.array([0, 1, 2]) @@ -204,7 +206,7 @@ class TestIsSpowEnabled: tests methods. """ - def test_is_spow_enabled(self): + def test_is_spow_enabled(self) -> None: """Test :func:`colour.algebra.common.is_spow_enabled` definition.""" with spow_enable(True): @@ -220,7 +222,7 @@ class TestSetSpowEnabled: tests methods. """ - def test_set_spow_enable(self): + def test_set_spow_enable(self) -> None: """Test :func:`colour.algebra.common.set_spow_enable` definition.""" with spow_enable(is_spow_enabled()): @@ -238,7 +240,7 @@ class TestSpowEnable: tests methods. """ - def test_spow_enable(self): + def test_spow_enable(self) -> None: """Test :func:`colour.algebra.common.spow_enable` definition.""" with spow_enable(True): @@ -248,7 +250,7 @@ def test_spow_enable(self): assert not is_spow_enabled() @spow_enable(True) - def fn_a(): + def fn_a() -> None: """:func:`spow_enable` unit tests :func:`fn_a` definition.""" assert is_spow_enabled() @@ -256,7 +258,7 @@ def fn_a(): fn_a() @spow_enable(False) - def fn_b(): + def fn_b() -> None: """:func:`spow_enable` unit tests :func:`fn_b` definition.""" assert not is_spow_enabled() @@ -270,7 +272,7 @@ class TestSpow: tests methods. """ - def test_spow(self): + def test_spow(self) -> None: """Test :func:`colour.algebra.common.spow` definition.""" assert spow(2, 2) == 4.0 @@ -298,7 +300,7 @@ class TestNormaliseVector: tests methods. """ - def test_normalise_vector(self): + def test_normalise_vector(self) -> None: """Test :func:`colour.algebra.common.normalise_vector` definition.""" np.testing.assert_allclose( @@ -326,7 +328,7 @@ class TestNormaliseMaximum: tests methods. """ - def test_normalise_maximum(self): + def test_normalise_maximum(self) -> None: """Test :func:`colour.algebra.common.normalise_maximum` definition.""" np.testing.assert_allclose( @@ -405,7 +407,7 @@ class TestVectorDot: methods. """ - def test_vecmul(self): + def test_vecmul(self) -> None: """Test :func:`colour.algebra.common.vecmul` definition.""" m = np.array( @@ -442,7 +444,7 @@ class TestEuclideanDistance: tests methods. """ - def test_euclidean_distance(self): + def test_euclidean_distance(self) -> None: """Test :func:`colour.algebra.common.euclidean_distance` definition.""" np.testing.assert_allclose( @@ -472,7 +474,7 @@ def test_euclidean_distance(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_euclidean_distance(self): + def test_n_dimensional_euclidean_distance(self) -> None: """ Test :func:`colour.algebra.common.euclidean_distance` definition n-dimensional arrays support. @@ -497,7 +499,7 @@ def test_n_dimensional_euclidean_distance(self): ) @ignore_numpy_errors - def test_nan_euclidean_distance(self): + def test_nan_euclidean_distance(self) -> None: """ Test :func:`colour.algebra.common.euclidean_distance` definition nan support. @@ -514,7 +516,7 @@ class TestManhattanDistance: tests methods. """ - def test_manhattan_distance(self): + def test_manhattan_distance(self) -> None: """Test :func:`colour.algebra.common.manhattan_distance` definition.""" np.testing.assert_allclose( @@ -544,7 +546,7 @@ def test_manhattan_distance(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_manhattan_distance(self): + def test_n_dimensional_manhattan_distance(self) -> None: """ Test :func:`colour.algebra.common.manhattan_distance` definition n-dimensional arrays support. @@ -569,7 +571,7 @@ def test_n_dimensional_manhattan_distance(self): ) @ignore_numpy_errors - def test_nan_manhattan_distance(self): + def test_nan_manhattan_distance(self) -> None: """ Test :func:`colour.algebra.common.manhattan_distance` definition nan support. @@ -586,7 +588,7 @@ class TestLinearConversion: tests methods. """ - def test_linear_conversion(self): + def test_linear_conversion(self) -> None: """Test :func:`colour.algebra.common.linear_conversion` definition.""" np.testing.assert_allclose( @@ -617,7 +619,7 @@ class TestLinstepFunction: tests methods. """ - def test_linstep_function(self): + def test_linstep_function(self) -> None: """Test :func:`colour.algebra.common.linstep_function` definition.""" np.testing.assert_allclose( @@ -674,7 +676,7 @@ class TestSmoothstepFunction: tests methods. """ - def test_smoothstep_function(self): + def test_smoothstep_function(self) -> None: """Test :func:`colour.algebra.common.smoothstep_function` definition.""" assert smoothstep_function(0.5) == 0.5 @@ -700,7 +702,7 @@ class TestIsIdentity: methods. """ - def test_is_identity(self): + def test_is_identity(self) -> None: """Test :func:`colour.algebra.common.is_identity` definition.""" assert is_identity(np.reshape(np.array([1, 0, 0, 0, 1, 0, 0, 0, 1]), (3, 3))) @@ -720,7 +722,7 @@ class TestEigenDecomposition: tests methods. """ - def test_is_identity(self): + def test_is_identity(self) -> None: """Test :func:`colour.algebra.common.eigen_decomposition` definition.""" a = np.diag([1, 2, 3]) diff --git a/colour/algebra/tests/test_extrapolation.py b/colour/algebra/tests/test_extrapolation.py index a6affe869..16f1d066a 100644 --- a/colour/algebra/tests/test_extrapolation.py +++ b/colour/algebra/tests/test_extrapolation.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.algebra.extrapolation` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -31,7 +33,7 @@ class TestExtrapolator: tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("interpolator",) @@ -39,7 +41,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(Extrapolator) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__",) @@ -47,7 +49,7 @@ def test_required_methods(self): for method in required_methods: # pragma: no cover assert method in dir(Extrapolator) - def test_interpolator(self): + def test_interpolator(self) -> None: """ Test :attr:`colour.algebra.extrapolation.Extrapolator.interpolator` property. @@ -58,7 +60,7 @@ def test_interpolator(self): ) assert isinstance(extrapolator.interpolator, LinearInterpolator) - def test_method(self): + def test_method(self) -> None: """ Test :attr:`colour.algebra.extrapolation.Extrapolator.method` property. @@ -75,7 +77,7 @@ def test_method(self): ) assert extrapolator.method == "constant" - def test_left(self): + def test_left(self) -> None: """ Test :attr:`colour.algebra.extrapolation.Extrapolator.left` property. @@ -87,7 +89,7 @@ def test_left(self): ) assert extrapolator.left == 0 - def test_right(self): + def test_right(self) -> None: """ Test :attr:`colour.algebra.extrapolation.Extrapolator.right` property. @@ -99,7 +101,7 @@ def test_right(self): ) assert extrapolator.right == 0 - def test__call__(self): + def test__call__(self) -> None: """ Test :meth:`colour.algebra.extrapolation.Extrapolator.__call__` method. @@ -155,7 +157,7 @@ def test__call__(self): assert extrapolator(9) == 7.0 @ignore_numpy_errors - def test_nan__call__(self): + def test_nan__call__(self) -> None: """ Test :method:`colour.algebra.extrapolation.Extrapolator.__call__` method nan support. diff --git a/colour/algebra/tests/test_interpolation.py b/colour/algebra/tests/test_interpolation.py index de0106389..7daf863df 100644 --- a/colour/algebra/tests/test_interpolation.py +++ b/colour/algebra/tests/test_interpolation.py @@ -506,7 +506,7 @@ class TestKernelNearestNeighbour: definition unit tests methods. """ - def test_kernel_nearest(self): + def test_kernel_nearest(self) -> None: """ Test :func:`colour.algebra.interpolation.kernel_nearest_neighbour` definition. @@ -553,7 +553,7 @@ class TestKernelLinear: unit tests methods. """ - def test_kernel_linear(self): + def test_kernel_linear(self) -> None: """Test :func:`colour.algebra.interpolation.kernel_linear` definition.""" np.testing.assert_allclose( @@ -597,7 +597,7 @@ class TestKernelSinc: unit tests methods. """ - def test_kernel_sinc(self): + def test_kernel_sinc(self) -> None: """Test :func:`colour.algebra.interpolation.kernel_sinc` definition.""" np.testing.assert_allclose( @@ -675,7 +675,7 @@ class TestKernelLanczos: unit tests methods. """ - def test_kernel_lanczos(self): + def test_kernel_lanczos(self) -> None: """Test :func:`colour.algebra.interpolation.kernel_lanczos` definition.""" np.testing.assert_allclose( @@ -753,7 +753,7 @@ class TestKernelCardinalSpline: definition unit tests methods. """ - def test_kernel_cardinal_spline(self): + def test_kernel_cardinal_spline(self) -> None: """ Test :func:`colour.algebra.interpolation.kernel_cardinal_spline` definition. @@ -834,7 +834,7 @@ class TestKernelInterpolator: tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -849,7 +849,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(KernelInterpolator) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__", "__call__") @@ -857,7 +857,7 @@ def test_required_methods(self): for method in required_methods: # pragma: no cover assert method in dir(KernelInterpolator) - def test_x(self): + def test_x(self) -> None: """ Test :attr:`colour.algebra.interpolation.KernelInterpolator.x` property. @@ -868,7 +868,7 @@ def test_x(self): np.testing.assert_equal(kernel_interpolator.x, x) - def test_y(self): + def test_y(self) -> None: """ Test :attr:`colour.algebra.interpolation.KernelInterpolator.y` property. @@ -879,7 +879,7 @@ def test_y(self): np.testing.assert_equal(kernel_interpolator.y, y) - def test_window(self): + def test_window(self) -> None: """ Test :attr:`colour.algebra.interpolation.KernelInterpolator.window` property. @@ -890,7 +890,7 @@ def test_window(self): assert kernel_interpolator.window == 3 - def test_kernel(self): + def test_kernel(self) -> None: """ Test :attr:`colour.algebra.interpolation.KernelInterpolator.kernel` property. @@ -901,7 +901,7 @@ def test_kernel(self): assert kernel_interpolator.kernel is kernel_linear - def test_kernel_kwargs(self): + def test_kernel_kwargs(self) -> None: """ Test :attr:`colour.algebra.interpolation.KernelInterpolator.\ kernel_kwargs` property. @@ -913,7 +913,7 @@ def test_kernel_kwargs(self): assert kernel_interpolator.kernel_kwargs == kernel_kwargs - def test_padding_kwargs(self): + def test_padding_kwargs(self) -> None: """ Test :attr:`colour.algebra.interpolation.KernelInterpolator.\ padding_kwargs` property. @@ -925,7 +925,7 @@ def test_padding_kwargs(self): assert kernel_interpolator.padding_kwargs == padding_kwargs - def test_raise_exception___init__(self): + def test_raise_exception___init__(self) -> None: """ Test :meth:`colour.algebra.interpolation.KernelInterpolator.__init__` method raised exception. @@ -938,7 +938,7 @@ def test_raise_exception___init__(self): np.linspace(0, 1, 15), ) - def test__call__(self): + def test__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.KernelInterpolator.__call__` method. @@ -1143,7 +1143,7 @@ def test__call__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception___call__(self): + def test_raise_exception___call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.KernelInterpolator.__call__` method raised exception. @@ -1157,7 +1157,7 @@ def test_raise_exception___call__(self): pytest.raises(ValueError, kernel_interpolator, 11) @ignore_numpy_errors - def test_nan__call__(self): + def test_nan__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.KernelInterpolator.__call__` method nan support. @@ -1175,7 +1175,7 @@ class TestNearestNeighbourInterpolator: class unit tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = () @@ -1183,7 +1183,7 @@ def test_required_attributes(self): for attribute in required_attributes: # pragma: no cover assert attribute in dir(NearestNeighbourInterpolator) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__",) @@ -1191,7 +1191,7 @@ def test_required_methods(self): for method in required_methods: # pragma: no cover assert method in dir(NearestNeighbourInterpolator) - def test___init__(self): + def test___init__(self) -> None: """ Test :meth:`colour.algebra.interpolation.KernelInterpolator.__init__` method. @@ -1211,7 +1211,7 @@ class TestLinearInterpolator: tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("x", "y") @@ -1219,7 +1219,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(LinearInterpolator) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__", "__call__") @@ -1227,7 +1227,7 @@ def test_required_methods(self): for method in required_methods: # pragma: no cover assert method in dir(LinearInterpolator) - def test_raise_exception___init__(self): + def test_raise_exception___init__(self) -> None: """ Test :meth:`colour.algebra.interpolation.LinearInterpolator.__init__` method raised exception. @@ -1236,7 +1236,7 @@ def test_raise_exception___init__(self): x, y = np.linspace(0, 1, 10), np.linspace(0, 1, 15) pytest.raises(ValueError, LinearInterpolator, x, y) - def test__call__(self): + def test__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.LinearInterpolator.__call__` method. @@ -1263,7 +1263,7 @@ def test__call__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception___call__(self): + def test_raise_exception___call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.LinearInterpolator.__call__` method raised exception. @@ -1277,7 +1277,7 @@ def test_raise_exception___call__(self): pytest.raises(ValueError, linear_interpolator, 11) @ignore_numpy_errors - def test_nan__call__(self): + def test_nan__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.LinearInterpolator.__call__` method nan support. @@ -1299,7 +1299,7 @@ class TestSpragueInterpolator: unit tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("x", "y") @@ -1307,7 +1307,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(SpragueInterpolator) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__", "__call__") @@ -1315,7 +1315,7 @@ def test_required_methods(self): for method in required_methods: # pragma: no cover assert method in dir(SpragueInterpolator) - def test_raise_exception___init__(self): + def test_raise_exception___init__(self) -> None: """ Test :meth:`colour.algebra.interpolation.SpragueInterpolator.__init__` method raised exception. @@ -1324,7 +1324,7 @@ def test_raise_exception___init__(self): x, y = np.linspace(0, 1, 10), np.linspace(0, 1, 15) pytest.raises(ValueError, SpragueInterpolator, x, y) - def test__call__(self): + def test__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.SpragueInterpolator.__call__` method. @@ -1351,7 +1351,7 @@ def test__call__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception___call__(self): + def test_raise_exception___call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.SpragueInterpolator.__call__` method raised exception. @@ -1365,7 +1365,7 @@ def test_raise_exception___call__(self): pytest.raises(ValueError, sprague_interpolator, 11) @ignore_numpy_errors - def test_nan__call__(self): + def test_nan__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.SpragueInterpolator.__call__` method nan support. @@ -1387,7 +1387,7 @@ class TestCubicSplineInterpolator: unit tests methods. """ - def test__call__(self): + def test__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.CubicSplineInterpolator.\ __call__` method. @@ -1413,7 +1413,7 @@ class TestPchipInterpolator: unit tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("x", "y") @@ -1421,7 +1421,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(PchipInterpolator) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__",) @@ -1429,7 +1429,7 @@ def test_required_methods(self): for method in required_methods: # pragma: no cover assert method in dir(PchipInterpolator) - def test_y(self): + def test_y(self) -> None: """ Test :attr:`colour.algebra.interpolation.PchipInterpolator.y` property. """ @@ -1447,7 +1447,7 @@ class TestNullInterpolator: unit tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("x", "y") @@ -1455,7 +1455,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(NullInterpolator) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__", "__call__") @@ -1463,7 +1463,7 @@ def test_required_methods(self): for method in required_methods: # pragma: no cover assert method in dir(NullInterpolator) - def test_x(self): + def test_x(self) -> None: """ Test :attr:`colour.algebra.interpolation.NullInterpolator.x` property. @@ -1474,7 +1474,7 @@ def test_x(self): np.testing.assert_equal(null_interpolator.x, x) - def test_y(self): + def test_y(self) -> None: """ Test :attr:`colour.algebra.interpolation.NullInterpolator.y` property. @@ -1485,7 +1485,7 @@ def test_y(self): np.testing.assert_equal(null_interpolator.y, y) - def test_absolute_tolerance(self): + def test_absolute_tolerance(self) -> None: """ Test :attr:`colour.algebra.interpolation.NullInterpolator.\ absolute_tolerance` property. @@ -1496,7 +1496,7 @@ def test_absolute_tolerance(self): np.testing.assert_equal(null_interpolator.absolute_tolerance, 0.1) - def test_relative_tolerance(self): + def test_relative_tolerance(self) -> None: """ Test :attr:`colour.algebra.interpolation.NullInterpolator.\ relative_tolerance` property. @@ -1507,7 +1507,7 @@ def test_relative_tolerance(self): np.testing.assert_equal(null_interpolator.relative_tolerance, 0.1) - def test_default(self): + def test_default(self) -> None: """ Test :attr:`colour.algebra.interpolation.NullInterpolator.\ default` property. @@ -1518,7 +1518,7 @@ def test_default(self): np.testing.assert_equal(null_interpolator.default, 0) - def test_raise_exception___init__(self): + def test_raise_exception___init__(self) -> None: """ Test :meth:`colour.algebra.interpolation.NullInterpolator.__init__` method raised exception. @@ -1527,7 +1527,7 @@ def test_raise_exception___init__(self): x, y = np.linspace(0, 1, 10), np.linspace(0, 1, 15) pytest.raises(ValueError, NullInterpolator, x, y) - def test__call__(self): + def test__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.NullInterpolator.__call__` method. @@ -1548,7 +1548,7 @@ def test__call__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception___call__(self): + def test_raise_exception___call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.NullInterpolator.__call__` method raised exception. @@ -1562,7 +1562,7 @@ def test_raise_exception___call__(self): pytest.raises(ValueError, null_interpolator, 11) @ignore_numpy_errors - def test_nan__call__(self): + def test_nan__call__(self) -> None: """ Test :meth:`colour.algebra.interpolation.NullInterpolator.__call__` method nan support. @@ -1584,7 +1584,7 @@ class TestLagrangeCoefficients: definition unit tests methods. """ - def test_lagrange_coefficients(self): + def test_lagrange_coefficients(self) -> None: """ Test :func:`colour.algebra.interpolation.lagrange_coefficients` definition. @@ -1616,7 +1616,7 @@ class TestVerticesAndRelativeCoordinates: vertices_and_relative_coordinates` definition unit tests methods. """ - def test_vertices_and_relative_coordinates(self): + def test_vertices_and_relative_coordinates(self) -> None: """ Test :func:`colour.algebra.interpolation.\ vertices_and_relative_coordinates` definition. @@ -1704,7 +1704,7 @@ class TestTableInterpolationTrilinear: table_interpolation_trilinear` definition unit tests methods. """ - def test_interpolation_trilinear(self): + def test_interpolation_trilinear(self) -> None: """ Test :func:`colour.algebra.interpolation.\ table_interpolation_trilinear` definition. @@ -1746,7 +1746,7 @@ class TestTableInterpolationTetrahedral: table_interpolation_tetrahedral` definition unit tests methods. """ - def test_interpolation_tetrahedral(self): + def test_interpolation_tetrahedral(self) -> None: """ Test :func:`colour.algebra.interpolation.\ table_interpolation_tetrahedral` definition. diff --git a/colour/algebra/tests/test_prng.py b/colour/algebra/tests/test_prng.py index 1245218e5..86e98dbec 100644 --- a/colour/algebra/tests/test_prng.py +++ b/colour/algebra/tests/test_prng.py @@ -52,7 +52,7 @@ class TestRandomTripletGenerator: unit tests methods. """ - def test_random_triplet_generator(self): + def test_random_triplet_generator(self) -> None: """ Test :func:`colour.algebra.prng.random_triplet_generator` definition. diff --git a/colour/algebra/tests/test_regression.py b/colour/algebra/tests/test_regression.py index cbe2b7706..e9732aa03 100644 --- a/colour/algebra/tests/test_regression.py +++ b/colour/algebra/tests/test_regression.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.algebra.regression` module.""" +from __future__ import annotations + import numpy as np from colour.algebra import least_square_mapping_MoorePenrose @@ -23,7 +25,7 @@ class TestLeastSquareMappingMoorePenrose: least_square_mapping_MoorePenrose` definition unit tests methods. """ - def test_least_square_mapping_MoorePenrose(self): + def test_least_square_mapping_MoorePenrose(self) -> None: """ Test :func:`colour.algebra.regression.\ least_square_mapping_MoorePenrose` definition. diff --git a/colour/appearance/hunt.py b/colour/appearance/hunt.py index 627cc6ae8..cf85d0a02 100644 --- a/colour/appearance/hunt.py +++ b/colour/appearance/hunt.py @@ -105,7 +105,13 @@ class InductionFactors_Hunt( :cite:`Fairchild2013u`, :cite:`Hunt2004b` """ - def __new__(cls, N_c, N_b, N_cb=None, N_bb=None): + def __new__( + cls, + N_c: float, + N_b: float, + N_cb: float | None = None, + N_bb: float | None = None, + ) -> InductionFactors_Hunt: """ Return a new instance of the :class:`colour.appearance.InductionFactors_Hunt` class. @@ -655,8 +661,8 @@ def chromatic_adaptation( XYZ: ArrayLike, XYZ_w: ArrayLike, XYZ_b: ArrayLike, - L_A, - F_L, + L_A: ArrayLike, + F_L: ArrayLike, XYZ_p: ArrayLike | None = None, p: ArrayLike | None = None, helson_judd_effect: bool = False, diff --git a/colour/appearance/kim2009.py b/colour/appearance/kim2009.py index 8c296c342..5e4e4622b 100644 --- a/colour/appearance/kim2009.py +++ b/colour/appearance/kim2009.py @@ -130,7 +130,7 @@ class MediaParameters_Kim2009(namedtuple("MediaParameters_Kim2009", ("E",))): :cite:`Kim2009` """ - def __new__(cls, E): + def __new__(cls, E: float) -> MediaParameters_Kim2009: """ Return a new instance of the :class:`colour.appearance.MediaParameters_Kim2009` class. diff --git a/colour/appearance/tests/test_atd95.py b/colour/appearance/tests/test_atd95.py index 556194913..4286d3fec 100644 --- a/colour/appearance/tests/test_atd95.py +++ b/colour/appearance/tests/test_atd95.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.atd95` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -30,7 +32,7 @@ class TestXYZ_to_ATD95: tests methods. """ - def test_XYZ_to_ATD95(self): + def test_XYZ_to_ATD95(self) -> None: """ Test :func:`colour.appearance.atd95.XYZ_to_ATD95` definition. @@ -126,7 +128,7 @@ def test_XYZ_to_ATD95(self): atol=0.01, ) - def test_n_dimensional_XYZ_to_ATD95(self): + def test_n_dimensional_XYZ_to_ATD95(self) -> None: """ Test :func:`colour.appearance.atd95.XYZ_to_ATD95` definition n-dimensional support. @@ -165,7 +167,7 @@ def test_n_dimensional_XYZ_to_ATD95(self): ) @ignore_numpy_errors - def test_domain_range_scale_XYZ_to_ATD95(self): + def test_domain_range_scale_XYZ_to_ATD95(self) -> None: """ Test :func:`colour.appearance.atd95.XYZ_to_ATD95` definition domain and range scale support. @@ -192,7 +194,7 @@ def test_domain_range_scale_XYZ_to_ATD95(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_ATD95(self): + def test_nan_XYZ_to_ATD95(self) -> None: """ Test :func:`colour.appearance.atd95.XYZ_to_ATD95` definition nan support. diff --git a/colour/appearance/tests/test_cam16.py b/colour/appearance/tests/test_cam16.py index c256901ca..db71d8d6b 100644 --- a/colour/appearance/tests/test_cam16.py +++ b/colour/appearance/tests/test_cam16.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.cam16` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -39,7 +41,7 @@ class TestXYZ_to_CAM16: tests methods. """ - def test_XYZ_to_CAM16(self): + def test_XYZ_to_CAM16(self) -> None: """Test :func:`colour.appearance.cam16.XYZ_to_CAM16` definition.""" XYZ = np.array([19.01, 20.00, 21.78]) @@ -142,7 +144,7 @@ def test_XYZ_to_CAM16(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_CAM16(self): + def test_n_dimensional_XYZ_to_CAM16(self) -> None: """ Test :func:`colour.appearance.cam16.XYZ_to_CAM16` definition n-dimensional support. @@ -180,7 +182,7 @@ def test_n_dimensional_XYZ_to_CAM16(self): ) @ignore_numpy_errors - def test_domain_range_scale_XYZ_to_CAM16(self): + def test_domain_range_scale_XYZ_to_CAM16(self) -> None: """ Test :func:`colour.appearance.cam16.XYZ_to_CAM16` definition domain and range scale support. @@ -226,7 +228,7 @@ def test_domain_range_scale_XYZ_to_CAM16(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_CAM16(self): + def test_nan_XYZ_to_CAM16(self) -> None: """ Test :func:`colour.appearance.cam16.XYZ_to_CAM16` definition nan support. @@ -244,7 +246,7 @@ class TestCAM16_to_XYZ: methods. """ - def test_CAM16_to_XYZ(self): + def test_CAM16_to_XYZ(self) -> None: """Test :func:`colour.appearance.cam16.CAM16_to_XYZ` definition.""" specification = CAM_Specification_CAM16(41.73120791, 0.10335574, 217.06795977) @@ -292,7 +294,7 @@ def test_CAM16_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CAM16_to_XYZ(self): + def test_n_dimensional_CAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.cam16.CAM16_to_XYZ` definition n-dimensional support. @@ -307,7 +309,7 @@ def test_n_dimensional_CAM16_to_XYZ(self): XYZ = CAM16_to_XYZ(specification, XYZ_w, L_A, Y_b, surround) specification = CAM_Specification_CAM16( - *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() + *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() # pyright: ignore ) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_allclose( @@ -324,7 +326,7 @@ def test_n_dimensional_CAM16_to_XYZ(self): ) specification = CAM_Specification_CAM16( - *tsplit(np.reshape(specification, (2, 3, 8))).tolist() + *tsplit(np.reshape(specification, (2, 3, 8))).tolist() # pyright: ignore ) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) @@ -335,7 +337,7 @@ def test_n_dimensional_CAM16_to_XYZ(self): ) @ignore_numpy_errors - def test_domain_range_scale_CAM16_to_XYZ(self): + def test_domain_range_scale_CAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.cam16.CAM16_to_XYZ` definition domain and range scale support. @@ -388,7 +390,7 @@ def test_domain_range_scale_CAM16_to_XYZ(self): ) @ignore_numpy_errors - def test_raise_exception_CAM16_to_XYZ(self): + def test_raise_exception_CAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.cam16.CAM16_to_XYZ` definition raised exception. @@ -405,7 +407,7 @@ def test_raise_exception_CAM16_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_CAM16_to_XYZ(self): + def test_nan_CAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.cam16.CAM16_to_XYZ` definition nan support. diff --git a/colour/appearance/tests/test_ciecam02.py b/colour/appearance/tests/test_ciecam02.py index f128973ef..befee836a 100644 --- a/colour/appearance/tests/test_ciecam02.py +++ b/colour/appearance/tests/test_ciecam02.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.ciecam02` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -39,7 +41,7 @@ class TestXYZ_to_CIECAM02: tests methods. """ - def test_XYZ_to_CIECAM02(self): + def test_XYZ_to_CIECAM02(self) -> None: """ Test :func:`colour.appearance.ciecam02.XYZ_to_CIECAM02` definition. @@ -106,7 +108,7 @@ def test_XYZ_to_CIECAM02(self): atol=0.05, ) - def test_n_dimensional_XYZ_to_CIECAM02(self): + def test_n_dimensional_XYZ_to_CIECAM02(self) -> None: """ Test :func:`colour.appearance.ciecam02.XYZ_to_CIECAM02` definition n-dimensional support. @@ -144,7 +146,7 @@ def test_n_dimensional_XYZ_to_CIECAM02(self): ) @ignore_numpy_errors - def test_domain_range_scale_XYZ_to_CIECAM02(self): + def test_domain_range_scale_XYZ_to_CIECAM02(self) -> None: """ Test :func:`colour.appearance.ciecam02.XYZ_to_CIECAM02` definition domain and range scale support. @@ -192,7 +194,7 @@ def test_domain_range_scale_XYZ_to_CIECAM02(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_CIECAM02(self): + def test_nan_XYZ_to_CIECAM02(self) -> None: """ Test :func:`colour.appearance.ciecam02.XYZ_to_CIECAM02` definition nan support. @@ -210,7 +212,7 @@ class TestCIECAM02_to_XYZ: tests methods. """ - def test_CIECAM02_to_XYZ(self): + def test_CIECAM02_to_XYZ(self) -> None: """Test :func:`colour.appearance.ciecam02.CIECAM02_to_XYZ` definition.""" specification = CAM_Specification_CIECAM02( @@ -275,7 +277,7 @@ def test_CIECAM02_to_XYZ(self): atol=0.05, ) - def test_n_dimensional_CIECAM02_to_XYZ(self): + def test_n_dimensional_CIECAM02_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam02.CIECAM02_to_XYZ` definition n-dimensional support. @@ -290,7 +292,7 @@ def test_n_dimensional_CIECAM02_to_XYZ(self): XYZ = CIECAM02_to_XYZ(specification, XYZ_w, L_A, Y_b, surround) specification = CAM_Specification_CIECAM02( - *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() + *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() # pyright: ignore ) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_allclose( @@ -307,7 +309,7 @@ def test_n_dimensional_CIECAM02_to_XYZ(self): ) specification = CAM_Specification_CIECAM02( - *tsplit(np.reshape(specification, (2, 3, 8))).tolist() + *tsplit(np.reshape(specification, (2, 3, 8))).tolist() # pyright: ignore ) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) @@ -318,7 +320,7 @@ def test_n_dimensional_CIECAM02_to_XYZ(self): ) @ignore_numpy_errors - def test_domain_range_scale_CIECAM02_to_XYZ(self): + def test_domain_range_scale_CIECAM02_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam02.CIECAM02_to_XYZ` definition domain and range scale support. @@ -371,7 +373,7 @@ def test_domain_range_scale_CIECAM02_to_XYZ(self): ) @ignore_numpy_errors - def test_raise_exception_CIECAM02_to_XYZ(self): + def test_raise_exception_CIECAM02_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam02.CIECAM02_to_XYZ` definition raised exception. @@ -388,7 +390,7 @@ def test_raise_exception_CIECAM02_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_CIECAM02_to_XYZ(self): + def test_nan_CIECAM02_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam02.CIECAM02_to_XYZ` definition nan support. diff --git a/colour/appearance/tests/test_ciecam16.py b/colour/appearance/tests/test_ciecam16.py index da6d4ec10..21e95e161 100644 --- a/colour/appearance/tests/test_ciecam16.py +++ b/colour/appearance/tests/test_ciecam16.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.ciecam16` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -39,7 +41,7 @@ class TestXYZ_to_CIECAM16: tests methods. """ - def test_XYZ_to_CIECAM16(self): + def test_XYZ_to_CIECAM16(self) -> None: """ Test :func:`colour.appearance.ciecam16.XYZ_to_CIECAM16` definition. """ @@ -165,7 +167,7 @@ def test_XYZ_to_CIECAM16(self): atol=5e-5, ) - def test_n_dimensional_XYZ_to_CIECAM16(self): + def test_n_dimensional_XYZ_to_CIECAM16(self) -> None: """ Test :func:`colour.appearance.ciecam16.XYZ_to_CIECAM16` definition n-dimensional support. @@ -203,7 +205,7 @@ def test_n_dimensional_XYZ_to_CIECAM16(self): ) @ignore_numpy_errors - def test_domain_range_scale_XYZ_to_CIECAM16(self): + def test_domain_range_scale_XYZ_to_CIECAM16(self) -> None: """ Test :func:`colour.appearance.ciecam16.XYZ_to_CIECAM16` definition domain and range scale support. @@ -251,7 +253,7 @@ def test_domain_range_scale_XYZ_to_CIECAM16(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_CIECAM16(self): + def test_nan_XYZ_to_CIECAM16(self) -> None: """ Test :func:`colour.appearance.ciecam16.XYZ_to_CIECAM16` definition nan support. @@ -269,7 +271,7 @@ class TestCIECAM16_to_XYZ: tests methods. """ - def test_CIECAM16_to_XYZ(self): + def test_CIECAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam16.CIECAM16_to_XYZ` definition. """ @@ -339,7 +341,7 @@ def test_CIECAM16_to_XYZ(self): atol=1e-4, ) - def test_n_dimensional_CIECAM16_to_XYZ(self): + def test_n_dimensional_CIECAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam16.CIECAM16_to_XYZ` definition n-dimensional support. @@ -354,7 +356,7 @@ def test_n_dimensional_CIECAM16_to_XYZ(self): XYZ = CIECAM16_to_XYZ(specification, XYZ_w, L_A, Y_b, surround) specification = CAM_Specification_CIECAM16( - *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() + *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() # pyright: ignore ) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_allclose( @@ -371,7 +373,7 @@ def test_n_dimensional_CIECAM16_to_XYZ(self): ) specification = CAM_Specification_CIECAM16( - *tsplit(np.reshape(specification, (2, 3, 8))).tolist() + *tsplit(np.reshape(specification, (2, 3, 8))).tolist() # pyright: ignore ) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) @@ -382,7 +384,7 @@ def test_n_dimensional_CIECAM16_to_XYZ(self): ) @ignore_numpy_errors - def test_domain_range_scale_CIECAM16_to_XYZ(self): + def test_domain_range_scale_CIECAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam16.CIECAM16_to_XYZ` definition domain and range scale support. @@ -435,7 +437,7 @@ def test_domain_range_scale_CIECAM16_to_XYZ(self): ) @ignore_numpy_errors - def test_raise_exception_CIECAM16_to_XYZ(self): + def test_raise_exception_CIECAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam16.CIECAM16_to_XYZ` definition raised exception. @@ -452,7 +454,7 @@ def test_raise_exception_CIECAM16_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_CIECAM16_to_XYZ(self): + def test_nan_CIECAM16_to_XYZ(self) -> None: """ Test :func:`colour.appearance.ciecam16.CIECAM16_to_XYZ` definition nan support. diff --git a/colour/appearance/tests/test_hellwig2022.py b/colour/appearance/tests/test_hellwig2022.py index 730bab5fc..288d8237e 100644 --- a/colour/appearance/tests/test_hellwig2022.py +++ b/colour/appearance/tests/test_hellwig2022.py @@ -7,6 +7,8 @@ Discussion with Mansencal, T. """ +from __future__ import annotations + from itertools import product import numpy as np @@ -46,7 +48,7 @@ class TestXYZ_to_Hellwig2022: unit tests methods. """ - def test_XYZ_to_Hellwig2022(self): + def test_XYZ_to_Hellwig2022(self) -> None: """ Test :func:`colour.appearance.hellwig2022.XYZ_to_Hellwig2022` definition. @@ -141,7 +143,7 @@ def test_XYZ_to_Hellwig2022(self): atol=0.01, ) - def test_n_dimensional_XYZ_to_Hellwig2022(self): + def test_n_dimensional_XYZ_to_Hellwig2022(self) -> None: """ Test :func:`colour.appearance.hellwig2022.XYZ_to_Hellwig2022` definition n-dimensional support. @@ -179,7 +181,7 @@ def test_n_dimensional_XYZ_to_Hellwig2022(self): ) @ignore_numpy_errors - def test_domain_range_scale_XYZ_to_Hellwig2022(self): + def test_domain_range_scale_XYZ_to_Hellwig2022(self) -> None: """ Test :func:`colour.appearance.hellwig2022.XYZ_to_Hellwig2022` definition domain and range scale support. @@ -229,7 +231,7 @@ def test_domain_range_scale_XYZ_to_Hellwig2022(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Hellwig2022(self): + def test_nan_XYZ_to_Hellwig2022(self) -> None: """ Test :func:`colour.appearance.hellwig2022.XYZ_to_Hellwig2022 definition nan support. @@ -247,7 +249,7 @@ class TestHellwig2022_to_XYZ: unit tests methods. """ - def test_Hellwig2022_to_XYZ(self): + def test_Hellwig2022_to_XYZ(self) -> None: """ Test :func:`colour.appearance.hellwig2022.Hellwig2022_to_XYZ` definition. @@ -310,7 +312,7 @@ def test_Hellwig2022_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Hellwig2022_to_XYZ(self): + def test_n_dimensional_Hellwig2022_to_XYZ(self) -> None: """ Test :func:`colour.appearance.hellwig2022.Hellwig2022_to_XYZ` definition n-dimensional support. @@ -325,7 +327,7 @@ def test_n_dimensional_Hellwig2022_to_XYZ(self): XYZ = Hellwig2022_to_XYZ(specification, XYZ_w, L_A, Y_b, surround) specification = CAM_Specification_Hellwig2022( - *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() + *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() # pyright: ignore ) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_allclose( @@ -342,7 +344,7 @@ def test_n_dimensional_Hellwig2022_to_XYZ(self): ) specification = CAM_Specification_Hellwig2022( - *tsplit(np.reshape(specification, (2, 3, 10))).tolist() + *tsplit(np.reshape(specification, (2, 3, 10))).tolist() # pyright: ignore ) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) @@ -353,7 +355,7 @@ def test_n_dimensional_Hellwig2022_to_XYZ(self): ) @ignore_numpy_errors - def test_domain_range_scale_Hellwig2022_to_XYZ(self): + def test_domain_range_scale_Hellwig2022_to_XYZ(self) -> None: """ Test :func:`colour.appearance.hellwig2022.Hellwig2022_to_XYZ` definition domain and range scale support. @@ -408,7 +410,7 @@ def test_domain_range_scale_Hellwig2022_to_XYZ(self): ) @ignore_numpy_errors - def test_raise_exception_Hellwig2022_to_XYZ(self): + def test_raise_exception_Hellwig2022_to_XYZ(self) -> None: """ Test :func:`colour.appearance.hellwig2022.Hellwig2022_to_XYZ` definition raised exception. @@ -436,7 +438,7 @@ def test_raise_exception_Hellwig2022_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Hellwig2022_to_XYZ(self): + def test_nan_Hellwig2022_to_XYZ(self) -> None: """ Test :func:`colour.appearance.hellwig2022.Hellwig2022_to_XYZ` definition nan support. diff --git a/colour/appearance/tests/test_hke.py b/colour/appearance/tests/test_hke.py index 2bd07867b..ae66d687f 100644 --- a/colour/appearance/tests/test_hke.py +++ b/colour/appearance/tests/test_hke.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.hke` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -34,7 +36,7 @@ class TestHelmholtzKohlrauschEffectObjectNayatani1997: HelmholtzKohlrausch_effect_object_Nayatani1997` definition unit tests methods. """ - def test_HelmholtzKohlrausch_effect_object_Nayatani1997(self): + def test_HelmholtzKohlrausch_effect_object_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.\ HelmholtzKohlrausch_effect_object_Nayatani1997` definition. @@ -64,7 +66,7 @@ def test_HelmholtzKohlrausch_effect_object_Nayatani1997(self): def test_n_dimensional_HelmholtzKohlrausch_effect_object_Nayatani1997( self, - ): + ) -> None: """ Test :func:`colour.appearance.hke.\ HelmholtzKohlrausch_effect_object_Nayatani1997` definition n_dimensional @@ -125,7 +127,7 @@ def test_n_dimensional_HelmholtzKohlrausch_effect_object_Nayatani1997( ) @ignore_numpy_errors - def test_nan_HelmholtzKohlrausch_effect_object_Nayatani1997(self): + def test_nan_HelmholtzKohlrausch_effect_object_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.\ HelmholtzKohlrausch_effect_object_Nayatani1997` definition nan support. @@ -144,7 +146,7 @@ class TestHelmholtzKohlrauschEffectLuminousNayatani1997: methods. """ - def test_HelmholtzKohlrausch_effect_luminous_Nayatani1997(self): + def test_HelmholtzKohlrausch_effect_luminous_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.\ HelmholtzKohlrausch_effect_luminous_Nayatani1997` definition. @@ -174,7 +176,7 @@ def test_HelmholtzKohlrausch_effect_luminous_Nayatani1997(self): def test_n_dimensional_HelmholtzKohlrausch_effect_luminous_Nayatani1997( self, - ): + ) -> None: """ Test :func:`colour.appearance.hke.\ HelmholtzKohlrausch_effect_luminous_Nayatani1997` definition n_dimensional @@ -235,7 +237,7 @@ def test_n_dimensional_HelmholtzKohlrausch_effect_luminous_Nayatani1997( ) @ignore_numpy_errors - def test_nan_HelmholtzKohlrausch_effect_luminous_Nayatani1997(self): + def test_nan_HelmholtzKohlrausch_effect_luminous_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.\ HelmholtzKohlrausch_effect_luminous_Nayatani1997` definition nan support. @@ -253,7 +255,7 @@ class TestCoefficient_K_Br_Nayatani1997: definition unit tests methods. """ - def test_coefficient_K_Br_Nayatani1997(self): + def test_coefficient_K_Br_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.coefficient_K_Br_Nayatani1997` definition. @@ -283,7 +285,7 @@ def test_coefficient_K_Br_Nayatani1997(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_coefficient_K_Br_Nayatani1997(self): + def test_n_dimensional_coefficient_K_Br_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.coefficient_K_Br_Nayatani1997` definition n_dimensional arrays support. @@ -317,7 +319,7 @@ def test_n_dimensional_coefficient_K_Br_Nayatani1997(self): ) @ignore_numpy_errors - def test_nan_coefficient_K_Br_Nayatani1997(self): + def test_nan_coefficient_K_Br_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.coefficient_K_Br_Nayatani1997` definition nan support. @@ -333,7 +335,7 @@ class TestCoefficient_q_Nayatani1997: definition unit tests methods. """ - def test_coefficient_q_Nayatani1997(self): + def test_coefficient_q_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.coefficient_q_Nayatani1997` definition. @@ -363,7 +365,7 @@ def test_coefficient_q_Nayatani1997(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_coefficient_q_Nayatani1997(self): + def test_n_dimensional_coefficient_q_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.coefficient_q_Nayatani1997` definition n_dimensional arrays support. @@ -391,7 +393,7 @@ def test_n_dimensional_coefficient_q_Nayatani1997(self): ) @ignore_numpy_errors - def test_nan_coefficient_q_Nayatani1997(self): + def test_nan_coefficient_q_Nayatani1997(self) -> None: """ Test :func:`colour.appearance.hke.coefficient_q_Nayatani1997` definition nan support. diff --git a/colour/appearance/tests/test_hunt.py b/colour/appearance/tests/test_hunt.py index db909d06c..00dd6bdd4 100644 --- a/colour/appearance/tests/test_hunt.py +++ b/colour/appearance/tests/test_hunt.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.hunt` module.""" +from __future__ import annotations + import contextlib from itertools import product @@ -35,7 +37,7 @@ class TestXYZ_to_Hunt: methods. """ - def test_XYZ_to_Hunt(self): + def test_XYZ_to_Hunt(self) -> None: """ Test :func:`colour.appearance.hunt.XYZ_to_Hunt` definition. @@ -84,7 +86,7 @@ def test_XYZ_to_Hunt(self): atol=0.05, ) - def test_n_dimensional_XYZ_to_Hunt(self): + def test_n_dimensional_XYZ_to_Hunt(self) -> None: """ Test :func:`colour.appearance.hunt.XYZ_to_Hunt` definition n-dimensional support. @@ -124,7 +126,7 @@ def test_n_dimensional_XYZ_to_Hunt(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_Hunt(self): + def test_domain_range_scale_XYZ_to_Hunt(self) -> None: """ Test :func:`colour.appearance.hunt.XYZ_to_Hunt` definition domain and range scale support. @@ -159,7 +161,7 @@ def test_domain_range_scale_XYZ_to_Hunt(self): ) @ignore_numpy_errors - def test_raise_exception_XYZ_to_Hunt(self): + def test_raise_exception_XYZ_to_Hunt(self) -> None: """ Test :func:`colour.appearance.hunt.XYZ_to_Hunt` definition raised exception. @@ -183,7 +185,7 @@ def test_raise_exception_XYZ_to_Hunt(self): XYZ_to_Hunt(XYZ, XYZ_w, XYZ_b, L_A, surround, CCT_w=CCT_w, S_w=S_w) @ignore_numpy_errors - def test_XYZ_p_XYZ_to_Hunt(self): + def test_XYZ_p_XYZ_to_Hunt(self) -> None: """ Test :func:`colour.appearance.hunt.XYZ_to_Hunt` definition *XYZ_p* argument handling. @@ -222,7 +224,7 @@ def test_XYZ_p_XYZ_to_Hunt(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Hunt(self): + def test_nan_XYZ_to_Hunt(self) -> None: """ Test :func:`colour.appearance.hunt.XYZ_to_Hunt` definition nan support. diff --git a/colour/appearance/tests/test_kim2009.py b/colour/appearance/tests/test_kim2009.py index 45dd85df1..a79a50c29 100644 --- a/colour/appearance/tests/test_kim2009.py +++ b/colour/appearance/tests/test_kim2009.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.kim2009` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -41,7 +43,7 @@ class TestXYZ_to_Kim2009: tests methods. """ - def test_XYZ_to_Kim2009(self): + def test_XYZ_to_Kim2009(self) -> None: """Test :func:`colour.appearance.kim2009.XYZ_to_Kim2009` definition.""" XYZ = np.array([19.01, 20.00, 21.78]) @@ -124,7 +126,7 @@ def test_XYZ_to_Kim2009(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Kim2009(self): + def test_n_dimensional_XYZ_to_Kim2009(self) -> None: """ Test :func:`colour.appearance.kim2009.XYZ_to_Kim2009` definition n-dimensional support. @@ -162,7 +164,7 @@ def test_n_dimensional_XYZ_to_Kim2009(self): ) @ignore_numpy_errors - def test_domain_range_scale_XYZ_to_Kim2009(self): + def test_domain_range_scale_XYZ_to_Kim2009(self) -> None: """ Test :func:`colour.appearance.kim2009.XYZ_to_Kim2009` definition domain and range scale support. @@ -210,7 +212,7 @@ def test_domain_range_scale_XYZ_to_Kim2009(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Kim2009(self): + def test_nan_XYZ_to_Kim2009(self) -> None: """ Test :func:`colour.appearance.kim2009.XYZ_to_Kim2009` definition nan support. @@ -229,7 +231,7 @@ class TestKim2009_to_XYZ: tests methods. """ - def test_Kim2009_to_XYZ(self): + def test_Kim2009_to_XYZ(self) -> None: """Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition.""" specification = CAM_Specification_Kim2009( @@ -304,7 +306,7 @@ def test_Kim2009_to_XYZ(self): atol=0.01, ) - def test_n_dimensional_Kim2009_to_XYZ(self): + def test_n_dimensional_Kim2009_to_XYZ(self) -> None: """ Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition n-dimensional support. @@ -319,7 +321,7 @@ def test_n_dimensional_Kim2009_to_XYZ(self): XYZ = Kim2009_to_XYZ(specification, XYZ_w, L_a, media, surround) specification = CAM_Specification_Kim2009( - *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() + *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() # pyright: ignore ) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_allclose( @@ -336,7 +338,7 @@ def test_n_dimensional_Kim2009_to_XYZ(self): ) specification = CAM_Specification_Kim2009( - *tsplit(np.reshape(specification, (2, 3, 8))).tolist() + *tsplit(np.reshape(specification, (2, 3, 8))).tolist() # pyright: ignore ) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) @@ -347,7 +349,7 @@ def test_n_dimensional_Kim2009_to_XYZ(self): ) @ignore_numpy_errors - def test_domain_range_scale_Kim2009_to_XYZ(self): + def test_domain_range_scale_Kim2009_to_XYZ(self) -> None: """ Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition domain and range scale support. @@ -400,7 +402,7 @@ def test_domain_range_scale_Kim2009_to_XYZ(self): ) @ignore_numpy_errors - def test_raise_exception_Kim2009_to_XYZ(self): + def test_raise_exception_Kim2009_to_XYZ(self) -> None: """ Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition raised exception. @@ -421,7 +423,7 @@ def test_raise_exception_Kim2009_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Kim2009_to_XYZ(self): + def test_nan_Kim2009_to_XYZ(self) -> None: """ Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition nan support. diff --git a/colour/appearance/tests/test_llab.py b/colour/appearance/tests/test_llab.py index 45dd85df1..a79a50c29 100644 --- a/colour/appearance/tests/test_llab.py +++ b/colour/appearance/tests/test_llab.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.kim2009` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -41,7 +43,7 @@ class TestXYZ_to_Kim2009: tests methods. """ - def test_XYZ_to_Kim2009(self): + def test_XYZ_to_Kim2009(self) -> None: """Test :func:`colour.appearance.kim2009.XYZ_to_Kim2009` definition.""" XYZ = np.array([19.01, 20.00, 21.78]) @@ -124,7 +126,7 @@ def test_XYZ_to_Kim2009(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Kim2009(self): + def test_n_dimensional_XYZ_to_Kim2009(self) -> None: """ Test :func:`colour.appearance.kim2009.XYZ_to_Kim2009` definition n-dimensional support. @@ -162,7 +164,7 @@ def test_n_dimensional_XYZ_to_Kim2009(self): ) @ignore_numpy_errors - def test_domain_range_scale_XYZ_to_Kim2009(self): + def test_domain_range_scale_XYZ_to_Kim2009(self) -> None: """ Test :func:`colour.appearance.kim2009.XYZ_to_Kim2009` definition domain and range scale support. @@ -210,7 +212,7 @@ def test_domain_range_scale_XYZ_to_Kim2009(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Kim2009(self): + def test_nan_XYZ_to_Kim2009(self) -> None: """ Test :func:`colour.appearance.kim2009.XYZ_to_Kim2009` definition nan support. @@ -229,7 +231,7 @@ class TestKim2009_to_XYZ: tests methods. """ - def test_Kim2009_to_XYZ(self): + def test_Kim2009_to_XYZ(self) -> None: """Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition.""" specification = CAM_Specification_Kim2009( @@ -304,7 +306,7 @@ def test_Kim2009_to_XYZ(self): atol=0.01, ) - def test_n_dimensional_Kim2009_to_XYZ(self): + def test_n_dimensional_Kim2009_to_XYZ(self) -> None: """ Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition n-dimensional support. @@ -319,7 +321,7 @@ def test_n_dimensional_Kim2009_to_XYZ(self): XYZ = Kim2009_to_XYZ(specification, XYZ_w, L_a, media, surround) specification = CAM_Specification_Kim2009( - *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() + *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() # pyright: ignore ) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_allclose( @@ -336,7 +338,7 @@ def test_n_dimensional_Kim2009_to_XYZ(self): ) specification = CAM_Specification_Kim2009( - *tsplit(np.reshape(specification, (2, 3, 8))).tolist() + *tsplit(np.reshape(specification, (2, 3, 8))).tolist() # pyright: ignore ) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) @@ -347,7 +349,7 @@ def test_n_dimensional_Kim2009_to_XYZ(self): ) @ignore_numpy_errors - def test_domain_range_scale_Kim2009_to_XYZ(self): + def test_domain_range_scale_Kim2009_to_XYZ(self) -> None: """ Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition domain and range scale support. @@ -400,7 +402,7 @@ def test_domain_range_scale_Kim2009_to_XYZ(self): ) @ignore_numpy_errors - def test_raise_exception_Kim2009_to_XYZ(self): + def test_raise_exception_Kim2009_to_XYZ(self) -> None: """ Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition raised exception. @@ -421,7 +423,7 @@ def test_raise_exception_Kim2009_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Kim2009_to_XYZ(self): + def test_nan_Kim2009_to_XYZ(self) -> None: """ Test :func:`colour.appearance.kim2009.Kim2009_to_XYZ` definition nan support. diff --git a/colour/appearance/tests/test_nayatani95.py b/colour/appearance/tests/test_nayatani95.py index b460492fb..470a087ca 100644 --- a/colour/appearance/tests/test_nayatani95.py +++ b/colour/appearance/tests/test_nayatani95.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.nayatani95` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -30,7 +32,7 @@ class TestXYZ_to_Nayatani95: unit tests methods. """ - def test_XYZ_to_Nayatani95(self): + def test_XYZ_to_Nayatani95(self) -> None: """ Test :func:`colour.appearance.nayatani95.XYZ_to_Nayatani95` definition. @@ -78,7 +80,7 @@ def test_XYZ_to_Nayatani95(self): atol=0.05, ) - def test_n_dimensional_XYZ_to_Nayatani95(self): + def test_n_dimensional_XYZ_to_Nayatani95(self) -> None: """ Test :func:`colour.appearance.nayatani95.XYZ_to_Nayatani95` definition n-dimensional support. @@ -115,7 +117,7 @@ def test_n_dimensional_XYZ_to_Nayatani95(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_Nayatani95(self): + def test_domain_range_scale_XYZ_to_Nayatani95(self) -> None: """ Test :func:`colour.appearance.nayatani95.XYZ_to_Nayatani95` definition domain and range scale support. @@ -146,7 +148,7 @@ def test_domain_range_scale_XYZ_to_Nayatani95(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Nayatani95(self): + def test_nan_XYZ_to_Nayatani95(self) -> None: """ Test :func:`colour.appearance.nayatani95.XYZ_to_Nayatani95` definition nan support. diff --git a/colour/appearance/tests/test_rlab.py b/colour/appearance/tests/test_rlab.py index b460492fb..470a087ca 100644 --- a/colour/appearance/tests/test_rlab.py +++ b/colour/appearance/tests/test_rlab.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.appearance.nayatani95` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -30,7 +32,7 @@ class TestXYZ_to_Nayatani95: unit tests methods. """ - def test_XYZ_to_Nayatani95(self): + def test_XYZ_to_Nayatani95(self) -> None: """ Test :func:`colour.appearance.nayatani95.XYZ_to_Nayatani95` definition. @@ -78,7 +80,7 @@ def test_XYZ_to_Nayatani95(self): atol=0.05, ) - def test_n_dimensional_XYZ_to_Nayatani95(self): + def test_n_dimensional_XYZ_to_Nayatani95(self) -> None: """ Test :func:`colour.appearance.nayatani95.XYZ_to_Nayatani95` definition n-dimensional support. @@ -115,7 +117,7 @@ def test_n_dimensional_XYZ_to_Nayatani95(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_Nayatani95(self): + def test_domain_range_scale_XYZ_to_Nayatani95(self) -> None: """ Test :func:`colour.appearance.nayatani95.XYZ_to_Nayatani95` definition domain and range scale support. @@ -146,7 +148,7 @@ def test_domain_range_scale_XYZ_to_Nayatani95(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Nayatani95(self): + def test_nan_XYZ_to_Nayatani95(self) -> None: """ Test :func:`colour.appearance.nayatani95.XYZ_to_Nayatani95` definition nan support. diff --git a/colour/appearance/tests/test_zcam.py b/colour/appearance/tests/test_zcam.py index 2ba077f98..27f4bbe53 100644 --- a/colour/appearance/tests/test_zcam.py +++ b/colour/appearance/tests/test_zcam.py @@ -2,6 +2,8 @@ Define the unit tests for the :mod:`colour.appearance.zcam` module. """ +from __future__ import annotations + from itertools import permutations import numpy as np @@ -37,7 +39,7 @@ class TestXYZ_to_ZCAM: methods. """ - def test_XYZ_to_ZCAM(self): + def test_XYZ_to_ZCAM(self) -> None: """ Tests :func:`colour.appearance.zcam.XYZ_to_ZCAM` definition. """ @@ -168,7 +170,7 @@ def test_XYZ_to_ZCAM(self): atol=0.025, ) - def test_n_dimensional_XYZ_to_ZCAM(self): + def test_n_dimensional_XYZ_to_ZCAM(self) -> None: """ Tests :func:`colour.appearance.zcam.XYZ_to_ZCAM` definition n-dimensional support. @@ -200,7 +202,7 @@ def test_n_dimensional_XYZ_to_ZCAM(self): ) @ignore_numpy_errors - def test_domain_range_scale_XYZ_to_ZCAM(self): + def test_domain_range_scale_XYZ_to_ZCAM(self) -> None: """ Tests :func:`colour.appearance.zcam.XYZ_to_ZCAM` definition domain and range scale support. @@ -215,9 +217,9 @@ def test_domain_range_scale_XYZ_to_ZCAM(self): d_r = ( ("reference", 1, 1), - (1, 1, np.array([1, 1, 1 / 360, 1, 1, 1, 1 / 400, np.nan, 1, 1, 1])), + ("1", 1, np.array([1, 1, 1 / 360, 1, 1, 1, 1 / 400, np.nan, 1, 1, 1])), ( - 100, + "100", 100, np.array( [ @@ -245,7 +247,7 @@ def test_domain_range_scale_XYZ_to_ZCAM(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_ZCAM(self): + def test_nan_XYZ_to_ZCAM(self) -> None: """ Tests :func:`colour.appearance.zcam.XYZ_to_ZCAM` definition nan support. @@ -268,7 +270,7 @@ class TestZCAM_to_XYZ: tests methods. """ - def test_ZCAM_to_XYZ(self): + def test_ZCAM_to_XYZ(self) -> None: """ Tests :func:`colour.appearance.zcam.ZCAM_to_XYZ` definition. """ @@ -382,7 +384,7 @@ def test_ZCAM_to_XYZ(self): rtol=0.01, ) - def test_n_dimensional_ZCAM_to_XYZ(self): + def test_n_dimensional_ZCAM_to_XYZ(self) -> None: """ Tests :func:`colour.appearance.zcam.ZCAM_to_XYZ` definition n-dimensional support. @@ -397,7 +399,7 @@ def test_n_dimensional_ZCAM_to_XYZ(self): XYZ = ZCAM_to_XYZ(specification, XYZ_w, L_a, Y_b, surround) specification = CAM_Specification_ZCAM( - *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() + *np.transpose(np.tile(tsplit(specification), (6, 1))).tolist() # pyright: ignore ) XYZ = np.tile(XYZ, (6, 1)) np.testing.assert_almost_equal( @@ -410,7 +412,7 @@ def test_n_dimensional_ZCAM_to_XYZ(self): ) specification = CAM_Specification_ZCAM( - *tsplit(np.reshape(specification, (2, 3, 11))).tolist() + *tsplit(np.reshape(specification, (2, 3, 11))).tolist() # pyright: ignore ) XYZ_w = np.reshape(XYZ_w, (2, 3, 3)) XYZ = np.reshape(XYZ, (2, 3, 3)) @@ -419,7 +421,7 @@ def test_n_dimensional_ZCAM_to_XYZ(self): ) @ignore_numpy_errors - def test_domain_range_scale_ZCAM_to_XYZ(self): + def test_domain_range_scale_ZCAM_to_XYZ(self) -> None: """ Tests :func:`colour.appearance.zcam.ZCAM_to_XYZ` definition domain and range scale support. @@ -435,9 +437,9 @@ def test_domain_range_scale_ZCAM_to_XYZ(self): d_r = ( ("reference", 1, 1), - (1, np.array([1, 1, 1 / 360, 1, 1, 1, 1 / 400, np.nan, 1, 1, 1]), 1), + ("1", np.array([1, 1, 1 / 360, 1, 1, 1, 1 / 400, np.nan, 1, 1, 1]), 1), ( - 100, + "100", np.array( [ 100, @@ -467,7 +469,7 @@ def test_domain_range_scale_ZCAM_to_XYZ(self): ) @ignore_numpy_errors - def test_raise_exception_ZCAM_to_XYZ(self): + def test_raise_exception_ZCAM_to_XYZ(self) -> None: """ Tests :func:`colour.appearance.zcam.ZCAM_to_XYZ` definition raised exception. @@ -488,7 +490,7 @@ def test_raise_exception_ZCAM_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_ZCAM_to_XYZ(self): + def test_nan_ZCAM_to_XYZ(self) -> None: """ Tests :func:`colour.appearance.zcam.ZCAM_to_XYZ` definition nan support. diff --git a/colour/biochemistry/tests/test_michaelis_menten.py b/colour/biochemistry/tests/test_michaelis_menten.py index 755cced97..f69bc73fc 100644 --- a/colour/biochemistry/tests/test_michaelis_menten.py +++ b/colour/biochemistry/tests/test_michaelis_menten.py @@ -3,6 +3,8 @@ module. """ +from __future__ import annotations + from itertools import product import numpy as np @@ -37,7 +39,7 @@ class TestReactionRateMichaelisMentenMichaelis1913: reaction_rate_MichaelisMenten_Michaelis1913` definition unit tests methods. """ - def test_reaction_rate_MichaelisMenten_Michaelis1913(self): + def test_reaction_rate_MichaelisMenten_Michaelis1913(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ reaction_rate_MichaelisMenten_Michaelis1913` definition. @@ -61,7 +63,7 @@ def test_reaction_rate_MichaelisMenten_Michaelis1913(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_reaction_rate_MichaelisMenten_Michaelis1913(self): + def test_n_dimensional_reaction_rate_MichaelisMenten_Michaelis1913(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ reaction_rate_MichaelisMenten_Michaelis1913` definition n-dimensional arrays @@ -100,7 +102,7 @@ def test_n_dimensional_reaction_rate_MichaelisMenten_Michaelis1913(self): ) @ignore_numpy_errors - def test_nan_reaction_rate_MichaelisMenten_Michaelis1913(self): + def test_nan_reaction_rate_MichaelisMenten_Michaelis1913(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ reaction_rate_MichaelisMenten_Michaelis1913` definition nan support. @@ -117,7 +119,7 @@ class TestSubstrateConcentrationMichaelisMentenMichaelis1913: reaction_rate_MichaelisMenten_Michaelis1913` definition unit tests methods. """ - def test_substrate_concentration_MichaelisMenten_Michaelis1913(self): + def test_substrate_concentration_MichaelisMenten_Michaelis1913(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ substrate_concentration_MichaelisMenten_Michaelis1913` definition. @@ -143,7 +145,7 @@ def test_substrate_concentration_MichaelisMenten_Michaelis1913(self): def test_n_dimensional_substrate_concentration_MichaelisMenten_Michaelis1913( self, - ): + ) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ substrate_concentration_MichaelisMenten_Michaelis1913` definition n-dimensional @@ -182,7 +184,7 @@ def test_n_dimensional_substrate_concentration_MichaelisMenten_Michaelis1913( ) @ignore_numpy_errors - def test_nan_substrate_concentration_MichaelisMenten_Michaelis1913(self): + def test_nan_substrate_concentration_MichaelisMenten_Michaelis1913(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ substrate_concentration_MichaelisMenten_Michaelis1913` definition nan support. @@ -199,7 +201,7 @@ class TestReactionRateMichaelisMentenAbebe2017: reaction_rate_MichaelisMenten_Abebe2017` definition unit tests methods. """ - def test_reaction_rate_MichaelisMenten_Abebe2017(self): + def test_reaction_rate_MichaelisMenten_Abebe2017(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ reaction_rate_MichaelisMenten_Abebe2017` definition. @@ -223,7 +225,7 @@ def test_reaction_rate_MichaelisMenten_Abebe2017(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_reaction_rate_MichaelisMenten_Abebe2017(self): + def test_n_dimensional_reaction_rate_MichaelisMenten_Abebe2017(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ reaction_rate_MichaelisMenten_Abebe2017` definition n-dimensional arrays @@ -265,7 +267,7 @@ def test_n_dimensional_reaction_rate_MichaelisMenten_Abebe2017(self): ) @ignore_numpy_errors - def test_nan_reaction_rate_MichaelisMenten_Abebe2017(self): + def test_nan_reaction_rate_MichaelisMenten_Abebe2017(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ reaction_rate_MichaelisMenten_Abebe2017` definition nan support. @@ -282,7 +284,7 @@ class TestSubstrateConcentrationMichaelisMentenAbebe2017: reaction_rate_MichaelisMenten_Abebe2017` definition unit tests methods. """ - def test_substrate_concentration_MichaelisMenten_Abebe2017(self): + def test_substrate_concentration_MichaelisMenten_Abebe2017(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ substrate_concentration_MichaelisMenten_Abebe2017` definition. @@ -314,7 +316,7 @@ def test_substrate_concentration_MichaelisMenten_Abebe2017(self): def test_n_dimensional_substrate_concentration_MichaelisMenten_Abebe2017( self, - ): + ) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ substrate_concentration_MichaelisMenten_Abebe2017` definition n-dimensional @@ -356,7 +358,7 @@ def test_n_dimensional_substrate_concentration_MichaelisMenten_Abebe2017( ) @ignore_numpy_errors - def test_nan_substrate_concentration_MichaelisMenten_Abebe2017(self): + def test_nan_substrate_concentration_MichaelisMenten_Abebe2017(self) -> None: """ Test :func:`colour.biochemistry.michaelis_menten.\ substrate_concentration_MichaelisMenten_Abebe2017` definition nan support. diff --git a/colour/blindness/tests/test_machado2009.py b/colour/blindness/tests/test_machado2009.py index 810c7d52d..07b745324 100644 --- a/colour/blindness/tests/test_machado2009.py +++ b/colour/blindness/tests/test_machado2009.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.blindness.machado2009` module.""" +from __future__ import annotations + import numpy as np from colour.blindness import ( @@ -33,13 +35,13 @@ class TestMsdsCmfsAnomalousTrichromacyMachado2009: msds_cmfs_anomalous_trichromacy_Machado2009` definition unit tests methods. """ - def test_msds_cmfs_anomalous_trichromacy_Machado2009(self): + def test_msds_cmfs_anomalous_trichromacy_Machado2009(self) -> None: """ Test :func:`colour.blindness.machado2009.\ msds_cmfs_anomalous_trichromacy_Machado2009` definition. """ - cmfs = MSDS_CMFS_LMS.get("Smith & Pokorny 1975 Normal Trichromats") + cmfs = MSDS_CMFS_LMS["Smith & Pokorny 1975 Normal Trichromats"] np.testing.assert_allclose( msds_cmfs_anomalous_trichromacy_Machado2009( cmfs, @@ -124,13 +126,13 @@ class TestMatrixAnomalousTrichromacyMachado2009: matrix_anomalous_trichromacy_Machado2009` definition unit tests methods. """ - def test_matrix_anomalous_trichromacy_Machado2009(self): + def test_matrix_anomalous_trichromacy_Machado2009(self) -> None: """ Test :func:`colour.blindness.machado2009.\ matrix_anomalous_trichromacy_Machado2009` definition. """ - cmfs = MSDS_CMFS_LMS.get("Smith & Pokorny 1975 Normal Trichromats") + cmfs = MSDS_CMFS_LMS["Smith & Pokorny 1975 Normal Trichromats"] primaries = MSDS_DISPLAY_PRIMARIES["Typical CRT Brainard 1997"] np.testing.assert_allclose( matrix_anomalous_trichromacy_Machado2009( @@ -144,7 +146,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([2, 0, 0]) ), - CVD_MATRICES_MACHADO2010.get("Protanomaly").get(0.1), + CVD_MATRICES_MACHADO2010["Protanomaly"][0.1], atol=0.0001, ) @@ -152,7 +154,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([10, 0, 0]) ), - CVD_MATRICES_MACHADO2010.get("Protanomaly").get(0.5), + CVD_MATRICES_MACHADO2010["Protanomaly"][0.5], atol=0.0001, ) @@ -160,7 +162,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([20, 0, 0]) ), - CVD_MATRICES_MACHADO2010.get("Protanomaly").get(1.0), + CVD_MATRICES_MACHADO2010["Protanomaly"][1.0], atol=0.0001, ) @@ -168,7 +170,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([0, 2, 0]) ), - CVD_MATRICES_MACHADO2010.get("Deuteranomaly").get(0.1), + CVD_MATRICES_MACHADO2010["Deuteranomaly"][0.1], atol=0.0001, ) @@ -176,7 +178,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([0, 10, 0]) ), - CVD_MATRICES_MACHADO2010.get("Deuteranomaly").get(0.5), + CVD_MATRICES_MACHADO2010["Deuteranomaly"][0.5], atol=0.0001, ) @@ -184,7 +186,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([0, 20, 0]) ), - CVD_MATRICES_MACHADO2010.get("Deuteranomaly").get(1.0), + CVD_MATRICES_MACHADO2010["Deuteranomaly"][1.0], atol=0.0001, ) @@ -192,7 +194,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([0, 0, 5.00056688094503]) ), - CVD_MATRICES_MACHADO2010.get("Tritanomaly").get(0.1), + CVD_MATRICES_MACHADO2010["Tritanomaly"][0.1], atol=0.0001, ) @@ -200,7 +202,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([0, 0, 29.002939088780934]) ), - CVD_MATRICES_MACHADO2010.get("Tritanomaly").get(0.5), + CVD_MATRICES_MACHADO2010["Tritanomaly"][0.5], atol=0.0001, ) @@ -208,7 +210,7 @@ def test_matrix_anomalous_trichromacy_Machado2009(self): matrix_anomalous_trichromacy_Machado2009( cmfs, primaries, np.array([0, 0, 59.00590434857581]) ), - CVD_MATRICES_MACHADO2010.get("Tritanomaly").get(1.0), + CVD_MATRICES_MACHADO2010["Tritanomaly"][1.0], atol=0.001, ) @@ -219,7 +221,7 @@ class TestMatrixCvdMachado2009: definition unit tests methods. """ - def test_matrix_cvd_Machado2009(self): + def test_matrix_cvd_Machado2009(self) -> None: """ Test :func:`colour.blindness.machado2009.matrix_cvd_Machado2009` definition. @@ -274,7 +276,7 @@ def test_matrix_cvd_Machado2009(self): ) @ignore_numpy_errors - def test_nan_matrix_cvd_Machado2009(self): + def test_nan_matrix_cvd_Machado2009(self) -> None: """ Test :func:`colour.blindness.machado2009.matrix_cvd_Machado2009` definition nan support. diff --git a/colour/characterisation/aces_it.py b/colour/characterisation/aces_it.py index 07fa32db3..e72abfe78 100644 --- a/colour/characterisation/aces_it.py +++ b/colour/characterisation/aces_it.py @@ -84,9 +84,9 @@ sds_and_msds_to_msds, ) from colour.hints import ( + Any, ArrayLike, Callable, - DTypeFloat, LiteralChromaticAdaptationTransform, Mapping, NDArrayFloat, @@ -112,6 +112,7 @@ CanonicalMapping, as_float, as_float_array, + as_float_scalar, from_range_1, ones, optional, @@ -163,7 +164,7 @@ def sd_to_aces_relative_exposure_values( chromatic_adaptation_transform: ( LiteralChromaticAdaptationTransform | str | None ) = "CAT02", - **kwargs, + **kwargs: Any, ) -> NDArrayFloat: """ Convert given spectral distribution to *ACES2065-1* colourspace relative @@ -246,10 +247,10 @@ def sd_to_aces_relative_exposure_values( r_bar, g_bar, b_bar = tsplit(MSDS_ACES_RICD.values) - def k(x: NDArrayFloat, y: NDArrayFloat) -> DTypeFloat: + def k(x: NDArrayFloat, y: NDArrayFloat) -> float: """Compute the :math:`K_r`, :math:`K_g` or :math:`K_b` scale factors.""" - return 1 / np.sum(x * y) + return as_float_scalar(1 / np.sum(x * y)) k_r = k(i_v, r_bar) k_g = k(i_v, g_bar) @@ -393,7 +394,7 @@ def generate_illuminants_rawtoaces_v1() -> CanonicalMapping: # Blackbody from 1000K to 4000K. for i in np.arange(1000, 4000, 500): - sd = sd_blackbody(i, SPECTRAL_SHAPE_RAWTOACES) + sd = sd_blackbody(cast(float, i), SPECTRAL_SHAPE_RAWTOACES) illuminants[sd.name] = sd # A.M.P.A.S. variant of ISO 7589 Studio Tungsten. diff --git a/colour/characterisation/cameras.py b/colour/characterisation/cameras.py index a56139d28..caca3d008 100644 --- a/colour/characterisation/cameras.py +++ b/colour/characterisation/cameras.py @@ -11,6 +11,8 @@ from __future__ import annotations +from collections.abc import KeysView, ValuesView + from colour.colorimetry import ( MultiSpectralDistributions, SpectralDistribution, @@ -97,9 +99,10 @@ def __init__( | Series | Signal | SpectralDistribution + | ValuesView | None ) = None, - domain: ArrayLike | SpectralShape | None = None, + domain: ArrayLike | SpectralShape | KeysView | None = None, labels: Sequence | None = None, # noqa: ARG002 **kwargs: Any, ) -> None: diff --git a/colour/characterisation/correction.py b/colour/characterisation/correction.py index 007a187a8..3b1b69839 100644 --- a/colour/characterisation/correction.py +++ b/colour/characterisation/correction.py @@ -118,8 +118,8 @@ def matrix_augmented_Cheung2004( RGB: ArrayLike, - terms: Literal[3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35] = 3, -) -> NDArrayFloat: + terms: Literal[3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35] | int = 3, +) -> NDArrayFloat: # pyright: ignore """ Perform polynomial expansion of given *RGB* colourspace array using *Cheung et al. (2004)* method. @@ -418,9 +418,9 @@ def matrix_augmented_Cheung2004( def polynomial_expansion_Finlayson2015( RGB: ArrayLike, - degree: Literal[1, 2, 3, 4] = 1, + degree: Literal[1, 2, 3, 4] | int = 1, root_polynomial_expansion: bool = True, -) -> NDArrayFloat: +) -> NDArrayFloat: # pyright: ignore """ Perform polynomial expansion of given *RGB* colourspace array using *Finlayson et al. (2015)* method. @@ -721,7 +721,7 @@ def polynomial_expansion( def matrix_colour_correction_Cheung2004( M_T: ArrayLike, M_R: ArrayLike, - terms: Literal[3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35] = 3, + terms: Literal[3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35] | int = 3, ) -> NDArrayFloat: """ Compute a colour correction matrix from given :math:`M_T` colour array to @@ -764,7 +764,7 @@ def matrix_colour_correction_Cheung2004( def matrix_colour_correction_Finlayson2015( M_T: ArrayLike, M_R: ArrayLike, - degree: Literal[1, 2, 3, 4] = 1, + degree: Literal[1, 2, 3, 4] | int = 1, root_polynomial_expansion: bool = True, ) -> NDArrayFloat: """ @@ -991,7 +991,7 @@ def matrix_colour_correction( def apply_matrix_colour_correction_Cheung2004( RGB: ArrayLike, CCM: ArrayLike, - terms: Literal[3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35] = 3, + terms: Literal[3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35] | int = 3, ) -> NDArrayFloat: """ Apply given colour correction matrix :math:`CCM` computed using @@ -1043,7 +1043,7 @@ def apply_matrix_colour_correction_Cheung2004( def apply_matrix_colour_correction_Finlayson2015( RGB: ArrayLike, CCM: ArrayLike, - degree: Literal[1, 2, 3, 4] = 1, + degree: Literal[1, 2, 3, 4] | int = 1, root_polynomial_expansion: bool = True, ) -> NDArrayFloat: """ @@ -1234,7 +1234,7 @@ def colour_correction_Cheung2004( RGB: ArrayLike, M_T: ArrayLike, M_R: ArrayLike, - terms: Literal[3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35] = 3, + terms: Literal[3, 4, 5, 7, 8, 10, 11, 14, 16, 17, 19, 20, 22, 35] | int = 3, ) -> NDArrayFloat: """ Perform colour correction of given *RGB* colourspace array using the @@ -1280,7 +1280,7 @@ def colour_correction_Finlayson2015( RGB: ArrayLike, M_T: ArrayLike, M_R: ArrayLike, - degree: Literal[1, 2, 3, 4] = 1, + degree: Literal[1, 2, 3, 4] | int = 1, root_polynomial_expansion: bool = True, ) -> NDArrayFloat: """ diff --git a/colour/characterisation/displays.py b/colour/characterisation/displays.py index 89c19ebc2..6d6079728 100644 --- a/colour/characterisation/displays.py +++ b/colour/characterisation/displays.py @@ -12,6 +12,8 @@ from __future__ import annotations +from collections.abc import KeysView, ValuesView + from colour.colorimetry import ( MultiSpectralDistributions, SpectralDistribution, @@ -99,9 +101,10 @@ def __init__( | Series | Signal | SpectralDistribution + | ValuesView | None ) = None, - domain: ArrayLike | SpectralShape | None = None, + domain: ArrayLike | SpectralShape | KeysView | None = None, labels: Sequence | None = None, # noqa: ARG002 **kwargs: Any, ) -> None: diff --git a/colour/characterisation/tests/test_aces_it.py b/colour/characterisation/tests/test_aces_it.py index 0ee49a435..3a541c097 100644 --- a/colour/characterisation/tests/test_aces_it.py +++ b/colour/characterisation/tests/test_aces_it.py @@ -12,6 +12,7 @@ MSDS_ACES_RICD, MSDS_CAMERA_SENSITIVITIES, SDS_COLOURCHECKERS, + RGB_CameraSensitivities, best_illuminant, camera_RGB_to_ACES2065_1, generate_illuminants_rawtoaces_v1, @@ -31,7 +32,6 @@ from colour.colorimetry import ( MSDS_CMFS, SDS_ILLUMINANTS, - MultiSpectralDistributions, SpectralDistribution, SpectralShape, reshape_msds, @@ -69,14 +69,16 @@ "TestCamera_RGB_to_ACES2065_1", ] -MSDS_CANON_EOS_5DMARK_II: MultiSpectralDistributions = sds_and_msds_to_msds( - list( - read_sds_from_csv_file( - os.path.join( - ROOT_RESOURCES_RAWTOACES, - "CANON_EOS_5DMark_II_RGB_Sensitivities.csv", - ) - ).values() +MSDS_CANON_EOS_5DMARK_II: RGB_CameraSensitivities = RGB_CameraSensitivities( + sds_and_msds_to_msds( + list( + read_sds_from_csv_file( + os.path.join( + ROOT_RESOURCES_RAWTOACES, + "CANON_EOS_5DMark_II_RGB_Sensitivities.csv", + ) + ).values() + ) ) ) @@ -91,7 +93,7 @@ class TestSdToAcesRelativeExposureValues: sd_to_aces_relative_exposure_values` definition unit tests methods. """ - def test_sd_to_aces_relative_exposure_values(self): + def test_sd_to_aces_relative_exposure_values(self) -> None: """ Test :func:`colour.characterisation.aces_it.\ sd_to_aces_relative_exposure_values` definition. @@ -142,7 +144,7 @@ def test_sd_to_aces_relative_exposure_values(self): def test_domain_range_scale_spectral_to_aces_relative_exposure_values( self, - ): + ) -> None: """ Test :func:`colour.characterisation.aces_it. sd_to_aces_relative_exposure_values` definition domain and range scale @@ -169,7 +171,7 @@ class TestReadTrainingDataRawtoacesV1: read_training_data_rawtoaces_v1` definition unit tests methods. """ - def test_read_training_data_rawtoaces_v1(self): + def test_read_training_data_rawtoaces_v1(self) -> None: """ Test :func:`colour.characterisation.aces_it. read_training_data_rawtoaces_v1` definition. @@ -184,7 +186,7 @@ class TestGenerateIlluminantsRawtoacesV1: generate_illuminants_rawtoaces_v1` definition unit tests methods. """ - def test_generate_illuminants_rawtoaces_v1(self): + def test_generate_illuminants_rawtoaces_v1(self) -> None: """ Test :func:`colour.characterisation.aces_it. generate_illuminants_rawtoaces_v1` definition. @@ -250,7 +252,7 @@ class TestWhiteBalanceMultipliers: definition unit tests methods. """ - def test_white_balance_multipliers(self): + def test_white_balance_multipliers(self) -> None: """ Test :func:`colour.characterisation.aces_it.white_balance_multipliers` definition. @@ -278,7 +280,7 @@ class TestBestIlluminant: unit tests methods. """ - def test_best_illuminant(self): + def test_best_illuminant(self) -> None: """ Test :func:`colour.characterisation.aces_it.best_illuminant` definition. @@ -313,7 +315,7 @@ class TestNormaliseIlluminant: definition unit tests methods. """ - def test_normalise_illuminant(self): + def test_normalise_illuminant(self) -> None: """ Test :func:`colour.characterisation.aces_it.normalise_illuminant` definition. @@ -336,7 +338,7 @@ class TestTrainingDataSdsToRGB: definition unit tests methods. """ - def test_training_data_sds_to_RGB(self): + def test_training_data_sds_to_RGB(self) -> None: """ Test :func:`colour.characterisation.aces_it.training_data_sds_to_RGB` definition. @@ -604,7 +606,7 @@ class TestTrainingDataSdsToXYZ: definition unit tests methods. """ - def test_training_data_sds_to_XYZ(self): + def test_training_data_sds_to_XYZ(self) -> None: """ Test :func:`colour.characterisation.aces_it.training_data_sds_to_XYZ` definition. @@ -899,7 +901,7 @@ class TestWhitepointPreservingMatrix: definition unit tests methods. """ - def test_whitepoint_preserving_matrix(self): + def test_whitepoint_preserving_matrix(self) -> None: """ Test :func:`colour.characterisation.aces_it.\ whitepoint_preserving_matrix` definition. @@ -929,7 +931,7 @@ class TestOptimizationFactoryRawtoacesV1: optimisation_factory_rawtoaces_v1` definition unit tests methods. """ - def test_optimisation_factory_rawtoaces_v1(self): + def test_optimisation_factory_rawtoaces_v1(self) -> None: """ Test :func:`colour.characterisation.aces_it.\ optimisation_factory_rawtoaces_v1` definition. @@ -944,7 +946,7 @@ class TestOptimizationFactoryJzazbz: optimisation_factory_Jzazbz` definition unit tests methods. """ - def test_optimisation_factory_Jzazbz(self): + def test_optimisation_factory_Jzazbz(self) -> None: """ Test :func:`colour.characterisation.aces_it.\ optimisation_factory_Jzazbz` definition. @@ -959,7 +961,7 @@ class TestOptimizationFactoryOklab18: optimisation_factory_Oklab_15` definition unit tests methods. """ - def test_optimisation_factory_Oklab_18(self): + def test_optimisation_factory_Oklab_18(self) -> None: """ Test :func:`colour.characterisation.aces_it.\ optimisation_factory_Oklab_15` definition. @@ -974,7 +976,7 @@ class TestMatrixIdt: tests methods. """ - def test_matrix_idt(self): + def test_matrix_idt(self) -> None: """ Test :func:`colour.characterisation.aces_it.matrix_idt` definition. """ @@ -1015,7 +1017,7 @@ def test_matrix_idt(self): atol=0.0001, ) - M, RGB_w = matrix_idt( + M, RGB_w = matrix_idt( # pyright: ignore MSDS_CANON_EOS_5DMARK_II, SDS_ILLUMINANTS["D55"], optimisation_factory=optimisation_factory_Jzazbz, @@ -1036,7 +1038,7 @@ def test_matrix_idt(self): np.array([2.34141541, 1.00000000, 1.51633759]), atol=0.0001, ) - M, RGB_w = matrix_idt( + M, RGB_w = matrix_idt( # pyright: ignore MSDS_CANON_EOS_5DMARK_II, SDS_ILLUMINANTS["D55"], optimisation_factory=optimisation_factory_Oklab_15, @@ -1079,7 +1081,7 @@ def test_matrix_idt(self): atol=0.0001, ) - M, RGB_w = matrix_idt( + M, RGB_w = matrix_idt( # pyright: ignore MSDS_CANON_EOS_5DMARK_II, SDS_ILLUMINANTS["D55"], optimisation_kwargs={"method": "Nelder-Mead"}, @@ -1126,7 +1128,7 @@ def test_matrix_idt(self): np.testing.assert_allclose( matrix_idt( - MSDS_CANON_EOS_5DMARK_II, + MSDS_CANON_EOS_5DMARK_II, # pyright: ignore SDS_ILLUMINANTS["D55"], chromatic_adaptation_transform="Bradford", )[0], @@ -1140,8 +1142,8 @@ def test_matrix_idt(self): atol=0.0001, ) - _M, RGB_w, XYZ, RGB = matrix_idt( - MSDS_CANON_EOS_5DMARK_II, + _M, RGB_w, XYZ, RGB = matrix_idt( # pyright: ignore + MSDS_CANON_EOS_5DMARK_II, # pyright: ignore SDS_ILLUMINANTS["D55"], additional_data=True, ) @@ -1185,13 +1187,13 @@ class TestCamera_RGB_to_ACES2065_1: definition unit tests methods. """ - def test_camera_RGB_to_ACES2065_1(self): + def test_camera_RGB_to_ACES2065_1(self) -> None: """ Test :func:`colour.characterisation.aces_it.camera_RGB_to_ACES2065_1` definition. """ - B, b = matrix_idt(MSDS_CANON_EOS_5DMARK_II, SDS_ILLUMINANTS["D55"]) + B, b = matrix_idt(MSDS_CANON_EOS_5DMARK_II, SDS_ILLUMINANTS["D55"]) # pyright: ignore np.testing.assert_allclose( camera_RGB_to_ACES2065_1(np.array([0.1, 0.2, 0.3]), B, b), np.array([0.27064400, 0.15614871, 0.50129650]), diff --git a/colour/characterisation/tests/test_correction.py b/colour/characterisation/tests/test_correction.py index 9c76bc242..2927658b0 100644 --- a/colour/characterisation/tests/test_correction.py +++ b/colour/characterisation/tests/test_correction.py @@ -120,7 +120,7 @@ class TestMatrixAugmentedCheung2004: matrix_augmented_Cheung2004` definition unit tests methods. """ - def test_matrix_augmented_Cheung2004(self): + def test_matrix_augmented_Cheung2004(self) -> None: """ Test :func:`colour.characterisation.correction.\ matrix_augmented_Cheung2004` definition. @@ -364,7 +364,7 @@ def test_matrix_augmented_Cheung2004(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_matrix_augmented_Cheung2004(self): + def test_raise_exception_matrix_augmented_Cheung2004(self) -> None: """ Test :func:`colour.characterisation.correction.\ matrix_augmented_Cheung2004` definition raised exception. @@ -378,7 +378,7 @@ def test_raise_exception_matrix_augmented_Cheung2004(self): ) @ignore_numpy_errors - def test_nan_matrix_augmented_Cheung2004(self): + def test_nan_matrix_augmented_Cheung2004(self) -> None: """ Test :func:`colour.characterisation.correction.\ matrix_augmented_Cheung2004` definition nan support. @@ -395,7 +395,7 @@ class TestPolynomialExpansionFinlayson2015: polynomial_expansion_Finlayson2015` definition unit tests methods. """ - def test_polynomial_expansion_Finlayson2015(self): + def test_polynomial_expansion_Finlayson2015(self) -> None: """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Finlayson2015` definition. @@ -555,7 +555,7 @@ def test_polynomial_expansion_Finlayson2015(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_polynomial_expansion_Finlayson2015(self): + def test_raise_exception_polynomial_expansion_Finlayson2015(self) -> None: """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Finlayson2015` definition raised exception. @@ -569,7 +569,7 @@ def test_raise_exception_polynomial_expansion_Finlayson2015(self): ) @ignore_numpy_errors - def test_nan_polynomial_expansion_Finlayson2015(self): + def test_nan_polynomial_expansion_Finlayson2015(self) -> None: """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Finlayson2015` definition nan support. @@ -586,7 +586,7 @@ class TestPolynomialExpansionVandermonde: polynomial_expansion_Vandermonde` definition unit tests methods. """ - def test_polynomial_expansion_Vandermonde(self): + def test_polynomial_expansion_Vandermonde(self) -> None: """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Vandermonde` definition. @@ -648,7 +648,7 @@ def test_polynomial_expansion_Vandermonde(self): ) @ignore_numpy_errors - def test_nan_polynomial_expansion_Vandermonde(self): + def test_nan_polynomial_expansion_Vandermonde(self) -> None: """ Test :func:`colour.characterisation.correction.\ polynomial_expansion_Vandermonde` definition nan support. @@ -665,7 +665,7 @@ class TestMatrixColourCorrectionCheung2004: matrix_colour_correction_Cheung2004` definition unit tests methods. """ - def test_matrix_colour_correction_Cheung2004(self): + def test_matrix_colour_correction_Cheung2004(self) -> None: """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Cheung2004` definition. @@ -720,7 +720,7 @@ def test_matrix_colour_correction_Cheung2004(self): ) @ignore_numpy_errors - def test_nan_matrix_colour_correction_Cheung2004(self): # pragma: no cover + def test_nan_matrix_colour_correction_Cheung2004(self) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Cheung2004` definition nan support. @@ -746,7 +746,7 @@ class TestMatrixColourCorrectionFinlayson2015: matrix_colour_correction_Finlayson2015` definition unit tests methods. """ - def test_matrix_colour_correction_Finlayson2015(self): + def test_matrix_colour_correction_Finlayson2015(self) -> None: """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Finlayson2015` definition. @@ -823,7 +823,7 @@ def test_matrix_colour_correction_Finlayson2015(self): @ignore_numpy_errors def test_nan_matrix_colour_correction_Finlayson2015( self, - ): # pragma: no cover + ) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Finlayson2015` definition nan support. @@ -849,7 +849,7 @@ class TestMatrixColourCorrectionVandermonde: matrix_colour_correction_Vandermonde` definition unit tests methods. """ - def test_matrix_colour_correction_Vandermonde(self): + def test_matrix_colour_correction_Vandermonde(self) -> None: """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Vandermonde` definition. @@ -917,7 +917,7 @@ def test_matrix_colour_correction_Vandermonde(self): @ignore_numpy_errors def test_nan_matrix_colour_correction_Vandermonde( self, - ): # pragma: no cover + ) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction.\ matrix_colour_correction_Vandermonde` definition nan support. @@ -943,7 +943,7 @@ class TestApplyMatrixColourCorrectionCheung2004: apply_matrix_colour_correction_Cheung2004` definition unit tests methods. """ - def test_apply_matrix_colour_correction_Cheung2004(self): + def test_apply_matrix_colour_correction_Cheung2004(self) -> None: """ Test :func:`colour.characterisation.correction.\ apply_matrix_colour_correction_Cheung2004` definition. @@ -966,7 +966,7 @@ def test_apply_matrix_colour_correction_Cheung2004(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_apply_matrix_colour_correction_Cheung2004(self): + def test_n_dimensional_apply_matrix_colour_correction_Cheung2004(self) -> None: """ Test :func:`colour.characterisation.correction.\ apply_matrix_colour_correction_Cheung2004` definition n-dimensional support. @@ -1001,7 +1001,7 @@ def test_n_dimensional_apply_matrix_colour_correction_Cheung2004(self): @ignore_numpy_errors def test_nan_apply_matrix_colour_correction_Cheung2004( self, - ): # pragma: no cover + ) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction.\ apply_matrix_colour_correction_Cheung2004` definition nan support. @@ -1027,7 +1027,7 @@ class TestApplyMatrixColourCorrectionFinlayson2015: apply_matrix_colour_correction_Finlayson2015` definition unit tests methods. """ - def test_apply_matrix_colour_correction_Finlayson2015(self): + def test_apply_matrix_colour_correction_Finlayson2015(self) -> None: """ Test :func:`colour.characterisation.correction.\ apply_matrix_colour_correction_Finlayson2015` definition. @@ -1050,7 +1050,7 @@ def test_apply_matrix_colour_correction_Finlayson2015(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_apply_matrix_colour_correction_Finlayson2015(self): + def test_n_dimensional_apply_matrix_colour_correction_Finlayson2015(self) -> None: """ Test :func:`colour.characterisation.correction.\ apply_matrix_colour_correction_Finlayson2015` definition n-dimensional support. @@ -1085,7 +1085,7 @@ def test_n_dimensional_apply_matrix_colour_correction_Finlayson2015(self): @ignore_numpy_errors def test_nan_apply_matrix_colour_correction_Finlayson2015( self, - ): # pragma: no cover + ) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction. apply_matrix_colour_correction_Finlayson2015` definition nan support. @@ -1111,7 +1111,7 @@ class TestApplyMatrixColourCorrectionVandermonde: apply_matrix_colour_correction_Vandermonde` definition unit tests methods. """ - def test_apply_matrix_colour_correction_Vandermonde(self): + def test_apply_matrix_colour_correction_Vandermonde(self) -> None: """ Test :func:`colour.characterisation.correction.\ apply_matrix_colour_correction_Vandermonde` definition. @@ -1134,7 +1134,7 @@ def test_apply_matrix_colour_correction_Vandermonde(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_apply_matrix_colour_correction_Vandermonde(self): + def test_n_dimensional_apply_matrix_colour_correction_Vandermonde(self) -> None: """ Test :func:`colour.characterisation.correction.\ apply_matrix_colour_correction_Vandermonde` definition n-dimensional support. @@ -1169,7 +1169,7 @@ def test_n_dimensional_apply_matrix_colour_correction_Vandermonde(self): @ignore_numpy_errors def test_nan_apply_matrix_colour_correction_Vandermonde( self, - ): # pragma: no cover + ) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction.\ apply_matrix_colour_correction_Vandermonde` definition nan support. @@ -1195,7 +1195,7 @@ class TestColourCorrectionCheung2004: colour_correction_Cheung2004` definition unit tests methods. """ - def test_colour_correction_Cheung2004(self): + def test_colour_correction_Cheung2004(self) -> None: """ Test :func:`colour.characterisation.correction.\ colour_correction_Cheung2004` definition. @@ -1215,7 +1215,7 @@ def test_colour_correction_Cheung2004(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_colour_correction_Cheung2004(self): + def test_n_dimensional_colour_correction_Cheung2004(self) -> None: """ Test :func:`colour.characterisation.correction.\ colour_correction_Cheung2004` definition n-dimensional support. @@ -1241,7 +1241,7 @@ def test_n_dimensional_colour_correction_Cheung2004(self): ) @ignore_numpy_errors - def test_nan_colour_correction_Cheung2004(self): # pragma: no cover + def test_nan_colour_correction_Cheung2004(self) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction.\ colour_correction_Cheung2004` definition nan support. @@ -1268,7 +1268,7 @@ class TestColourCorrectionFinlayson2015: colour_correction_Finlayson2015` definition unit tests methods. """ - def test_colour_correction_Finlayson2015(self): + def test_colour_correction_Finlayson2015(self) -> None: """ Test :func:`colour.characterisation.correction.\ colour_correction_Finlayson2015` definition. @@ -1290,7 +1290,7 @@ def test_colour_correction_Finlayson2015(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_colour_correction_Finlayson2015(self): + def test_n_dimensional_colour_correction_Finlayson2015(self) -> None: """ Test :func:`colour.characterisation.correction.\ colour_correction_Finlayson2015` definition n-dimensional support. @@ -1316,7 +1316,7 @@ def test_n_dimensional_colour_correction_Finlayson2015(self): ) @ignore_numpy_errors - def test_nan_colour_correction_Finlayson2015(self): # pragma: no cover + def test_nan_colour_correction_Finlayson2015(self) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction. colour_correction_Finlayson2015` definition nan support. @@ -1343,7 +1343,7 @@ class TestColourCorrectionVandermonde: colour_correction_Vandermonde` definition unit tests methods. """ - def test_colour_correction_Vandermonde(self): + def test_colour_correction_Vandermonde(self) -> None: """ Test :func:`colour.characterisation.correction.\ colour_correction_Vandermonde` definition. @@ -1363,7 +1363,7 @@ def test_colour_correction_Vandermonde(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_colour_correction_Vandermonde(self): + def test_n_dimensional_colour_correction_Vandermonde(self) -> None: """ Test :func:`colour.characterisation.correction.\ colour_correction_Vandermonde` definition n-dimensional support. @@ -1389,7 +1389,7 @@ def test_n_dimensional_colour_correction_Vandermonde(self): ) @ignore_numpy_errors - def test_nan_colour_correction_Vandermonde(self): # pragma: no cover + def test_nan_colour_correction_Vandermonde(self) -> None: # pragma: no cover """ Test :func:`colour.characterisation.correction.\ colour_correction_Vandermonde` definition nan support. diff --git a/colour/colorimetry/cmfs.py b/colour/colorimetry/cmfs.py index 5c37c5296..dc3ba3471 100644 --- a/colour/colorimetry/cmfs.py +++ b/colour/colorimetry/cmfs.py @@ -16,6 +16,8 @@ from __future__ import annotations +from collections.abc import KeysView, ValuesView + from colour.colorimetry import ( MultiSpectralDistributions, SpectralDistribution, @@ -105,9 +107,10 @@ def __init__( | Series | Signal | SpectralDistribution + | ValuesView | None ) = None, - domain: ArrayLike | SpectralShape | None = None, + domain: ArrayLike | SpectralShape | KeysView | None = None, labels: Sequence | None = None, # noqa: ARG002 **kwargs: Any, ) -> None: @@ -172,9 +175,10 @@ def __init__( | Series | Signal | SpectralDistribution + | ValuesView | None ) = None, - domain: ArrayLike | SpectralShape | None = None, + domain: ArrayLike | SpectralShape | KeysView | None = None, labels: Sequence | None = None, # noqa: ARG002 **kwargs: Any, ) -> None: @@ -240,9 +244,10 @@ def __init__( | Series | Signal | SpectralDistribution + | ValuesView | None ) = None, - domain: ArrayLike | SpectralShape | None = None, + domain: ArrayLike | SpectralShape | KeysView | None = None, labels: Sequence | None = None, # noqa: ARG002 **kwargs: Any, ) -> None: diff --git a/colour/colorimetry/spectrum.py b/colour/colorimetry/spectrum.py index e217b7dde..5337bcbea 100644 --- a/colour/colorimetry/spectrum.py +++ b/colour/colorimetry/spectrum.py @@ -27,7 +27,7 @@ from __future__ import annotations -from collections.abc import Mapping +from collections.abc import KeysView, Mapping, ValuesView import numpy as np @@ -175,7 +175,7 @@ def start(self) -> Real: return self._start @start.setter - def start(self, value: Real): + def start(self, value: Real) -> None: """Setter for the **self.start** property.""" attest( @@ -209,7 +209,7 @@ def end(self) -> Real: return self._end @end.setter - def end(self, value: Real): + def end(self, value: Real) -> None: """Setter for the **self.end** property.""" attest( @@ -243,7 +243,7 @@ def interval(self) -> Real: return self._interval @interval.setter - def interval(self, value: Real): + def interval(self, value: Real) -> None: """Setter for the **self.interval** property.""" attest( @@ -272,7 +272,7 @@ def boundaries(self) -> tuple: return self._start, self._end @boundaries.setter - def boundaries(self, value: ArrayLike): + def boundaries(self, value: ArrayLike) -> None: """Setter for the **self.boundaries** property.""" value = np.asarray(value) @@ -673,8 +673,8 @@ class SpectralDistribution(Signal): def __init__( self, - data: ArrayLike | dict | Series | Signal | None = None, - domain: ArrayLike | SpectralShape | None = None, + data: ArrayLike | dict | Series | Signal | ValuesView | None = None, + domain: ArrayLike | SpectralShape | KeysView | None = None, **kwargs: Any, ) -> None: domain = domain.wavelengths if isinstance(domain, SpectralShape) else domain @@ -708,8 +708,11 @@ def __init__( self.register_callback("_domain", "on_domain_changed", self._on_domain_changed) @staticmethod - def _on_domain_changed(sd, name: str, value: NDArrayFloat) -> NDArrayFloat: + def _on_domain_changed( + sd: SpectralDistribution, name: str, value: NDArrayFloat + ) -> NDArrayFloat: """Invalidate *sd._shape* when *sd._domain* is changed.""" + if name == "_domain": sd._shape = None @@ -734,7 +737,7 @@ def display_name(self) -> str: return self._display_name @display_name.setter - def display_name(self, value: str): + def display_name(self, value: str) -> None: """Setter for the **self.display_name** property.""" attest( @@ -765,7 +768,7 @@ def wavelengths(self) -> NDArrayFloat: return self.domain @wavelengths.setter - def wavelengths(self, value: ArrayLike): + def wavelengths(self, value: ArrayLike) -> None: """Setter for the **self.wavelengths** property.""" self.domain = as_float_array(value, self.dtype) @@ -789,7 +792,7 @@ def values(self) -> NDArrayFloat: return self.range @values.setter - def values(self, value: ArrayLike): + def values(self, value: ArrayLike) -> None: """Setter for the **self.values** property.""" self.range = as_float_array(value, self.dtype) @@ -1789,9 +1792,10 @@ def __init__( | Series | Signal | SpectralDistribution + | ValuesView | None ) = None, - domain: ArrayLike | SpectralShape | None = None, + domain: ArrayLike | SpectralShape | KeysView | None = None, labels: Sequence | None = None, **kwargs: Any, ) -> None: @@ -1842,7 +1846,7 @@ def display_name(self) -> str: return self._display_name @display_name.setter - def display_name(self, value: str): + def display_name(self, value: str) -> None: """Setter for the **self.display_name** property.""" attest( @@ -1872,7 +1876,7 @@ def display_labels(self) -> List[str]: return self._display_labels @display_labels.setter - def display_labels(self, value: Sequence): + def display_labels(self, value: Sequence) -> None: """Setter for the **self.display_labels** property.""" attest( @@ -1916,7 +1920,7 @@ def wavelengths(self) -> NDArrayFloat: return self.domain @wavelengths.setter - def wavelengths(self, value: ArrayLike): + def wavelengths(self, value: ArrayLike) -> None: """Setter for the **self.wavelengths** property.""" self.domain = as_float_array(value, self.dtype) @@ -1941,7 +1945,7 @@ def values(self) -> NDArrayFloat: return self.range @values.setter - def values(self, value: ArrayLike): + def values(self, value: ArrayLike) -> None: """Setter for the **self.values** property.""" self.range = as_float_array(value, self.dtype) @@ -2772,6 +2776,7 @@ def sds_and_msds_to_sds( Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), ) -> List[SpectralDistribution]: """ @@ -2835,6 +2840,7 @@ def sds_and_msds_to_msds( Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), ) -> MultiSpectralDistributions: """ diff --git a/colour/colorimetry/tests/test_blackbody.py b/colour/colorimetry/tests/test_blackbody.py index c4512c7e2..c0928f44e 100644 --- a/colour/colorimetry/tests/test_blackbody.py +++ b/colour/colorimetry/tests/test_blackbody.py @@ -1202,7 +1202,7 @@ class TestPlanckLaw: tests methods. """ - def test_planck_law(self): + def test_planck_law(self) -> None: """Test :func:`colour.colorimetry.blackbody.planck_law` definition.""" wavelengths = 2 ** np.arange(0, 16, 1) * 1e-9 @@ -1213,7 +1213,7 @@ def test_planck_law(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_planck_law(self): + def test_n_dimensional_planck_law(self) -> None: """ Test :func:`colour.colorimetry.blackbody.planck_law` definition n-dimensional arrays support. @@ -1260,7 +1260,7 @@ def test_n_dimensional_planck_law(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_planck_law(self): + def test_raise_exception_planck_law(self) -> None: """ Test :func:`colour.colorimetry.blackbody.planck_law` definition raised exception. @@ -1270,7 +1270,7 @@ def test_raise_exception_planck_law(self): pytest.raises(AssertionError, planck_law, wavelength, 5500) @ignore_numpy_errors - def test_nan_planck_law(self): + def test_nan_planck_law(self) -> None: """ Test :func:`colour.colorimetry.blackbody.planck_law` definition nan support. @@ -1288,7 +1288,7 @@ class TestSdBlackbody: tests methods. """ - def test_sd_blackbody(self): + def test_sd_blackbody(self) -> None: """Test :func:`colour.colorimetry.blackbody.sd_blackbody` definition.""" np.testing.assert_allclose( @@ -1304,7 +1304,7 @@ class TestRayleighJeansLaw: tests methods. """ - def test_rayleigh_jeans_law(self): + def test_rayleigh_jeans_law(self) -> None: """ Test :func:`colour.colorimetry.blackbody.rayleigh_jeans_law` definition. @@ -1318,7 +1318,7 @@ def test_rayleigh_jeans_law(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_rayleigh_jeans_law(self): + def test_n_dimensional_rayleigh_jeans_law(self) -> None: """ Test :func:`colour.colorimetry.blackbody.rayleigh_jeans_law` definition n-dimensional arrays support. @@ -1366,7 +1366,7 @@ def test_n_dimensional_rayleigh_jeans_law(self): ) @ignore_numpy_errors - def test_nan_rayleigh_jeans_law(self): + def test_nan_rayleigh_jeans_law(self) -> None: """ Test :func:`colour.colorimetry.blackbody.rayleigh_jeans_law` definition nan support. @@ -1383,7 +1383,7 @@ class TestSdRayleighJeans: tests methods. """ - def test_sd_rayleigh_jeans(self): + def test_sd_rayleigh_jeans(self) -> None: """ Test :func:`colour.colorimetry.blackbody.sd_rayleigh_jeans` definition. diff --git a/colour/colorimetry/tests/test_correction.py b/colour/colorimetry/tests/test_correction.py index 030961ae1..c46c5d7cf 100644 --- a/colour/colorimetry/tests/test_correction.py +++ b/colour/colorimetry/tests/test_correction.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.correction` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry import ( @@ -66,7 +68,7 @@ class TestBandpassCorrectionStearns1988: bandpass_correction_Stearns1988` definition unit tests methods. """ - def test_bandpass_correction_Stearns1988(self): + def test_bandpass_correction_Stearns1988(self) -> None: """ Test :func:`colour.colorimetry.correction.\ bandpass_correction_Stearns1988` definition. diff --git a/colour/colorimetry/tests/test_dominant.py b/colour/colorimetry/tests/test_dominant.py index ab3a5aade..7f7f92a1b 100644 --- a/colour/colorimetry/tests/test_dominant.py +++ b/colour/colorimetry/tests/test_dominant.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.dominant` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -41,14 +43,14 @@ class TestClosestSpectralLocusWavelength: closest_spectral_locus_wavelength` definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._xy_s = XYZ_to_xy(MSDS_CMFS["CIE 1931 2 Degree Standard Observer"].values) self._xy_D65 = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"] - def test_closest_spectral_locus_wavelength(self): + def test_closest_spectral_locus_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.\ closest_spectral_locus_wavelength` definition. @@ -75,7 +77,7 @@ def test_closest_spectral_locus_wavelength(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_closest_spectral_locus_wavelength(self): + def test_n_dimensional_closest_spectral_locus_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.\ closest_spectral_locus_wavelength` definition n-dimensional arrays support. @@ -105,7 +107,7 @@ def test_n_dimensional_closest_spectral_locus_wavelength(self): np.testing.assert_allclose(xy_wl, xy_wl_r, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_closest_spectral_locus_wavelength(self): + def test_nan_closest_spectral_locus_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.\ closest_spectral_locus_wavelength` definition nan support. @@ -123,12 +125,12 @@ class TestDominantWavelength: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._xy_D65 = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"] - def test_dominant_wavelength(self): + def test_dominant_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.dominant_wavelength` definition. @@ -165,7 +167,7 @@ def test_dominant_wavelength(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_dominant_wavelength(self): + def test_n_dimensional_dominant_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.dominant_wavelength` definition n-dimensional arrays support. @@ -204,7 +206,7 @@ def test_n_dimensional_dominant_wavelength(self): np.testing.assert_allclose(xy_cwl, xy_cwl_r, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_dominant_wavelength(self): + def test_nan_dominant_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.dominant_wavelength` definition nan support. @@ -222,12 +224,12 @@ class TestComplementaryWavelength: definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._xy_D65 = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"] - def test_complementary_wavelength(self): + def test_complementary_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.complementary_wavelength` definition. @@ -264,7 +266,7 @@ def test_complementary_wavelength(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_complementary_wavelength(self): + def test_n_dimensional_complementary_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.complementary_wavelength` definition n-dimensional arrays support. @@ -303,7 +305,7 @@ def test_n_dimensional_complementary_wavelength(self): np.testing.assert_allclose(xy_cwl, xy_cwl_r, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_complementary_wavelength(self): + def test_nan_complementary_wavelength(self) -> None: """ Test :func:`colour.colorimetry.dominant.complementary_wavelength` definition nan support. @@ -321,12 +323,12 @@ class TestExcitationPurity: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._xy_D65 = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"] - def test_excitation_purity(self): + def test_excitation_purity(self) -> None: """Test :func:`colour.colorimetry.dominant.excitation_purity` definition.""" xy = np.array([0.54369557, 0.32107944]) @@ -345,7 +347,7 @@ def test_excitation_purity(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_excitation_purity(self): + def test_n_dimensional_excitation_purity(self) -> None: """ Test :func:`colour.colorimetry.dominant.excitation_purity` definition n-dimensional arrays support. @@ -370,7 +372,7 @@ def test_n_dimensional_excitation_purity(self): ) @ignore_numpy_errors - def test_nan_excitation_purity(self): + def test_nan_excitation_purity(self) -> None: """ Test :func:`colour.colorimetry.dominant.excitation_purity` definition nan support. @@ -388,12 +390,12 @@ class TestColorimetricPurity: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._xy_D65 = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"] - def test_colorimetric_purity(self): + def test_colorimetric_purity(self) -> None: """ Test :func:`colour.colorimetry.dominant.colorimetric_purity` definition. @@ -415,7 +417,7 @@ def test_colorimetric_purity(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_colorimetric_purity(self): + def test_n_dimensional_colorimetric_purity(self) -> None: """ Test :func:`colour.colorimetry.dominant.colorimetric_purity` definition n-dimensional arrays support. @@ -440,7 +442,7 @@ def test_n_dimensional_colorimetric_purity(self): ) @ignore_numpy_errors - def test_nan_colorimetric_purity(self): + def test_nan_colorimetric_purity(self) -> None: """ Test :func:`colour.colorimetry.dominant.colorimetric_purity` definition nan support. diff --git a/colour/colorimetry/tests/test_generation.py b/colour/colorimetry/tests/test_generation.py index eda46d104..bdbc62a17 100644 --- a/colour/colorimetry/tests/test_generation.py +++ b/colour/colorimetry/tests/test_generation.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.generation` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry.generation import ( @@ -43,7 +45,7 @@ class TestSdConstant: tests methods. """ - def test_sd_constant(self): + def test_sd_constant(self) -> None: """Test :func:`colour.colorimetry.generation.sd_constant` definition.""" sd = sd_constant(np.pi) @@ -61,7 +63,7 @@ class TestSdZeros: tests methods. """ - def test_sd_zeros(self): + def test_sd_zeros(self) -> None: """ Test :func:`colour.colorimetry.generation.sd_zeros` definition. @@ -82,7 +84,7 @@ class TestSdOnes: tests methods. """ - def test_sd_ones(self): + def test_sd_ones(self) -> None: """Test :func:`colour.colorimetry.generation.sd_ones` definition.""" sd = sd_ones() @@ -100,7 +102,7 @@ class TestMsdsConstant: tests methods. """ - def test_msds_constant(self): + def test_msds_constant(self) -> None: """Test :func:`colour.colorimetry.generation.msds_constant` definition.""" msds = msds_constant(np.pi, labels=["a", "b", "c"]) @@ -130,7 +132,7 @@ class TestMsdsZeros: tests methods. """ - def test_msds_zeros(self): + def test_msds_zeros(self) -> None: """ Test :func:`colour.colorimetry.generation.msds_zeros` definition. @@ -151,7 +153,7 @@ class TestMsdsOnes: tests methods. """ - def test_msds_ones(self): + def test_msds_ones(self) -> None: """Test :func:`colour.colorimetry.generation.msds_ones` definition.""" msds = msds_ones(labels=["a", "b", "c"]) @@ -169,7 +171,7 @@ class TestSdGaussianNormal: definition unit tests methods. """ - def test_sd_gaussian_normal(self): + def test_sd_gaussian_normal(self) -> None: """ Test :func:`colour.colorimetry.generation.sd_gaussian_normal` definition. @@ -194,7 +196,7 @@ class TestSdGaussianFwhm: unit tests methods. """ - def test_sd_gaussian_fwhm(self): + def test_sd_gaussian_fwhm(self) -> None: """ Test :func:`colour.colorimetry.generation.sd_gaussian_fwhm` definition. """ @@ -218,7 +220,7 @@ class TestSdSingleLedOhno2005: definition unit tests methods. """ - def test_sd_single_led_Ohno2005(self): + def test_sd_single_led_Ohno2005(self) -> None: """ Test :func:`colour.colorimetry.generation.sd_single_led_Ohno2005` definition. @@ -243,7 +245,7 @@ class TestSdMultiLedsOhno2005: definition unit tests methods. """ - def test_sd_multi_leds_Ohno2005(self): + def test_sd_multi_leds_Ohno2005(self) -> None: """ Test :func:`colour.colorimetry.generation.sd_multi_leds_Ohno2005` definition. diff --git a/colour/colorimetry/tests/test_illuminants.py b/colour/colorimetry/tests/test_illuminants.py index 5facff02f..a0e41735c 100644 --- a/colour/colorimetry/tests/test_illuminants.py +++ b/colour/colorimetry/tests/test_illuminants.py @@ -137,7 +137,7 @@ class TestSdCIEStandardIlluminantA: sd_CIE_standard_illuminant_A` definition unit tests methods. """ - def test_sd_CIE_standard_illuminant_A(self): + def test_sd_CIE_standard_illuminant_A(self) -> None: """ Test :func:`colour.colorimetry.illuminants.\ sd_CIE_standard_illuminant_A` definition. @@ -156,7 +156,7 @@ class TestSdCIEIlluminantDSeries: definition unit tests methods. """ - def test_sd_CIE_illuminant_D_series(self): + def test_sd_CIE_illuminant_D_series(self) -> None: """ Test :func:`colour.colorimetry.illuminants.\ sd_CIE_illuminant_D_series` definition. @@ -186,7 +186,7 @@ class TestDaylightLocusFunction: definition unit tests methods. """ - def test_daylight_locus_function(self): + def test_daylight_locus_function(self) -> None: """ Test :func:`colour.colorimetry.illuminants.daylight_locus_function` definition. @@ -210,7 +210,7 @@ def test_daylight_locus_function(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_daylight_locus_function(self): + def test_n_dimensional_daylight_locus_function(self) -> None: """ Test :func:`colour.colorimetry.illuminants.daylight_locus_function` definition n-dimensional support. @@ -232,7 +232,7 @@ def test_n_dimensional_daylight_locus_function(self): ) @ignore_numpy_errors - def test_nan_daylight_locus_function(self): + def test_nan_daylight_locus_function(self) -> None: """ Test :func:`colour.colorimetry.illuminants.daylight_locus_function` definition nan support. diff --git a/colour/colorimetry/tests/test_lefs.py b/colour/colorimetry/tests/test_lefs.py index 987eb1b9c..9345cbd72 100644 --- a/colour/colorimetry/tests/test_lefs.py +++ b/colour/colorimetry/tests/test_lefs.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.lefs` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry import ( @@ -433,7 +435,7 @@ class TestMesopicWeightingFunction: definition unit tests methods. """ - def test_mesopic_weighting_function(self): + def test_mesopic_weighting_function(self) -> None: """ Test :func:`colour.colorimetry.lefs.mesopic_weighting_function` definition. @@ -457,7 +459,7 @@ def test_mesopic_weighting_function(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_mesopic_weighting_function(self): + def test_n_dimensional_mesopic_weighting_function(self) -> None: """ Test :func:`colour.colorimetry.lefs.mesopic_weighting_function` definition n-dimensional arrays support. @@ -491,7 +493,7 @@ def test_n_dimensional_mesopic_weighting_function(self): ) @ignore_numpy_errors - def test_nan_mesopic_weighting_function(self): + def test_nan_mesopic_weighting_function(self) -> None: """ Test :func:`colour.colorimetry.lefs.mesopic_weighting_function` definition nan support. @@ -510,7 +512,7 @@ class TestSdMesopicLuminousEfficiencyFunction: sd_mesopic_luminous_efficiency_function` definition unit tests methods. """ - def test_sd_mesopic_luminous_efficiency_function(self): + def test_sd_mesopic_luminous_efficiency_function(self) -> None: """ Test :func:`colour.colorimetry.lefs.\ sd_mesopic_luminous_efficiency_function` definition. diff --git a/colour/colorimetry/tests/test_lightness.py b/colour/colorimetry/tests/test_lightness.py index 907ab7977..0449a6220 100644 --- a/colour/colorimetry/tests/test_lightness.py +++ b/colour/colorimetry/tests/test_lightness.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.lightness` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry import ( @@ -40,7 +42,7 @@ class TestLightnessGlasser1958: definition unit tests methods. """ - def test_lightness_Glasser1958(self): + def test_lightness_Glasser1958(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition. @@ -64,7 +66,7 @@ def test_lightness_Glasser1958(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_lightness_Glasser1958(self): + def test_n_dimensional_lightness_Glasser1958(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition n-dimensional arrays support. @@ -91,7 +93,7 @@ def test_n_dimensional_lightness_Glasser1958(self): lightness_Glasser1958(Y), L, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_lightness_Glasser1958(self): + def test_domain_range_scale_lightness_Glasser1958(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition domain and range scale support. @@ -109,7 +111,7 @@ def test_domain_range_scale_lightness_Glasser1958(self): ) @ignore_numpy_errors - def test_nan_lightness_Glasser1958(self): + def test_nan_lightness_Glasser1958(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Glasser1958` definition nan support. @@ -124,7 +126,7 @@ class TestLightnessWyszecki1963: definition unit tests methods. """ - def test_lightness_Wyszecki1963(self): + def test_lightness_Wyszecki1963(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Wyszecki1963` definition. @@ -148,7 +150,7 @@ def test_lightness_Wyszecki1963(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_lightness_Wyszecki1963(self): + def test_n_dimensional_lightness_Wyszecki1963(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Wyszecki1963` definition n-dimensional arrays support. @@ -175,7 +177,7 @@ def test_n_dimensional_lightness_Wyszecki1963(self): lightness_Wyszecki1963(Y), W, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_lightness_Wyszecki1963(self): + def test_domain_range_scale_lightness_Wyszecki1963(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Wyszecki1963` definition domain and range scale support. @@ -193,7 +195,7 @@ def test_domain_range_scale_lightness_Wyszecki1963(self): ) @ignore_numpy_errors - def test_nan_lightness_Wyszecki1963(self): + def test_nan_lightness_Wyszecki1963(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Wyszecki1963` definition nan support. @@ -208,7 +210,7 @@ class TestIntermediateLightnessFunctionCIE1976: intermediate_lightness_function_CIE1976` definition unit tests methods. """ - def test_intermediate_lightness_function_CIE1976(self): + def test_intermediate_lightness_function_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.lightness.\ intermediate_lightness_function_CIE1976` definition. @@ -232,7 +234,7 @@ def test_intermediate_lightness_function_CIE1976(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_intermediate_lightness_function_CIE1976(self): + def test_n_dimensional_intermediate_lightness_function_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.lightness.\ intermediate_lightness_function_CIE1976` definition n-dimensional arrays @@ -266,7 +268,7 @@ def test_n_dimensional_intermediate_lightness_function_CIE1976(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_intermediate_lightness_function_CIE1976(self): + def test_domain_range_scale_intermediate_lightness_function_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.lightness.\ intermediate_lightness_function_CIE1976` definition domain and range scale @@ -284,7 +286,7 @@ def test_domain_range_scale_intermediate_lightness_function_CIE1976(self): ) @ignore_numpy_errors - def test_nan_intermediate_lightness_function_CIE1976(self): + def test_nan_intermediate_lightness_function_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.lightness.\ intermediate_lightness_function_CIE1976` definition nan support. @@ -301,7 +303,7 @@ class TestLightnessCIE1976: unit tests methods. """ - def test_lightness_CIE1976(self): + def test_lightness_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_CIE1976` definition. @@ -343,7 +345,7 @@ def test_lightness_CIE1976(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_lightness_CIE1976(self): + def test_n_dimensional_lightness_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_CIE1976` definition n-dimensional arrays support. @@ -370,7 +372,7 @@ def test_n_dimensional_lightness_CIE1976(self): lightness_CIE1976(Y), L_star, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_lightness_CIE1976(self): + def test_domain_range_scale_lightness_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_CIE1976` definition domain and range scale support. @@ -388,7 +390,7 @@ def test_domain_range_scale_lightness_CIE1976(self): ) @ignore_numpy_errors - def test_nan_lightness_CIE1976(self): + def test_nan_lightness_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_CIE1976` definition nan support. @@ -403,7 +405,7 @@ class TestLightnessFairchild2010: definition unit tests methods. """ - def test_lightness_Fairchild2010(self): + def test_lightness_Fairchild2010(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Fairchild2010` definition. @@ -445,7 +447,7 @@ def test_lightness_Fairchild2010(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_lightness_Fairchild2010(self): + def test_n_dimensional_lightness_Fairchild2010(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Fairchild2010` definition n-dimensional arrays support. @@ -472,7 +474,7 @@ def test_n_dimensional_lightness_Fairchild2010(self): lightness_Fairchild2010(Y), L_hdr, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_lightness_Fairchild2010(self): + def test_domain_range_scale_lightness_Fairchild2010(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Fairchild2010` definition domain and range scale support. @@ -490,7 +492,7 @@ def test_domain_range_scale_lightness_Fairchild2010(self): ) @ignore_numpy_errors - def test_nan_lightness_Fairchild2010(self): + def test_nan_lightness_Fairchild2010(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Fairchild2010` definition nan support. @@ -505,7 +507,7 @@ class TestLightnessFairchild2011: definition unit tests methods. """ - def test_lightness_Fairchild2011(self): + def test_lightness_Fairchild2011(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Fairchild2011` definition. @@ -547,7 +549,7 @@ def test_lightness_Fairchild2011(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_lightness_Fairchild2011(self): + def test_n_dimensional_lightness_Fairchild2011(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Fairchild2011` definition n-dimensional arrays support. @@ -574,7 +576,7 @@ def test_n_dimensional_lightness_Fairchild2011(self): lightness_Fairchild2011(Y), L_hdr, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_lightness_Fairchild2011(self): + def test_domain_range_scale_lightness_Fairchild2011(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Fairchild2011` definition domain and range scale support. @@ -592,7 +594,7 @@ def test_domain_range_scale_lightness_Fairchild2011(self): ) @ignore_numpy_errors - def test_nan_lightness_Fairchild2011(self): + def test_nan_lightness_Fairchild2011(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Fairchild2011` definition nan support. @@ -607,7 +609,7 @@ class TestLightnessAbebe2017: definition unit tests methods. """ - def test_lightness_Abebe2017(self): + def test_lightness_Abebe2017(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Abebe2017` definition. @@ -643,7 +645,7 @@ def test_lightness_Abebe2017(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_lightness_Abebe2017(self): + def test_n_dimensional_lightness_Abebe2017(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Abebe2017` definition n-dimensional arrays support. @@ -670,7 +672,7 @@ def test_n_dimensional_lightness_Abebe2017(self): lightness_Abebe2017(Y), L, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_lightness_Abebe2017(self): + def test_domain_range_scale_lightness_Abebe2017(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Abebe2017` definition domain and range scale support. @@ -688,13 +690,14 @@ def test_domain_range_scale_lightness_Abebe2017(self): ) @ignore_numpy_errors - def test_nan_lightness_Abebe2017(self): + def test_nan_lightness_Abebe2017(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness_Abebe2017` definition nan support. """ - lightness_Abebe2017(*[np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])] * 2) + cases = np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]) + lightness_Abebe2017(cases, cases) class TestLightness: @@ -703,7 +706,7 @@ class TestLightness: tests methods. """ - def test_domain_range_scale_lightness(self): + def test_domain_range_scale_lightness(self) -> None: """ Test :func:`colour.colorimetry.lightness.lightness` definition domain and range scale support. diff --git a/colour/colorimetry/tests/test_luminance.py b/colour/colorimetry/tests/test_luminance.py index da0a8456b..4bb9b03e4 100644 --- a/colour/colorimetry/tests/test_luminance.py +++ b/colour/colorimetry/tests/test_luminance.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.luminance` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry import ( @@ -40,7 +42,7 @@ class TestLuminanceNewhall1943: definition unit tests methods. """ - def test_luminance_Newhall1943(self): + def test_luminance_Newhall1943(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Newhall1943` definition. @@ -64,7 +66,7 @@ def test_luminance_Newhall1943(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_luminance_Newhall1943(self): + def test_n_dimensional_luminance_Newhall1943(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Newhall1943` definition n-dimensional arrays support. @@ -91,7 +93,7 @@ def test_n_dimensional_luminance_Newhall1943(self): luminance_Newhall1943(V), Y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_luminance_Newhall1943(self): + def test_domain_range_scale_luminance_Newhall1943(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Newhall1943` definition domain and range scale support. @@ -109,7 +111,7 @@ def test_domain_range_scale_luminance_Newhall1943(self): ) @ignore_numpy_errors - def test_nan_luminance_Newhall1943(self): + def test_nan_luminance_Newhall1943(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Newhall1943` definition nan support. @@ -124,7 +126,7 @@ class TestLuminanceASTMD1535: definition unit tests methods. """ - def test_luminance_ASTMD1535(self): + def test_luminance_ASTMD1535(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition. @@ -148,7 +150,7 @@ def test_luminance_ASTMD1535(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_luminance_ASTMD1535(self): + def test_n_dimensional_luminance_ASTMD1535(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition n-dimensional arrays support. @@ -175,7 +177,7 @@ def test_n_dimensional_luminance_ASTMD1535(self): luminance_ASTMD1535(V), Y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_luminance_ASTMD1535(self): + def test_domain_range_scale_luminance_ASTMD1535(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition domain and range scale support. @@ -193,7 +195,7 @@ def test_domain_range_scale_luminance_ASTMD1535(self): ) @ignore_numpy_errors - def test_nan_luminance_ASTMD1535(self): + def test_nan_luminance_ASTMD1535(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_ASTMD1535` definition nan support. @@ -208,7 +210,7 @@ class TestIntermediateLuminanceFunctionCIE1976: intermediate_luminance_function_CIE1976` definition unit tests methods. """ - def test_intermediate_luminance_function_CIE1976(self): + def test_intermediate_luminance_function_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.luminance.\ intermediate_luminance_function_CIE1976` definition. @@ -232,7 +234,7 @@ def test_intermediate_luminance_function_CIE1976(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_intermediate_luminance_function_CIE1976(self): + def test_n_dimensional_intermediate_luminance_function_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.luminance.\ intermediate_luminance_function_CIE1976` definition n-dimensional arrays @@ -266,7 +268,7 @@ def test_n_dimensional_intermediate_luminance_function_CIE1976(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_intermediate_luminance_function_CIE1976(self): + def test_domain_range_scale_intermediate_luminance_function_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.luminance.\ intermediate_luminance_function_CIE1976` definition domain and range scale @@ -284,7 +286,7 @@ def test_domain_range_scale_intermediate_luminance_function_CIE1976(self): ) @ignore_numpy_errors - def test_nan_intermediate_luminance_function_CIE1976(self): + def test_nan_intermediate_luminance_function_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.luminance.\ intermediate_luminance_function_CIE1976` definition nan support. @@ -301,7 +303,7 @@ class TestLuminanceCIE1976: unit tests methods. """ - def test_luminance_CIE1976(self): + def test_luminance_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_CIE1976` definition. @@ -343,7 +345,7 @@ def test_luminance_CIE1976(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_luminance_CIE1976(self): + def test_n_dimensional_luminance_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_CIE1976` definition n-dimensional arrays support. @@ -370,7 +372,7 @@ def test_n_dimensional_luminance_CIE1976(self): luminance_CIE1976(L_star), Y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_luminance_CIE1976(self): + def test_domain_range_scale_luminance_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_CIE1976` definition domain and range scale support. @@ -388,7 +390,7 @@ def test_domain_range_scale_luminance_CIE1976(self): ) @ignore_numpy_errors - def test_nan_luminance_CIE1976(self): + def test_nan_luminance_CIE1976(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_CIE1976` definition nan support. @@ -403,7 +405,7 @@ class TestLuminanceFairchild2010: definition unit tests methods. """ - def test_luminance_Fairchild2010(self): + def test_luminance_Fairchild2010(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Fairchild2010` definition. @@ -445,7 +447,7 @@ def test_luminance_Fairchild2010(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_luminance_Fairchild2010(self): + def test_n_dimensional_luminance_Fairchild2010(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Fairchild2010` definition n-dimensional arrays support. @@ -472,7 +474,7 @@ def test_n_dimensional_luminance_Fairchild2010(self): luminance_Fairchild2010(L_hdr), Y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_luminance_Fairchild2010(self): + def test_domain_range_scale_luminance_Fairchild2010(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Fairchild2010` definition domain and range scale support. @@ -490,7 +492,7 @@ def test_domain_range_scale_luminance_Fairchild2010(self): ) @ignore_numpy_errors - def test_nan_luminance_Fairchild2010(self): + def test_nan_luminance_Fairchild2010(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Fairchild2010` definition nan support. @@ -505,7 +507,7 @@ class TestLuminanceFairchild2011: definition unit tests methods. """ - def test_luminance_Fairchild2011(self): + def test_luminance_Fairchild2011(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Fairchild2011` definition. @@ -547,7 +549,7 @@ def test_luminance_Fairchild2011(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_luminance_Fairchild2011(self): + def test_n_dimensional_luminance_Fairchild2011(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Fairchild2011` definition n-dimensional arrays support. @@ -574,7 +576,7 @@ def test_n_dimensional_luminance_Fairchild2011(self): luminance_Fairchild2011(L_hdr), Y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_luminance_Fairchild2011(self): + def test_domain_range_scale_luminance_Fairchild2011(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Fairchild2011` definition domain and range scale support. @@ -592,7 +594,7 @@ def test_domain_range_scale_luminance_Fairchild2011(self): ) @ignore_numpy_errors - def test_nan_luminance_Fairchild2011(self): + def test_nan_luminance_Fairchild2011(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Fairchild2011` definition nan support. @@ -607,7 +609,7 @@ class TestLuminanceAbebe2017: definition unit tests methods. """ - def test_luminance_Abebe2017(self): + def test_luminance_Abebe2017(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Abebe2017` definition. @@ -643,7 +645,7 @@ def test_luminance_Abebe2017(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_luminance_Abebe2017(self): + def test_n_dimensional_luminance_Abebe2017(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Abebe2017` definition n-dimensional arrays support. @@ -670,7 +672,7 @@ def test_n_dimensional_luminance_Abebe2017(self): luminance_Abebe2017(L), Y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_luminance_Abebe2017(self): + def test_domain_range_scale_luminance_Abebe2017(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Abebe2017` definition domain and range scale support. @@ -688,13 +690,14 @@ def test_domain_range_scale_luminance_Abebe2017(self): ) @ignore_numpy_errors - def test_nan_luminance_Abebe2017(self): + def test_nan_luminance_Abebe2017(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance_Abebe2017` definition nan support. """ - luminance_Abebe2017(*[np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan])] * 2) + cases = np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]) + luminance_Abebe2017(cases, cases) class TestLuminance: @@ -703,7 +706,7 @@ class TestLuminance: tests methods. """ - def test_domain_range_scale_luminance(self): + def test_domain_range_scale_luminance(self) -> None: """ Test :func:`colour.colorimetry.luminance.luminance` definition domain and range scale support. diff --git a/colour/colorimetry/tests/test_photometry.py b/colour/colorimetry/tests/test_photometry.py index c4e9abfc9..cae9fcf3f 100644 --- a/colour/colorimetry/tests/test_photometry.py +++ b/colour/colorimetry/tests/test_photometry.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.photometry` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry import ( @@ -32,7 +34,7 @@ class TestLuminousFlux: tests methods. """ - def test_luminous_flux(self): + def test_luminous_flux(self) -> None: """Test :func:`colour.colorimetry.photometry.luminous_flux` definition.""" np.testing.assert_allclose( @@ -60,7 +62,7 @@ class TestLuminousEfficiency: definition unit tests methods. """ - def test_luminous_efficiency(self): + def test_luminous_efficiency(self) -> None: """ Test :func:`colour.colorimetry.photometry.luminous_efficiency` definition. @@ -91,7 +93,7 @@ class TestLuminousEfficacy: definition unit tests methods. """ - def test_luminous_efficacy(self): + def test_luminous_efficacy(self) -> None: """ Test :func:`colour.colorimetry.photometry.luminous_efficacy` definition. diff --git a/colour/colorimetry/tests/test_spectrum.py b/colour/colorimetry/tests/test_spectrum.py index 3838a40ec..3bafe34ad 100644 --- a/colour/colorimetry/tests/test_spectrum.py +++ b/colour/colorimetry/tests/test_spectrum.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.spectrum` module.""" +from __future__ import annotations + import pickle import numpy as np @@ -1253,7 +1255,7 @@ class TestSpectralShape: methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -1267,7 +1269,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(SpectralShape) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -1286,7 +1288,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(SpectralShape) - def test_pickling(self): + def test_pickling(self) -> None: """ Test whether the :class:`colour.colorimetry.spectrum.SpectralShape` class can be pickled. @@ -1297,7 +1299,7 @@ class can be pickled. data = pickle.loads(data) # noqa: S301 assert shape == data - def test_start(self): + def test_start(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.SpectralShape.start` attribute. @@ -1309,7 +1311,7 @@ def test_start(self): pytest.raises(AssertionError, lambda: SpectralShape(360, 0, 1)) - def test_end(self): + def test_end(self) -> None: """Test :attr:`colour.colorimetry.spectrum.SpectralShape.end` property.""" assert SpectralShape(360, 830, 1).end == 830 @@ -1318,7 +1320,7 @@ def test_end(self): pytest.raises(AssertionError, lambda: SpectralShape(830, 0, 1)) - def test_interval(self): + def test_interval(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.SpectralShape.interval` property. @@ -1326,7 +1328,7 @@ def test_interval(self): assert SpectralShape(360, 830, 1).interval == 1 - def test_boundaries(self): + def test_boundaries(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.SpectralShape.boundaries` property. @@ -1338,7 +1340,7 @@ def test_boundaries(self): assert shape.start == 360 assert shape.end == 830 - def test_wavelengths(self): + def test_wavelengths(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.SpectralShape.wavelengths` property. @@ -1349,7 +1351,7 @@ def test_wavelengths(self): np.arange(0, 10 + 0.1, 0.1), ) - def test__hash__(self): + def test__hash__(self) -> None: """ Test :meth:`colour.colorimetry.spectrum.SpectralShape.__hash__` method. @@ -1357,7 +1359,7 @@ def test__hash__(self): assert isinstance(hash(SpectralShape(0, 10, 0.1)), int) - def test__iter__(self): + def test__iter__(self) -> None: """ Test :meth:`colour.colorimetry.spectrum.SpectralShape.__iter__` method. @@ -1368,7 +1370,7 @@ def test__iter__(self): np.arange(0, 10 + 0.1, 0.1), ) - def test__contains__(self): + def test__contains__(self) -> None: """ Test :meth:`colour.colorimetry.spectrum.SpectralShape.__contains__` method. @@ -1382,7 +1384,7 @@ def test__contains__(self): assert np.array([0.5, 0.61]) not in SpectralShape(0, 10, 0.1) - def test__len__(self): + def test__len__(self) -> None: """ Test :meth:`colour.colorimetry.spectrum.SpectralShape.__len__` method. @@ -1390,7 +1392,7 @@ def test__len__(self): assert len(SpectralShape(0, 10, 0.1)) == 101 - def test__eq__(self): + def test__eq__(self) -> None: """ Test :meth:`colour.colorimetry.spectrum.SpectralShape.__eq__` method. @@ -1399,7 +1401,7 @@ def test__eq__(self): assert SpectralShape(0, 10, 0.1) == SpectralShape(0, 10, 0.1) assert SpectralShape(0, 10, 0.1) != () - def test__ne__(self): + def test__ne__(self) -> None: """ Test :meth:`colour.colorimetry.spectrum.SpectralShape.__ne__` method. @@ -1407,7 +1409,7 @@ def test__ne__(self): assert SpectralShape(0, 10, 0.1) != SpectralShape(1, 10, 0.1) - def test_range(self): + def test_range(self) -> None: """Test :func:`colour.colorimetry.spectrum.SpectralShape.range` method.""" np.testing.assert_array_equal( @@ -1422,7 +1424,7 @@ class TestSpectralDistribution: class unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._sd = SpectralDistribution(DATA_SAMPLE, name="Sample") @@ -1435,7 +1437,7 @@ def setup_method(self): self._phi = (1 + np.sqrt(5)) / 2 - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -1448,7 +1450,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(SpectralDistribution) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -1463,7 +1465,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(SpectralDistribution) - def test_pickling(self): + def test_pickling(self) -> None: """ Test whether the :class:`colour.colorimetry.spectrum.\ SpectralDistribution` class can be pickled. @@ -1473,7 +1475,7 @@ def test_pickling(self): data = pickle.loads(data) # noqa: S301 assert self._sd == data - def test_display_name(self): + def test_display_name(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.SpectralDistribution.display_name` property. @@ -1482,7 +1484,7 @@ def test_display_name(self): assert self._sd.display_name == "Sample" assert self._non_uniform_sd.display_name == "Display Non Uniform Sample" - def test_wavelengths(self): + def test_wavelengths(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.SpectralDistribution.wavelengths` property. @@ -1494,7 +1496,7 @@ def test_wavelengths(self): sd.wavelengths = sd.wavelengths + 10 np.testing.assert_array_equal(sd.wavelengths, sd.domain) - def test_values(self): + def test_values(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.SpectralDistribution.values` property. @@ -1506,7 +1508,7 @@ def test_values(self): sd.values = sd.values + 10 np.testing.assert_array_equal(sd.values, sd.range) - def test_shape(self): + def test_shape(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.SpectralDistribution.shape` property. @@ -1514,7 +1516,7 @@ def test_shape(self): assert self._sd.shape == SpectralShape(340, 820, 20) - def test__init__(self): + def test__init__(self) -> None: """ Test :meth:`colour.colorimetry.spectrum.SpectralDistribution.__init__` method. @@ -1529,7 +1531,7 @@ def test__init__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_interpolate(self): + def test_interpolate(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ SpectralDistribution.interpolate` method. @@ -1559,7 +1561,7 @@ def test_interpolate(self): 1, ) - def test_extrapolate(self): + def test_extrapolate(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ SpectralDistribution.extrapolate` method. @@ -1590,7 +1592,7 @@ def test_extrapolate(self): sd[50], 2.4999999999999964, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_align(self): + def test_align(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ SpectralDistribution.align` method. @@ -1602,7 +1604,7 @@ def test_align(self): shape = SpectralShape(600, 650, 1) assert self._sd.copy().align(shape).shape == shape - def test_trim(self): + def test_trim(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ SpectralDistribution.trim` method. @@ -1614,7 +1616,7 @@ def test_trim(self): shape = SpectralShape(200, 900, 1) assert self._sd.copy().trim(shape).shape == self._sd.shape - def test_normalise(self): + def test_normalise(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ SpectralDistribution.normalise` method. @@ -1626,7 +1628,7 @@ def test_normalise(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_callback_on_domain_changed(self): + def test_callback_on_domain_changed(self) -> None: """ Test :class:`colour.colorimetry.spectrum.\ SpectralDistribution` *on_domain_changed* callback. @@ -1644,7 +1646,7 @@ class TestMultiSpectralDistributions: class unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._labels = ("x_bar", "y_bar", "z_bar") @@ -1684,7 +1686,7 @@ def setup_method(self): self._phi = (1 + np.sqrt(5)) / 2 - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -1698,7 +1700,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(MultiSpectralDistributions) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -1714,7 +1716,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(MultiSpectralDistributions) - def test_pickling(self): + def test_pickling(self) -> None: """ Test whether the :class:`colour.colorimetry.spectrum.\ MultiSpectralDistributions` class can be pickled. @@ -1724,7 +1726,7 @@ def test_pickling(self): data = pickle.loads(data) # noqa: S301 assert self._msds == data - def test_display_name(self): + def test_display_name(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.MultiSpectralDistributions.display_name` property. @@ -1736,7 +1738,7 @@ def test_display_name(self): == "Display Non Uniform Sample Observer" ) - def test_wavelengths(self): + def test_wavelengths(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.MultiSpectralDistributions.wavelengths` property. @@ -1748,7 +1750,7 @@ def test_wavelengths(self): msds.wavelengths = msds.wavelengths + 10 np.testing.assert_array_equal(msds.wavelengths, msds.domain) - def test_values(self): + def test_values(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.MultiSpectralDistributions.values` property. @@ -1760,7 +1762,7 @@ def test_values(self): msds.values = msds.values + 10 np.testing.assert_array_equal(msds.values, msds.range) - def test_display_labels(self): + def test_display_labels(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.MultiSpectralDistributions.\ display_labels` property. @@ -1773,7 +1775,7 @@ def test_display_labels(self): "Display z_bar", ) - def test_shape(self): + def test_shape(self) -> None: """ Test :attr:`colour.colorimetry.spectrum.MultiSpectralDistributions.shape` property. @@ -1781,7 +1783,7 @@ def test_shape(self): assert self._msds.shape == SpectralShape(380, 780, 5) - def test__init__(self): + def test__init__(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ MultiSpectralDistributions.__init__` method. @@ -1796,7 +1798,7 @@ def test__init__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_interpolate(self): + def test_interpolate(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ MultiSpectralDistributions.interpolate` method. @@ -1808,7 +1810,7 @@ def test_interpolate(self): msds = reshape_msds(self._sample_msds, shape, "Interpolate") for signal in msds.signals.values(): np.testing.assert_allclose( - signal.values, + signal.values, # pyright: ignore DATA_SAMPLE_INTERPOLATED, atol=TOLERANCE_ABSOLUTE_TESTS, ) @@ -1826,7 +1828,7 @@ def test_interpolate(self): ) for signal in msds.signals.values(): np.testing.assert_allclose( - signal.values, + signal.values, # pyright: ignore DATA_SAMPLE_INTERPOLATED_NON_UNIFORM, atol=TOLERANCE_ABSOLUTE_TESTS, ) @@ -1836,7 +1838,7 @@ def test_interpolate(self): 1, ) - def test_extrapolate(self): + def test_extrapolate(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ MultiSpectralDistributions.extrapolate` method. @@ -1873,7 +1875,7 @@ def test_extrapolate(self): msds[50], np.array([2.5, 2.5, 2.5]), atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_align(self): + def test_align(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ MultiSpectralDistributions.align` method. @@ -1887,7 +1889,7 @@ def test_align(self): shape = SpectralShape(600, 650, 1) assert msds.align(shape).shape == shape - def test_trim(self): + def test_trim(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ MultiSpectralDistributions.trim` method. @@ -1899,7 +1901,7 @@ def test_trim(self): shape = SpectralShape(200, 900, 1) assert self._msds.copy().trim(shape).shape == self._msds.shape - def test_normalise(self): + def test_normalise(self) -> None: """ Test :func:`colour.colorimetry.spectrum. MultiSpectralDistributions.normalise` method. @@ -1911,7 +1913,7 @@ def test_normalise(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_to_sds(self): + def test_to_sds(self) -> None: """ Test :func:`colour.colorimetry.spectrum.\ MultiSpectralDistributions.to_sds` method. @@ -1924,7 +1926,7 @@ def test_to_sds(self): assert sd.name == self._labels[i] assert sd.display_name == self._display_labels[i] - def test_callback_on_domain_changed(self): + def test_callback_on_domain_changed(self) -> None: """ Test underlying :class:`colour.colorimetry.spectrum.\ SpectralDistribution` *on_domain_changed* callback when used with @@ -1943,7 +1945,7 @@ class TestReshapeSd: tests methods. """ - def test_reshape_sd(self): + def test_reshape_sd(self) -> None: """Test :func:`colour.colorimetry.spectrum.reshape_sd` definition.""" sd = SpectralDistribution(DATA_SAMPLE_ABRIDGED) @@ -1997,7 +1999,7 @@ class TestSdsAndMdsToSds: unit tests methods. """ - def test_sds_and_msds_to_sds(self): + def test_sds_and_msds_to_sds(self) -> None: """ Test :func:`colour.colorimetry.spectrum.sds_and_msds_to_sds` definition. @@ -2032,7 +2034,7 @@ class TestSdsAndMsdsToMsds: definition unit tests methods. """ - def test_sds_and_msds_to_msds(self): + def test_sds_and_msds_to_msds(self) -> None: """ Test :func:`colour.colorimetry.spectrum.sds_and_msds_to_msds` definition. diff --git a/colour/colorimetry/tests/test_transformations.py b/colour/colorimetry/tests/test_transformations.py index d8d3ce38d..99292f6c2 100644 --- a/colour/colorimetry/tests/test_transformations.py +++ b/colour/colorimetry/tests/test_transformations.py @@ -3,6 +3,8 @@ module. """ +from __future__ import annotations + import numpy as np from colour.colorimetry import ( @@ -38,7 +40,7 @@ class TestRGB_2_degree_cmfs_to_XYZ_2_degree_cmfs: RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition unit tests methods. """ - def test_RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): + def test_RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition. @@ -57,7 +59,7 @@ def test_RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(700), cmfs[700], atol=0.0025 ) - def test_n_dimensional_RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): + def test_n_dimensional_RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition n-dimensional arrays @@ -92,7 +94,7 @@ def test_n_dimensional_RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): ) @ignore_numpy_errors - def test_nan_RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): + def test_nan_RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition nan support. @@ -109,7 +111,7 @@ class TestRGB_10_degree_cmfs_to_XYZ_10_degree_cmfs: RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs` definition unit tests methods. """ - def test_RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): + def test_RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs` definition. @@ -134,7 +136,7 @@ def test_RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): atol=0.025, ) - def test_n_dimensional_RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): + def test_n_dimensional_RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs` definition n-dimensional arrays @@ -169,7 +171,7 @@ def test_n_dimensional_RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): ) @ignore_numpy_errors - def test_nan_RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): + def test_nan_RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_10_degree_cmfs_to_XYZ_10_degree_cmfs` definition nan support. @@ -186,7 +188,7 @@ class TestRGB_10_degree_cmfs_to_LMS_10_degree_cmfs: RGB_10_degree_cmfs_to_LMS_10_degree_cmfs` definition unit tests methods. """ - def test_RGB_10_degree_cmfs_to_LMS_10_degree_cmfs(self): + def test_RGB_10_degree_cmfs_to_LMS_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_10_degree_cmfs_to_LMS_10_degree_cmfs` definition. @@ -211,7 +213,7 @@ def test_RGB_10_degree_cmfs_to_LMS_10_degree_cmfs(self): atol=0.0025, ) - def test_n_dimensional_RGB_10_degree_cmfs_to_LMS_10_degree_cmfs(self): + def test_n_dimensional_RGB_10_degree_cmfs_to_LMS_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_10_degree_cmfs_to_LMS_10_degree_cmfs` definition n-dimensional arrays @@ -246,7 +248,7 @@ def test_n_dimensional_RGB_10_degree_cmfs_to_LMS_10_degree_cmfs(self): ) @ignore_numpy_errors - def test_nan_RGB_10_degree_cmfs_to_LMS_10_degree_cmfs(self): + def test_nan_RGB_10_degree_cmfs_to_LMS_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ RGB_10_degree_cmfs_to_LMS_10_degree_cmfs` definition nan support. @@ -263,7 +265,7 @@ class TestLMS_2_degree_cmfs_to_XYZ_2_degree_cmfs: LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition unit tests methods. """ - def test_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): + def test_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition. @@ -288,7 +290,7 @@ def test_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): atol=0.00015, ) - def test_n_dimensional_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): + def test_n_dimensional_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition n-dimensional arrays @@ -323,7 +325,7 @@ def test_n_dimensional_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): ) @ignore_numpy_errors - def test_nan_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self): + def test_nan_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition nan support. @@ -340,7 +342,7 @@ class TestLMS_10_degree_cmfs_to_XYZ_10_degree_cmfs: LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs` definition unit tests methods. """ - def test_LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): + def test_LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs` definition. @@ -365,7 +367,7 @@ def test_LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): atol=0.00015, ) - def test_n_dimensional_LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): + def test_n_dimensional_LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs` definition n-dimensional arrays @@ -400,7 +402,7 @@ def test_n_dimensional_LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): ) @ignore_numpy_errors - def test_nan_LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs(self): + def test_nan_LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs(self) -> None: """ Test :func:`colour.colorimetry.transformations.\ LMS_10_degree_cmfs_to_XYZ_10_degree_cmfs` definition nan support. diff --git a/colour/colorimetry/tests/test_tristimulus_values.py b/colour/colorimetry/tests/test_tristimulus_values.py index 61ad451b1..7dda05dca 100644 --- a/colour/colorimetry/tests/test_tristimulus_values.py +++ b/colour/colorimetry/tests/test_tristimulus_values.py @@ -584,7 +584,7 @@ class TestHandleSpectralArguments: handle_spectral_arguments` definition unit tests methods. """ - def test_handle_spectral_arguments(self): + def test_handle_spectral_arguments(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ handle_spectral_arguments` definition. @@ -616,7 +616,7 @@ class TestLagrangeCoefficientsASTME2022: lagrange_coefficients_ASTME2022` definition unit tests methods. """ - def test_lagrange_coefficients_ASTME2022(self): + def test_lagrange_coefficients_ASTME2022(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ lagrange_coefficients_ASTME2022` definition. @@ -658,7 +658,7 @@ class TestTristimulusWeightingFactorsASTME2022: tristimulus_weighting_factors_ASTME2022` definition unit tests methods. """ - def test_tristimulus_weighting_factors_ASTME2022(self): + def test_tristimulus_weighting_factors_ASTME2022(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ tristimulus_weighting_factors_ASTME2022` definition. @@ -729,7 +729,7 @@ def test_tristimulus_weighting_factors_ASTME2022(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_tristimulus_weighting_factors_ASTME2022(self): + def test_raise_exception_tristimulus_weighting_factors_ASTME2022(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ tristimulus_weighting_factors_ASTME2022` definition raised exception. @@ -764,7 +764,7 @@ class TestAdjustTristimulusWeightingFactorsASTME308: adjust_tristimulus_weighting_factors_ASTME308` definition unit tests methods. """ - def test_adjust_tristimulus_weighting_factors_ASTME308(self): + def test_adjust_tristimulus_weighting_factors_ASTME308(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ adjust_tristimulus_weighting_factors_ASTME308` definition. @@ -787,7 +787,7 @@ class TestSd_to_XYZ_integration: definition unit tests methods. """ - def test_sd_to_XYZ_integration(self): + def test_sd_to_XYZ_integration(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ sd_to_XYZ_integration` definition. @@ -841,7 +841,7 @@ def test_sd_to_XYZ_integration(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_sd_to_XYZ_integration(self): + def test_domain_range_scale_sd_to_XYZ_integration(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ sd_to_XYZ_integration` definition domain and range scale support. @@ -867,7 +867,7 @@ class TestSd_to_XYZ_tristimulus_weighting_factors_ASTME308: definition unit tests methods. """ - def test_sd_to_XYZ_tristimulus_weighting_factors_ASTME308(self): + def test_sd_to_XYZ_tristimulus_weighting_factors_ASTME308(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ sd_to_XYZ_tristimulus_weighting_factors_ASTME308` @@ -941,7 +941,7 @@ def test_sd_to_XYZ_tristimulus_weighting_factors_ASTME308(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_sd_to_XYZ_twf_ASTME308(self): + def test_domain_range_scale_sd_to_XYZ_twf_ASTME308(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ sd_to_XYZ_tristimulus_weighting_factors_ASTME308` definition domain and @@ -971,14 +971,14 @@ class TestSd_to_XYZ_ASTME308: definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._sd = SD_SAMPLE.copy() self._cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"] self._A = sd_CIE_standard_illuminant_A(self._cmfs.shape) - def test_sd_to_XYZ_ASTME308_mi_1nm(self): + def test_sd_to_XYZ_ASTME308_mi_1nm(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.sd_to_XYZ_ASTME308` definition for 1 nm measurement intervals. @@ -1035,7 +1035,7 @@ def test_sd_to_XYZ_ASTME308_mi_1nm(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_sd_to_XYZ_ASTME308_mi_5nm(self): + def test_sd_to_XYZ_ASTME308_mi_5nm(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.sd_to_XYZ_ASTME308` definition for 5 nm measurement intervals. @@ -1140,7 +1140,7 @@ def test_sd_to_XYZ_ASTME308_mi_5nm(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_sd_to_XYZ_ASTME308_mi_10nm(self): + def test_sd_to_XYZ_ASTME308_mi_10nm(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.sd_to_XYZ_ASTME308` definition for 10 nm measurement intervals. @@ -1210,7 +1210,7 @@ def test_sd_to_XYZ_ASTME308_mi_10nm(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_sd_to_XYZ_ASTME308_mi_20nm(self): + def test_sd_to_XYZ_ASTME308_mi_20nm(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.sd_to_XYZ_ASTME308` definition for 20 nm measurement intervals. @@ -1325,7 +1325,7 @@ def test_sd_to_XYZ_ASTME308_mi_20nm(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_sd_to_XYZ_ASTME308(self): + def test_raise_exception_sd_to_XYZ_ASTME308(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.sd_to_XYZ_ASTME308` definition raised exception. @@ -1344,14 +1344,14 @@ class TestSd_to_XYZ: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._cmfs = MSDS_CMFS["CIE 1931 2 Degree Standard Observer"] self._A = sd_CIE_standard_illuminant_A(self._cmfs.shape) self._sd = reshape_sd(SD_SAMPLE, self._cmfs.shape) - def test_sd_to_XYZ(self): + def test_sd_to_XYZ(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.sd_to_XYZ` definition. @@ -1428,7 +1428,7 @@ class TestMsds_to_XYZ_integration: msds_to_XYZ_integration` definition unit tests methods. """ - def test_msds_to_XYZ_integration(self): + def test_msds_to_XYZ_integration(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ msds_to_XYZ_integration` definition. @@ -1464,7 +1464,7 @@ def test_msds_to_XYZ_integration(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_msds_to_XYZ_integration(self): + def test_domain_range_scale_msds_to_XYZ_integration(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ msds_to_XYZ_integration` definition domain and range scale support. @@ -1492,7 +1492,7 @@ class TestMsds_to_XYZ_ASTME308: definition unit tests methods. """ - def test_msds_to_XYZ_ASTME308(self): + def test_msds_to_XYZ_ASTME308(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ msds_to_XYZ_ASTME308` definition. @@ -1512,7 +1512,7 @@ def test_msds_to_XYZ_ASTME308(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_msds_to_XYZ_ASTME308(self): + def test_domain_range_scale_msds_to_XYZ_ASTME308(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ msds_to_XYZ_ASTME308` definition domain and range scale support. @@ -1532,7 +1532,7 @@ def test_domain_range_scale_msds_to_XYZ_ASTME308(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_msds_to_XYZ_ASTME308(self): + def test_raise_exception_msds_to_XYZ_ASTME308(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.\ msds_to_XYZ_ASTME308` definition raise exception. @@ -1546,7 +1546,7 @@ class TestAbsoluteIntegrationToXYZ: Test the absolute integration to tristimulus values for :math:`k = 683` """ - def test_absolute_integration_to_TVS_1nm(self): + def test_absolute_integration_to_TVS_1nm(self) -> None: """ Test the absolute, i.e., user given :math:`k` value, integration to tristimulus values for 1nm interval. @@ -1592,7 +1592,7 @@ def test_absolute_integration_to_TVS_1nm(self): ), ) - def test_absolute_integration_to_TVS_5nm(self): + def test_absolute_integration_to_TVS_5nm(self) -> None: """ Test the absolute, i.e., user given :math:`k` value, integration to tristimulus values for 5nm interval by ensuring that the *Riemann Sum* @@ -1648,7 +1648,7 @@ class TestWavelength_to_XYZ: definition unit tests methods. """ - def test_wavelength_to_XYZ(self): + def test_wavelength_to_XYZ(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.wavelength_to_XYZ` definition. @@ -1672,7 +1672,7 @@ def test_wavelength_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_wavelength_to_XYZ(self): + def test_raise_exception_wavelength_to_XYZ(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.wavelength_to_XYZ` definition raised exception. @@ -1682,7 +1682,7 @@ def test_raise_exception_wavelength_to_XYZ(self): pytest.raises(ValueError, wavelength_to_XYZ, 1000) - def test_n_dimensional_wavelength_to_XYZ(self): + def test_n_dimensional_wavelength_to_XYZ(self) -> None: """ Test :func:`colour.colorimetry.tristimulus_values.wavelength_to_XYZ` definition n-dimensional arrays support. diff --git a/colour/colorimetry/tests/test_uniformity.py b/colour/colorimetry/tests/test_uniformity.py index e9bd5ea19..7384d35af 100644 --- a/colour/colorimetry/tests/test_uniformity.py +++ b/colour/colorimetry/tests/test_uniformity.py @@ -227,7 +227,7 @@ class TestSpectralUniformity: definition unit tests methods. """ - def test_spectral_uniformity(self): + def test_spectral_uniformity(self) -> None: """ Test :func:`colour.colorimetry.uniformity.spectral_uniformity` definition. diff --git a/colour/colorimetry/tests/test_whiteness.py b/colour/colorimetry/tests/test_whiteness.py index df51083ad..a6e86d9aa 100644 --- a/colour/colorimetry/tests/test_whiteness.py +++ b/colour/colorimetry/tests/test_whiteness.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.whiteness` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -40,7 +42,7 @@ class TestWhitenessBerger1959: definition unit tests methods. """ - def test_whiteness_Berger1959(self): + def test_whiteness_Berger1959(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Berger1959` definition. @@ -73,7 +75,7 @@ def test_whiteness_Berger1959(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_whiteness_Berger1959(self): + def test_n_dimensional_whiteness_Berger1959(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Berger1959` definition n_dimensional arrays support. @@ -97,7 +99,7 @@ def test_n_dimensional_whiteness_Berger1959(self): whiteness_Berger1959(XYZ, XYZ_0), W, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_whiteness_Berger1959(self): + def test_domain_range_scale_whiteness_Berger1959(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Berger1959` definition domain and range scale support. @@ -117,7 +119,7 @@ def test_domain_range_scale_whiteness_Berger1959(self): ) @ignore_numpy_errors - def test_nan_whiteness_Berger1959(self): + def test_nan_whiteness_Berger1959(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Berger1959` definition nan support. @@ -134,7 +136,7 @@ class TestWhitenessTaube1960: definition unit tests methods. """ - def test_whiteness_Taube1960(self): + def test_whiteness_Taube1960(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Taube1960` definition. @@ -167,7 +169,7 @@ def test_whiteness_Taube1960(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_whiteness_Taube1960(self): + def test_n_dimensional_whiteness_Taube1960(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Taube1960` definition n_dimensional arrays support. @@ -191,7 +193,7 @@ def test_n_dimensional_whiteness_Taube1960(self): whiteness_Taube1960(XYZ, XYZ_0), WI, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_whiteness_Taube1960(self): + def test_domain_range_scale_whiteness_Taube1960(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Taube1960` definition domain and range scale support. @@ -211,7 +213,7 @@ def test_domain_range_scale_whiteness_Taube1960(self): ) @ignore_numpy_errors - def test_nan_whiteness_Berger1959(self): + def test_nan_whiteness_Berger1959(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Berger1959` definition nan support. @@ -228,7 +230,7 @@ class TestWhitenessStensby1968: definition unit tests methods. """ - def test_whiteness_Stensby1968(self): + def test_whiteness_Stensby1968(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Stensby1968` definition. @@ -252,7 +254,7 @@ def test_whiteness_Stensby1968(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_whiteness_Stensby1968(self): + def test_n_dimensional_whiteness_Stensby1968(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Stensby1968` definition n_dimensional arrays support. @@ -273,7 +275,7 @@ def test_n_dimensional_whiteness_Stensby1968(self): whiteness_Stensby1968(Lab), WI, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_whiteness_Stensby1968(self): + def test_domain_range_scale_whiteness_Stensby1968(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Stensby1968` definition domain and range scale support. @@ -292,7 +294,7 @@ def test_domain_range_scale_whiteness_Stensby1968(self): ) @ignore_numpy_errors - def test_nan_whiteness_Stensby1968(self): + def test_nan_whiteness_Stensby1968(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Stensby1968` definition nan support. @@ -309,7 +311,7 @@ class TestWhitenessASTM313: definition unit tests methods. """ - def test_whiteness_ASTME313(self): + def test_whiteness_ASTME313(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_ASTME313` definition. @@ -333,7 +335,7 @@ def test_whiteness_ASTME313(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_whiteness_ASTME313(self): + def test_n_dimensional_whiteness_ASTME313(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_ASTME313` definition n_dimensional arrays support. @@ -354,7 +356,7 @@ def test_n_dimensional_whiteness_ASTME313(self): whiteness_ASTME313(XYZ), WI, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_whiteness_ASTME313(self): + def test_domain_range_scale_whiteness_ASTME313(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_ASTME313` definition domain and range scale support. @@ -373,7 +375,7 @@ def test_domain_range_scale_whiteness_ASTME313(self): ) @ignore_numpy_errors - def test_nan_whiteness_ASTME313(self): + def test_nan_whiteness_ASTME313(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_ASTME313` definition nan support. @@ -390,7 +392,7 @@ class TestWhitenessGanz1979: definition unit tests methods. """ - def test_whiteness_Ganz1979(self): + def test_whiteness_Ganz1979(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Ganz1979` definition. @@ -414,7 +416,7 @@ def test_whiteness_Ganz1979(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_whiteness_Ganz1979(self): + def test_n_dimensional_whiteness_Ganz1979(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Ganz1979` definition n_dimensional arrays support. @@ -442,7 +444,7 @@ def test_n_dimensional_whiteness_Ganz1979(self): whiteness_Ganz1979(xy, Y), WT, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_whiteness_Ganz1979(self): + def test_domain_range_scale_whiteness_Ganz1979(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Ganz1979` definition domain and range scale support. @@ -462,7 +464,7 @@ def test_domain_range_scale_whiteness_Ganz1979(self): ) @ignore_numpy_errors - def test_nan_whiteness_Ganz1979(self): + def test_nan_whiteness_Ganz1979(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_Ganz1979` definition nan support. @@ -479,7 +481,7 @@ class TestWhitenessCIE2004: definition unit tests methods. """ - def test_whiteness_CIE2004(self): + def test_whiteness_CIE2004(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_CIE2004` definition. @@ -509,7 +511,7 @@ def test_whiteness_CIE2004(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_whiteness_CIE2004(self): + def test_n_dimensional_whiteness_CIE2004(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_CIE2004` definition n_dimensional arrays support. @@ -540,7 +542,7 @@ def test_n_dimensional_whiteness_CIE2004(self): whiteness_CIE2004(xy, Y, xy_n), WT, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_whiteness_CIE2004(self): + def test_domain_range_scale_whiteness_CIE2004(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_CIE2004` definition domain and range scale support. @@ -561,7 +563,7 @@ def test_domain_range_scale_whiteness_CIE2004(self): ) @ignore_numpy_errors - def test_nan_whiteness_CIE2004(self): + def test_nan_whiteness_CIE2004(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness_CIE2004` definition nan support. @@ -578,7 +580,7 @@ class TestWhiteness: tests methods. """ - def test_domain_range_scale_whiteness(self): + def test_domain_range_scale_whiteness(self) -> None: """ Test :func:`colour.colorimetry.whiteness.whiteness` definition domain and range scale support. diff --git a/colour/colorimetry/tests/test_yellowness.py b/colour/colorimetry/tests/test_yellowness.py index e3f15b06b..fce52f93f 100644 --- a/colour/colorimetry/tests/test_yellowness.py +++ b/colour/colorimetry/tests/test_yellowness.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.colorimetry.yellowness` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -37,7 +39,7 @@ class TestYellownessASTMD1925: definition unit tests methods. """ - def test_yellowness_ASTMD1925(self): + def test_yellowness_ASTMD1925(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` definition. @@ -61,7 +63,7 @@ def test_yellowness_ASTMD1925(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_yellowness_ASTMD1925(self): + def test_n_dimensional_yellowness_ASTMD1925(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` definition n_dimensional arrays support. @@ -82,7 +84,7 @@ def test_n_dimensional_yellowness_ASTMD1925(self): yellowness_ASTMD1925(XYZ), YI, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_yellowness_ASTMD1925(self): + def test_domain_range_scale_yellowness_ASTMD1925(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` definition domain and range scale support. @@ -101,7 +103,7 @@ def test_domain_range_scale_yellowness_ASTMD1925(self): ) @ignore_numpy_errors - def test_nan_yellowness_ASTMD1925(self): + def test_nan_yellowness_ASTMD1925(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925` definition nan support. @@ -118,7 +120,7 @@ class TestYellownessASTM313Alternative: yellowness_ASTME313_alternative` definition unit tests methods. """ - def test_yellowness_ASTME313_alternative(self): + def test_yellowness_ASTME313_alternative(self) -> None: """ Test :func:`colour.colorimetry.yellowness.\ yellowness_ASTME313_alternative` definition. @@ -148,7 +150,7 @@ def test_yellowness_ASTME313_alternative(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_yellowness_ASTME313_alternative(self): + def test_n_dimensional_yellowness_ASTME313_alternative(self) -> None: """ Test :func:`colour.colorimetry.yellowness.\ yellowness_ASTME313_alternative` definition n_dimensional arrays support. @@ -173,7 +175,7 @@ def test_n_dimensional_yellowness_ASTME313_alternative(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_yellowness_ASTME313_alternative(self): + def test_domain_range_scale_yellowness_ASTME313_alternative(self) -> None: """ Test :func:`colour.colorimetry.yellowness.\ yellowness_ASTME313_alternative` definition domain and range scale support. @@ -192,7 +194,7 @@ def test_domain_range_scale_yellowness_ASTME313_alternative(self): ) @ignore_numpy_errors - def test_nan_yellowness_ASTME313_alternative(self): + def test_nan_yellowness_ASTME313_alternative(self) -> None: """ Test :func:`colour.colorimetry.yellowness.\ yellowness_ASTME313_alternative` definition nan support. @@ -209,7 +211,7 @@ class TestYellownessASTM313: definition unit tests methods. """ - def test_yellowness_ASTME313(self): + def test_yellowness_ASTME313(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313` definition. @@ -244,7 +246,7 @@ def test_yellowness_ASTME313(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_yellowness_ASTME313(self): + def test_n_dimensional_yellowness_ASTME313(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313` definition n_dimensional arrays support. @@ -265,7 +267,7 @@ def test_n_dimensional_yellowness_ASTME313(self): yellowness_ASTME313(XYZ), YI, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_yellowness_ASTME313(self): + def test_domain_range_scale_yellowness_ASTME313(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313` definition domain and range scale support. @@ -284,7 +286,7 @@ def test_domain_range_scale_yellowness_ASTME313(self): ) @ignore_numpy_errors - def test_nan_yellowness_ASTME313(self): + def test_nan_yellowness_ASTME313(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313` definition nan support. @@ -301,7 +303,7 @@ class TestYellowness: tests methods. """ - def test_domain_range_scale_yellowness(self): + def test_domain_range_scale_yellowness(self) -> None: """ Test :func:`colour.colorimetry.yellowness.yellowness` definition domain and range scale support. diff --git a/colour/colorimetry/uniformity.py b/colour/colorimetry/uniformity.py index 25c75f141..b6b959881 100644 --- a/colour/colorimetry/uniformity.py +++ b/colour/colorimetry/uniformity.py @@ -15,6 +15,8 @@ from __future__ import annotations +from collections.abc import ValuesView + import numpy as np from colour.colorimetry import ( @@ -41,6 +43,7 @@ def spectral_uniformity( Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), use_second_order_derivatives: bool = False, ) -> NDArrayFloat: diff --git a/colour/continuous/abstract.py b/colour/continuous/abstract.py index 6787edc3c..962564bfe 100644 --- a/colour/continuous/abstract.py +++ b/colour/continuous/abstract.py @@ -143,7 +143,7 @@ def name(self) -> str: return self._name @name.setter - def name(self, value: str): + def name(self, value: str) -> None: """Setter for the **self.name** property.""" attest( @@ -175,7 +175,7 @@ def dtype(self) -> Type[DTypeFloat]: @dtype.setter @abstractmethod - def dtype(self, value: Type[DTypeFloat]): + def dtype(self, value: Type[DTypeFloat]) -> None: """ Setter for the **self.dtype** property, must be reimplemented by sub-classes. @@ -207,7 +207,7 @@ def domain(self) -> NDArrayFloat: @domain.setter @abstractmethod - def domain(self, value: ArrayLike): + def domain(self, value: ArrayLike) -> None: """ Setter for the **self.domain** property, must be reimplemented by sub-classes. @@ -240,7 +240,7 @@ def range(self) -> NDArrayFloat: @range.setter @abstractmethod - def range(self, value: ArrayLike): + def range(self, value: ArrayLike) -> None: """ Setter for the **self.range** property, must be reimplemented by sub-classes. @@ -271,7 +271,7 @@ def interpolator(self) -> Type[ProtocolInterpolator]: @interpolator.setter @abstractmethod - def interpolator(self, value: Type[ProtocolInterpolator]): + def interpolator(self, value: Type[ProtocolInterpolator]) -> None: """ Setter for the **self.interpolator** property, must be reimplemented by sub-classes. @@ -304,7 +304,7 @@ def interpolator_kwargs(self) -> dict: @interpolator_kwargs.setter @abstractmethod - def interpolator_kwargs(self, value: dict): + def interpolator_kwargs(self, value: dict) -> None: """ Setter for the **self.interpolator_kwargs** property, must be reimplemented by sub-classes. @@ -335,7 +335,7 @@ def extrapolator(self) -> Type[ProtocolExtrapolator]: @extrapolator.setter @abstractmethod - def extrapolator(self, value: Type[ProtocolExtrapolator]): + def extrapolator(self, value: Type[ProtocolExtrapolator]) -> None: """ Setter for the **self.extrapolator** property, must be reimplemented by sub-classes. @@ -368,7 +368,7 @@ def extrapolator_kwargs(self) -> dict: @extrapolator_kwargs.setter @abstractmethod - def extrapolator_kwargs(self, value: dict): + def extrapolator_kwargs(self, value: dict) -> None: """ Setter for the **self.extrapolator_kwargs** property, must be reimplemented by sub-classes. @@ -452,7 +452,7 @@ def __getitem__(self, x: ArrayLike | slice) -> NDArrayFloat: ... # pragma: no cover @abstractmethod - def __setitem__(self, x: ArrayLike | slice, y: ArrayLike): + def __setitem__(self, x: ArrayLike | slice, y: ArrayLike) -> None: """ Set the corresponding range variable :math:`y` for independent domain variable :math:`x`, must be reimplemented by sub-classes. diff --git a/colour/continuous/multi_signals.py b/colour/continuous/multi_signals.py index 1eb92f496..0f3f7d95f 100644 --- a/colour/continuous/multi_signals.py +++ b/colour/continuous/multi_signals.py @@ -9,7 +9,7 @@ from __future__ import annotations -from collections.abc import Iterator, Mapping, ValuesView +from collections.abc import Iterator, KeysView, Mapping, ValuesView import numpy as np @@ -300,9 +300,17 @@ class MultiSignals(AbstractContinuousFunction): def __init__( self, data: ( - ArrayLike | DataFrame | dict | Self | Sequence | Series | Signal | None + ArrayLike + | DataFrame + | dict + | Self + | Sequence + | Series + | Signal + | ValuesView + | None ) = None, - domain: ArrayLike | None = None, + domain: ArrayLike | KeysView | None = None, labels: Sequence | None = None, **kwargs: Any, ) -> None: @@ -333,7 +341,7 @@ def dtype(self) -> Type[DTypeFloat]: return first_item(self._signals.values()).dtype @dtype.setter - def dtype(self, value: Type[DTypeFloat]): + def dtype(self, value: Type[DTypeFloat]) -> None: """Setter for the **self.dtype** property.""" for signal in self._signals.values(): @@ -361,7 +369,7 @@ def domain(self) -> NDArrayFloat: return first_item(self._signals.values()).domain @domain.setter - def domain(self, value: ArrayLike): + def domain(self, value: ArrayLike) -> None: """Setter for the **self.domain** property.""" for signal in self._signals.values(): @@ -389,7 +397,7 @@ def range(self) -> NDArrayFloat: return tstack([signal.range for signal in self._signals.values()]) @range.setter - def range(self, value: ArrayLike): + def range(self, value: ArrayLike) -> None: """Setter for the **self.range** property.""" value = as_float_array(value) @@ -429,7 +437,7 @@ def interpolator(self) -> Type[ProtocolInterpolator]: return first_item(self._signals.values()).interpolator @interpolator.setter - def interpolator(self, value: Type[ProtocolInterpolator]): + def interpolator(self, value: Type[ProtocolInterpolator]) -> None: """Setter for the **self.interpolator** property.""" if value is not None: @@ -458,7 +466,7 @@ def interpolator_kwargs(self) -> dict: return first_item(self._signals.values()).interpolator_kwargs @interpolator_kwargs.setter - def interpolator_kwargs(self, value: dict): + def interpolator_kwargs(self, value: dict) -> None: """Setter for the **self.interpolator_kwargs** property.""" for signal in self._signals.values(): @@ -486,7 +494,7 @@ def extrapolator(self) -> Type[ProtocolExtrapolator]: return first_item(self._signals.values()).extrapolator @extrapolator.setter - def extrapolator(self, value: Type[ProtocolExtrapolator]): + def extrapolator(self, value: Type[ProtocolExtrapolator]) -> None: """Setter for the **self.extrapolator** property.""" for signal in self._signals.values(): @@ -514,7 +522,7 @@ def extrapolator_kwargs(self) -> dict: return first_item(self._signals.values()).extrapolator_kwargs @extrapolator_kwargs.setter - def extrapolator_kwargs(self, value: dict): + def extrapolator_kwargs(self, value: dict) -> None: """Setter for the **self.extrapolator_kwargs** property.""" for signal in self._signals.values(): @@ -557,7 +565,7 @@ def signals(self) -> Dict[str, Signal]: def signals( self, value: ArrayLike | DataFrame | dict | Self | Series | Signal | None, - ): + ) -> None: """Setter for the **self.signals** property.""" self._signals = self.multi_signals_unpack_data( @@ -585,7 +593,7 @@ def labels(self) -> List[str]: return [str(key) for key in self._signals] @labels.setter - def labels(self, value: Sequence): + def labels(self, value: Sequence) -> None: """Setter for the **self.labels** property.""" attest( @@ -800,7 +808,7 @@ def __getitem__(self, x: ArrayLike | slice) -> NDArrayFloat: return values[..., x_c] # pyright: ignore - def __setitem__(self, x: ArrayLike | slice, y: ArrayLike): + def __setitem__(self, x: ArrayLike | slice, y: ArrayLike) -> None: """ Set the corresponding range variable :math:`y` for independent domain variable :math:`x`. @@ -1207,9 +1215,10 @@ def multi_signals_unpack_data( | Sequence | Series | Signal + | ValuesView | None ) = None, - domain: ArrayLike | None = None, + domain: ArrayLike | KeysView | None = None, labels: Sequence | None = None, dtype: Type[DTypeFloat] | None = None, signal_type: Type[Signal] = Signal, @@ -1477,7 +1486,7 @@ def multi_signals_unpack_data( if isinstance(data, Series): signals["0"] = signal_type(data, **settings) elif isinstance(data, DataFrame): - domain_unpacked = cast(NDArrayFloat, data.index.values) + domain_unpacked = as_float_array(data.index.values, dtype) # pyright: ignore signals = { label: signal_type( data[label], @@ -1488,6 +1497,9 @@ def multi_signals_unpack_data( } if domain is not None: + if isinstance(domain, KeysView): + domain = list(domain) + domain_array = as_float_array(domain, dtype) for signal in signals.values(): diff --git a/colour/continuous/signal.py b/colour/continuous/signal.py index e176643f2..5340b8c79 100644 --- a/colour/continuous/signal.py +++ b/colour/continuous/signal.py @@ -9,7 +9,7 @@ from __future__ import annotations -from collections.abc import Iterator, Mapping, Sequence, ValuesView +from collections.abc import Iterator, KeysView, Mapping, Sequence, ValuesView from operator import pow # noqa: A004 from operator import ( add, @@ -242,8 +242,8 @@ class Signal(AbstractContinuousFunction): def __init__( self, - data: ArrayLike | dict | Self | Series | None = None, - domain: ArrayLike | None = None, + data: ArrayLike | dict | Self | Series | ValuesView | None = None, + domain: ArrayLike | KeysView | None = None, **kwargs: Any, ) -> None: super().__init__(kwargs.get("name")) @@ -294,7 +294,7 @@ def dtype(self) -> Type[DTypeFloat]: return self._dtype @dtype.setter - def dtype(self, value: Type[DTypeFloat]): + def dtype(self, value: Type[DTypeFloat]) -> None: """Setter for the **self.dtype** property.""" attest( @@ -331,7 +331,7 @@ def domain(self) -> NDArrayFloat: return ndarray_copy(self._domain) @domain.setter - def domain(self, value: ArrayLike): + def domain(self, value: ArrayLike) -> None: """Setter for the **self.domain** property.""" value = as_float_array(value, self.dtype) @@ -374,7 +374,7 @@ def range(self) -> NDArrayFloat: return ndarray_copy(self._range) @range.setter - def range(self, value: ArrayLike): + def range(self, value: ArrayLike) -> None: """Setter for the **self.range** property.""" value = as_float_array(value, self.dtype) @@ -414,7 +414,7 @@ def interpolator(self) -> Type[ProtocolInterpolator]: return self._interpolator @interpolator.setter - def interpolator(self, value: Type[ProtocolInterpolator]): + def interpolator(self, value: Type[ProtocolInterpolator]) -> None: """Setter for the **self.interpolator** property.""" # TODO: Check for interpolator compatibility. @@ -443,7 +443,7 @@ def interpolator_kwargs(self) -> dict: return self._interpolator_kwargs @interpolator_kwargs.setter - def interpolator_kwargs(self, value: dict): + def interpolator_kwargs(self, value: dict) -> None: """Setter for the **self.interpolator_kwargs** property.""" attest( @@ -474,7 +474,7 @@ def extrapolator(self) -> Type[ProtocolExtrapolator]: return self._extrapolator @extrapolator.setter - def extrapolator(self, value: Type[ProtocolExtrapolator]): + def extrapolator(self, value: Type[ProtocolExtrapolator]) -> None: """Setter for the **self.extrapolator** property.""" # TODO: Check for extrapolator compatibility. @@ -503,7 +503,7 @@ def extrapolator_kwargs(self) -> dict: return self._extrapolator_kwargs @extrapolator_kwargs.setter - def extrapolator_kwargs(self, value: dict): + def extrapolator_kwargs(self, value: dict) -> None: """Setter for the **self.extrapolator_kwargs** property.""" attest( @@ -541,7 +541,7 @@ def function(self) -> Callable: def _undefined_function( *args: Any, # noqa: ARG001 **kwargs: Any, # noqa: ARG001 - ): + ) -> None: """ Raise a :class:`ValueError` exception. @@ -717,7 +717,7 @@ def __getitem__(self, x: ArrayLike | slice) -> NDArrayFloat: else: return self.function(x) - def __setitem__(self, x: ArrayLike | slice, y: ArrayLike): + def __setitem__(self, x: ArrayLike | slice, y: ArrayLike) -> None: """ Set the corresponding range variable :math:`y` for independent domain variable :math:`x`. @@ -938,7 +938,7 @@ def _fill_domain_nan( self, method: Literal["Constant", "Interpolation"] | str = "Interpolation", default: Real = 0, - ): + ) -> None: """ Fill NaNs in independent domain variable :math:`x` using given method. @@ -964,7 +964,7 @@ def _fill_range_nan( self, method: Literal["Constant", "Interpolation"] | str = "Interpolation", default: Real = 0, - ): + ) -> None: """ Fill NaNs in corresponding range variable :math:`y` using given method. @@ -1095,8 +1095,8 @@ def arithmetical_operation( @staticmethod @ndarray_copy_enable(True) def signal_unpack_data( - data=ArrayLike | dict | Series | "Signal" | None, - domain: ArrayLike | None = None, + data: ArrayLike | dict | Series | Signal | ValuesView | None, + domain: ArrayLike | KeysView | None = None, dtype: Type[DTypeFloat] | None = None, ) -> tuple: """ @@ -1199,10 +1199,13 @@ def signal_unpack_data( sorted(cast(Mapping, data).items()) ) elif is_pandas_installed() and isinstance(data, Series): - domain_unpacked = data.index.values - range_unpacked = data.values + domain_unpacked = as_float_array(data.index.values, dtype) # pyright: ignore + range_unpacked = as_float_array(data.values, dtype) if domain is not None: + if isinstance(domain, KeysView): + domain = list(domain) + domain_array = as_float_array(domain, dtype) attest( diff --git a/colour/continuous/tests/test_abstract.py b/colour/continuous/tests/test_abstract.py index 4923ef235..917ea653a 100644 --- a/colour/continuous/tests/test_abstract.py +++ b/colour/continuous/tests/test_abstract.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.continuous.abstract` module.""" +from __future__ import annotations + from colour.continuous import AbstractContinuousFunction __author__ = "Colour Developers" @@ -20,7 +22,7 @@ class TestAbstractContinuousFunction: class unit tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -37,7 +39,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(AbstractContinuousFunction) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( diff --git a/colour/continuous/tests/test_multi_signal.py b/colour/continuous/tests/test_multi_signal.py index 262785107..26efec2b5 100644 --- a/colour/continuous/tests/test_multi_signal.py +++ b/colour/continuous/tests/test_multi_signal.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.continuous.multi_signals` module.""" +from __future__ import annotations + import pickle import textwrap @@ -39,7 +41,7 @@ class TestMultiSignals: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._range_1 = np.linspace(10, 100, 10) @@ -49,7 +51,7 @@ def setup_method(self): self._multi_signals = MultiSignals(self._range_2) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -69,7 +71,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(MultiSignals) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -93,7 +95,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(MultiSignals) - def test_pickling(self): + def test_pickling(self) -> None: """ Test whether the :class:``colour.continuous.signal.MultiSignals` class can be pickled. @@ -103,7 +105,7 @@ def test_pickling(self): data = pickle.loads(data) # noqa: S301 assert self._multi_signals == data - def test_dtype(self): + def test_dtype(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.dtype` property. @@ -115,7 +117,7 @@ def test_dtype(self): multi_signals.dtype = np.float32 assert multi_signals.dtype == np.float32 - def test_domain(self): + def test_domain(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.domain` property. @@ -142,14 +144,14 @@ def test_domain(self): domain = np.linspace(0, 1, 10) domain[0] = -np.inf - def assert_warns(): + def assert_warns() -> None: """Help to test the runtime warning.""" multi_signals.domain = domain pytest.warns(ColourRuntimeWarning, assert_warns) - def test_range(self): + def test_range(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.range` property. @@ -185,7 +187,7 @@ def test_range(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_interpolator(self): + def test_interpolator(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.interpolator` property. @@ -223,7 +225,7 @@ def test_interpolator(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_interpolator_kwargs(self): + def test_interpolator_kwargs(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.\ interpolator_kwargs` property. @@ -264,7 +266,7 @@ def test_interpolator_kwargs(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_extrapolator(self): + def test_extrapolator(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.extrapolator` property. @@ -272,7 +274,7 @@ def test_extrapolator(self): assert isinstance(self._multi_signals.extrapolator(), Extrapolator) - def test_extrapolator_kwargs(self): + def test_extrapolator_kwargs(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.\ extrapolator_kwargs` property. @@ -292,7 +294,7 @@ def test_extrapolator_kwargs(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_function(self): + def test_function(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.function` property. @@ -300,7 +302,7 @@ def test_function(self): attest(callable(self._multi_signals.function)) - def test_raise_exception_function(self): + def test_raise_exception_function(self) -> None: """ Test :func:`colour.continuous.signal.multi_signals.MultiSignals.\ function` property raised exception. @@ -308,7 +310,7 @@ def test_raise_exception_function(self): pytest.raises((ValueError, TypeError), MultiSignals().function, 0) - def test_signals(self): + def test_signals(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.signals` property. @@ -320,7 +322,7 @@ def test_signals(self): np.testing.assert_array_equal(multi_signals.domain, self._domain_1) np.testing.assert_array_equal(multi_signals.range, self._range_1[:, None]) - def test_labels(self): + def test_labels(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.labels` property. @@ -334,7 +336,7 @@ def test_labels(self): assert multi_signals.labels == ["a", "b", "c"] - def test_signal_type(self): + def test_signal_type(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.signal_type` property. @@ -344,7 +346,7 @@ def test_signal_type(self): assert multi_signals.signal_type == Signal - def test__init__(self): + def test__init__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__init__` method. @@ -392,7 +394,7 @@ class NotSignal(Signal): np.testing.assert_array_equal(multi_signals.domain, self._domain_2) np.testing.assert_array_equal(multi_signals.range, self._range_2) - def test__hash__(self): + def test__hash__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__hash__` method. @@ -400,7 +402,7 @@ def test__hash__(self): assert isinstance(hash(self._multi_signals), int) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__str__` method. @@ -427,7 +429,7 @@ def test__str__(self): assert isinstance(str(MultiSignals()), str) - def test__repr__(self): + def test__repr__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__repr__` method. @@ -457,7 +459,7 @@ def test__repr__(self): assert isinstance(repr(MultiSignals()), str) - def test__getitem__(self): + def test__getitem__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__getitem__` method. @@ -504,7 +506,7 @@ def test__getitem__(self): ) np.testing.assert_allclose( - self._multi_signals[:, :], + self._multi_signals[:, :], # pyright: ignore self._multi_signals.range, atol=TOLERANCE_ABSOLUTE_TESTS, ) @@ -522,7 +524,7 @@ def test__getitem__(self): ) np.testing.assert_allclose( - self._multi_signals[:, 0:2], + self._multi_signals[:, 0:2], # pyright: ignore np.array( [ [10.0, 20.0], @@ -564,7 +566,7 @@ def test__getitem__(self): np.array([[0.0, 0.0, 0.0], [1.0, 1.0, 1.0]]), ) - def test__setitem__(self): + def test__setitem__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__setitem__` method. @@ -687,7 +689,7 @@ def test__setitem__(self): multi_signals.range, 40, atol=TOLERANCE_ABSOLUTE_TESTS ) - multi_signals[:, :] = 50 + multi_signals[:, :] = 50 # pyright: ignore np.testing.assert_allclose( multi_signals.range, 50, atol=TOLERANCE_ABSOLUTE_TESTS ) @@ -706,7 +708,7 @@ def test__setitem__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - multi_signals[:, 0:2] = 50 + multi_signals[:, 0:2] = 50 # pyright: ignore np.testing.assert_allclose( multi_signals.range, np.array( @@ -726,7 +728,7 @@ def test__setitem__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test__contains__(self): + def test__contains__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__contains__` method. @@ -736,7 +738,7 @@ def test__contains__(self): assert 0.5 in self._multi_signals assert 1000 not in self._multi_signals - def test__iter__(self): + def test__iter__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__iter__` method.""" domain = np.arange(0, 10) @@ -744,7 +746,7 @@ def test__iter__(self): np.testing.assert_array_equal(domain_range_value[0], domain[i]) np.testing.assert_array_equal(domain_range_value[1:], self._range_2[i]) - def test__len__(self): + def test__len__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__len__` method. @@ -752,7 +754,7 @@ def test__len__(self): assert len(self._multi_signals) == 10 - def test__eq__(self): + def test__eq__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__eq__` method. @@ -765,7 +767,7 @@ def test__eq__(self): assert signal_1 != () - def test__ne__(self): + def test__ne__(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.__ne__` method. @@ -811,7 +813,7 @@ class NotExtrapolator(Extrapolator): } assert multi_signals_1 == multi_signals_2 - def test_arithmetical_operation(self): + def test_arithmetical_operation(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.\ arithmetical_operation` method. @@ -922,7 +924,7 @@ def test_arithmetical_operation(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_is_uniform(self): + def test_is_uniform(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.is_uniform` method. @@ -934,13 +936,13 @@ def test_is_uniform(self): multi_signals[0.5] = 1.0 assert not multi_signals.is_uniform() - def test_copy(self): + def test_copy(self) -> None: """Test :func:`colour.continuous.multi_signals.MultiSignals.copy` method.""" assert self._multi_signals is not self._multi_signals.copy() assert self._multi_signals == self._multi_signals.copy() - def test_multi_signals_unpack_data(self): + def test_multi_signals_unpack_data(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.\ multi_signals_unpack_data` method. @@ -1029,7 +1031,7 @@ def test_multi_signals_unpack_data(self): np.testing.assert_array_equal(signals["b"].range, self._range_1 + 10) np.testing.assert_array_equal(signals["c"].range, self._range_1 + 20) - def test_fill_nan(self): + def test_fill_nan(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.fill_nan` method. @@ -1079,7 +1081,7 @@ def test_fill_nan(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_distance(self): + def test_domain_distance(self) -> None: """ Test :func:`colour.continuous.multi_signals.MultiSignals.\ domain_distance` method. @@ -1097,7 +1099,7 @@ def test_domain_distance(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_to_dataframe(self): + def test_to_dataframe(self) -> None: """ Test :meth:`colour.continuous.multi_signals.MultiSignals.to_dataframe` method. diff --git a/colour/continuous/tests/test_signal.py b/colour/continuous/tests/test_signal.py index d2399cbb6..c0ba40d3d 100644 --- a/colour/continuous/tests/test_signal.py +++ b/colour/continuous/tests/test_signal.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.continuous.signal` module.""" +from __future__ import annotations + import pickle import textwrap @@ -30,7 +32,7 @@ class TestSignal: """Define :class:`colour.continuous.signal.Signal` class unit tests methods.""" - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._range = np.linspace(10, 100, 10) @@ -38,7 +40,7 @@ def setup_method(self): self._signal = Signal(self._range) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -55,7 +57,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(Signal) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -79,7 +81,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(Signal) - def test_pickling(self): + def test_pickling(self) -> None: """ Test whether the :class:``colour.continuous.signal.Signal` class can be pickled. @@ -89,7 +91,7 @@ def test_pickling(self): data = pickle.loads(data) # noqa: S301 assert self._signal == data - def test_dtype(self): + def test_dtype(self) -> None: """Test :func:`colour.continuous.signal.Signal.dtype` property.""" assert self._signal.dtype == DTYPE_FLOAT_DEFAULT @@ -98,7 +100,7 @@ def test_dtype(self): signal.dtype = np.float32 assert signal.dtype == np.float32 - def test_domain(self): + def test_domain(self) -> None: """Test :func:`colour.continuous.signal.Signal.domain` property.""" signal = self._signal.copy() @@ -122,14 +124,14 @@ def test_domain(self): domain = np.linspace(0, 1, 10) domain[0] = -np.inf - def assert_warns(): + def assert_warns() -> None: """Help to test the runtime warning.""" signal.domain = domain pytest.warns(ColourRuntimeWarning, assert_warns) - def test_range(self): + def test_range(self) -> None: """Test :func:`colour.continuous.signal.Signal.range` property.""" signal = self._signal.copy() @@ -150,14 +152,14 @@ def test_range(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def assert_warns(): + def assert_warns() -> None: """Help to test the runtime warning.""" signal.range = self._range * np.inf pytest.warns(ColourRuntimeWarning, assert_warns) - def test_interpolator(self): + def test_interpolator(self) -> None: """Test :func:`colour.continuous.signal.Signal.interpolator` property.""" signal = self._signal.copy() @@ -184,7 +186,7 @@ def test_interpolator(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_interpolator_kwargs(self): + def test_interpolator_kwargs(self) -> None: """ Test :func:`colour.continuous.signal.Signal.interpolator_kwargs` property. @@ -222,12 +224,12 @@ def test_interpolator_kwargs(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_extrapolator(self): + def test_extrapolator(self) -> None: """Test :func:`colour.continuous.signal.Signal.extrapolator` property.""" assert isinstance(self._signal.extrapolator(), Extrapolator) - def test_extrapolator_kwargs(self): + def test_extrapolator_kwargs(self) -> None: """ Test :func:`colour.continuous.signal.Signal.extrapolator_kwargs` property. @@ -247,12 +249,12 @@ def test_extrapolator_kwargs(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_function(self): + def test_function(self) -> None: """Test :func:`colour.continuous.signal.Signal.function` property.""" attest(callable(self._signal.function)) - def test_raise_exception_function(self): + def test_raise_exception_function(self) -> None: """ Test :func:`colour.continuous.signal.Signal.function` property raised exception. @@ -260,7 +262,7 @@ def test_raise_exception_function(self): pytest.raises(ValueError, Signal().function, 0) - def test__init__(self): + def test__init__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__init__` method.""" signal = Signal(self._range) @@ -286,12 +288,12 @@ def test__init__(self): np.testing.assert_array_equal(signal.domain, self._domain) np.testing.assert_array_equal(signal.range, self._range) - def test__hash__(self): + def test__hash__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__hash__` method.""" assert isinstance(hash(self._signal), int) - def test__str__(self): + def test__str__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__str__` method.""" assert ( @@ -315,7 +317,7 @@ def test__str__(self): assert isinstance(str(Signal()), str) - def test__repr__(self): + def test__repr__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__repr__` method.""" assert repr(self._signal) == ( @@ -341,7 +343,7 @@ def test__repr__(self): assert isinstance(repr(Signal()), str) - def test__getitem__(self): + def test__getitem__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__getitem__` method.""" assert self._signal[0] == 10.0 @@ -385,7 +387,7 @@ def test__getitem__(self): signal[np.array([-1000, 1000])], np.array([0.0, 1.0]) ) - def test__setitem__(self): + def test__setitem__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__setitem__` method.""" signal = self._signal.copy() @@ -477,14 +479,14 @@ def test__setitem__(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test__contains__(self): + def test__contains__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__contains__` method.""" assert 0 in self._signal assert 0.5 in self._signal assert 1000 not in self._signal - def test__iter__(self): + def test__iter__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__iter__` method.""" domain = np.arange(0, 10) @@ -492,12 +494,12 @@ def test__iter__(self): np.testing.assert_array_equal(domain_value, domain[i]) np.testing.assert_array_equal(range_value, self._range[i]) - def test__len__(self): + def test__len__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__len__` method.""" assert len(self._signal) == 10 - def test__eq__(self): + def test__eq__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__eq__` method.""" signal_1 = self._signal.copy() @@ -505,7 +507,7 @@ def test__eq__(self): assert signal_1 == signal_2 - def test__ne__(self): + def test__ne__(self) -> None: """Test :func:`colour.continuous.signal.Signal.__ne__` method.""" signal_1 = self._signal.copy() @@ -548,7 +550,7 @@ class NotExtrapolator(Extrapolator): } assert signal_1 == signal_2 - def test_arithmetical_operation(self): + def test_arithmetical_operation(self) -> None: """ Test :meth:`colour.continuous.signal.Signal.arithmetical_operation` method. @@ -660,7 +662,7 @@ def test_arithmetical_operation(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_is_uniform(self): + def test_is_uniform(self) -> None: """Test :func:`colour.continuous.signal.Signal.is_uniform` method.""" assert self._signal.is_uniform() @@ -669,13 +671,13 @@ def test_is_uniform(self): signal[0.5] = 1.0 assert not signal.is_uniform() - def test_copy(self): + def test_copy(self) -> None: """Test :func:`colour.continuous.signal.Signal.copy` method.""" assert self._signal is not self._signal.copy() assert self._signal == self._signal.copy() - def test_signal_unpack_data(self): + def test_signal_unpack_data(self) -> None: """ Test :meth:`colour.continuous.signal.Signal.signal_unpack_data` method. @@ -711,7 +713,7 @@ def test_signal_unpack_data(self): np.testing.assert_array_equal(range_, self._range) np.testing.assert_array_equal(domain, self._domain) - def test_fill_nan(self): + def test_fill_nan(self) -> None: """Test :func:`colour.continuous.signal.Signal.fill_nan` method.""" signal = self._signal.copy() @@ -732,7 +734,7 @@ def test_fill_nan(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_distance(self): + def test_domain_distance(self) -> None: """Test :func:`colour.continuous.signal.Signal.domain_distance` method.""" np.testing.assert_allclose( @@ -747,7 +749,7 @@ def test_domain_distance(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_to_series(self): + def test_to_series(self) -> None: """Test :func:`colour.continuous.signal.Signal.to_series` method.""" if is_pandas_installed(): diff --git a/colour/contrast/__init__.py b/colour/contrast/__init__.py index 109d88684..bd3cedba8 100644 --- a/colour/contrast/__init__.py +++ b/colour/contrast/__init__.py @@ -20,7 +20,7 @@ from __future__ import annotations -from colour.hints import NDArrayFloat, Literal +from colour.hints import Any, NDArrayFloat, Literal from colour.utilities import ( CanonicalMapping, filter_kwargs, @@ -61,7 +61,7 @@ def contrast_sensitivity_function( - method: Literal["Barten 1999"] | str = "Barten 1999", **kwargs + method: Literal["Barten 1999"] | str = "Barten 1999", **kwargs: Any ) -> NDArrayFloat: """ Return the contrast sensitivity :math:`S` of the human eye according to diff --git a/colour/contrast/tests/test_barten1999.py b/colour/contrast/tests/test_barten1999.py index fdc976e31..cbb46fa82 100644 --- a/colour/contrast/tests/test_barten1999.py +++ b/colour/contrast/tests/test_barten1999.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.contrast.barten1999` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -38,7 +40,7 @@ class TestOpticalMTFBarten1999: definition unit tests methods. """ - def test_optical_MTF_Barten1999(self): + def test_optical_MTF_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.optical_MTF_Barten1999` definition. @@ -62,7 +64,7 @@ def test_optical_MTF_Barten1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_optical_MTF_Barten1999(self): + def test_n_dimensional_optical_MTF_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.optical_MTF_Barten1999` definition n-dimensional support. @@ -91,7 +93,7 @@ def test_n_dimensional_optical_MTF_Barten1999(self): ) @ignore_numpy_errors - def test_nan_optical_MTF_Barten1999(self): + def test_nan_optical_MTF_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.optical_MTF_Barten1999` definition nan support. @@ -108,7 +110,7 @@ class TestPupilDiameterBarten1999: definition unit tests methods. """ - def test_pupil_diameter_Barten1999(self): + def test_pupil_diameter_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.pupil_diameter_Barten1999` definition. @@ -132,7 +134,7 @@ def test_pupil_diameter_Barten1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_pupil_diameter_Barten1999(self): + def test_n_dimensional_pupil_diameter_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.pupil_diameter_Barten1999` definition n-dimensional support. @@ -162,7 +164,7 @@ def test_n_dimensional_pupil_diameter_Barten1999(self): ) @ignore_numpy_errors - def test_nan_pupil_diameter_Barten1999(self): + def test_nan_pupil_diameter_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.pupil_diameter_Barten1999` definition nan support. @@ -179,7 +181,7 @@ class TestSigmaBarten1999: tests methods. """ - def test_sigma_Barten1999(self): + def test_sigma_Barten1999(self) -> None: """Test :func:`colour.contrast.barten1999.sigma_Barten1999` definition.""" np.testing.assert_allclose( @@ -206,7 +208,7 @@ def test_sigma_Barten1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_sigma_Barten1999(self): + def test_n_dimensional_sigma_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.sigma_Barten1999` definition n-dimensional support. @@ -236,7 +238,7 @@ def test_n_dimensional_sigma_Barten1999(self): ) @ignore_numpy_errors - def test_nan_sigma_Barten1999(self): + def test_nan_sigma_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.sigma_Barten1999` definition nan support. @@ -253,7 +255,7 @@ class TestRetinalIlluminanceBarten1999: definition unit tests methods. """ - def test_retinal_illuminance_Barten1999(self): + def test_retinal_illuminance_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.retinal_illuminance_Barten1999` definition. @@ -277,7 +279,7 @@ def test_retinal_illuminance_Barten1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_retinal_illuminance_Barten1999(self): + def test_n_dimensional_retinal_illuminance_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.retinal_illuminance_Barten1999` definition n-dimensional support. @@ -306,7 +308,7 @@ def test_n_dimensional_retinal_illuminance_Barten1999(self): ) @ignore_numpy_errors - def test_nan_retinal_illuminance_Barten1999(self): + def test_nan_retinal_illuminance_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.retinal_illuminance_Barten1999` definition nan support. @@ -323,7 +325,7 @@ class TestMaximumAngularSizeBarten1999: definition unit tests methods. """ - def test_maximum_angular_size_Barten1999(self): + def test_maximum_angular_size_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.\ maximum_angular_size_Barten1999` definition. @@ -359,7 +361,7 @@ def test_maximum_angular_size_Barten1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_maximum_angular_size_Barten1999(self): + def test_n_dimensional_maximum_angular_size_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.\ maximum_angular_size_Barten1999` definition n-dimensional support. @@ -390,7 +392,7 @@ def test_n_dimensional_maximum_angular_size_Barten1999(self): ) @ignore_numpy_errors - def test_nan_maximum_angular_size_Barten1999(self): + def test_nan_maximum_angular_size_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.\ maximum_angular_size_Barten1999` definition nan support. @@ -407,7 +409,7 @@ class TestContrastSensitivityFunctionBarten1999: contrast_sensitivity_function_Barten1999` definition unit tests methods. """ - def test_contrast_sensitivity_function_Barten1999(self): + def test_contrast_sensitivity_function_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.\ contrast_sensitivity_function_Barten1999` definition. @@ -542,7 +544,7 @@ def test_contrast_sensitivity_function_Barten1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_contrast_sensitivity_function_Barten1999(self): + def test_n_dimensional_contrast_sensitivity_function_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.\ contrast_sensitivity_function_Barten1999` definition n-dimensional support. @@ -573,7 +575,7 @@ def test_n_dimensional_contrast_sensitivity_function_Barten1999(self): ) @ignore_numpy_errors - def test_nan_contrast_sensitivity_function_Barten1999(self): + def test_nan_contrast_sensitivity_function_Barten1999(self) -> None: """ Test :func:`colour.contrast.barten1999.\ contrast_sensitivity_function_Barten1999` definition nan support. diff --git a/colour/corresponding/datasets/breneman1987.py b/colour/corresponding/datasets/breneman1987.py index 75a19a1cb..5bfa7fd2f 100644 --- a/colour/corresponding/datasets/breneman1987.py +++ b/colour/corresponding/datasets/breneman1987.py @@ -13,10 +13,13 @@ doi:10.1364/JOSAA.4.001115 """ +from __future__ import annotations + from collections import namedtuple import numpy as np +from colour.hints import ArrayLike, Literal from colour.utilities.documentation import ( DocstringDict, is_documentation_building, @@ -76,7 +79,15 @@ class BrenemanExperimentResult( :math:`\\delta_uv_g^p`. """ - def __new__(cls, name, uv_t, uv_m, s_uv=None, d_uv_i=None, d_uv_g=None): + def __new__( + cls, + name: str, + uv_t: ArrayLike, + uv_m: ArrayLike, + s_uv: ArrayLike | None = None, + d_uv_i: ArrayLike | None = None, + d_uv_g: ArrayLike | None = None, + ) -> BrenemanExperimentResult: """ Return a new instance of the :class:`colour.corresponding.datasets.corresponding_chromaticities.\ @@ -119,7 +130,15 @@ class PrimariesChromaticityCoordinates( Chromaticity coordinates :math:`uv^p` of primary :math:`T`. """ - def __new__(cls, experiment, illuminants, Y, P_uvp=None, D_uvp=None, T_uvp=None): + def __new__( + cls, + experiment: Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], + illuminants: ArrayLike, + Y: ArrayLike, + P_uvp: ArrayLike | None = None, + D_uvp: ArrayLike | None = None, + T_uvp: ArrayLike | None = None, + ) -> PrimariesChromaticityCoordinates: """ Return a new instance of the :class:`colour.corresponding.datasets.corresponding_chromaticities.\ diff --git a/colour/corresponding/tests/test_prediction.py b/colour/corresponding/tests/test_prediction.py index e4b9eb4a1..d8dc12141 100644 --- a/colour/corresponding/tests/test_prediction.py +++ b/colour/corresponding/tests/test_prediction.py @@ -223,7 +223,7 @@ class TestConvertExperimentResultsBreneman1987: methods. """ - def test_convert_experiment_results_Breneman1987(self): + def test_convert_experiment_results_Breneman1987(self) -> None: """ Test :func:`colour.corresponding.prediction.\ convert_experiment_results_Breneman1987` definition. @@ -275,7 +275,7 @@ class TestCorrespondingChromaticitiesPredictionFairchild1990: methods. """ - def test_corresponding_chromaticities_prediction_Fairchild1990(self): + def test_corresponding_chromaticities_prediction_Fairchild1990(self) -> None: """ Test :func:`colour.corresponding.prediction.\ corresponding_chromaticities_prediction_Fairchild1990` definition. @@ -299,7 +299,7 @@ class TestCorrespondingChromaticitiesPredictionCIE1994: corresponding_chromaticities_prediction_CIE1994` definition unit tests methods. """ - def test_corresponding_chromaticities_prediction_CIE1994(self): + def test_corresponding_chromaticities_prediction_CIE1994(self) -> None: """ Test :func:`colour.corresponding.prediction.\ corresponding_chromaticities_prediction_CIE1994` definition. @@ -324,7 +324,7 @@ class TestCorrespondingChromaticitiesPredictionCMCCAT2000: methods. """ - def test_corresponding_chromaticities_prediction_CMCCAT2000(self): + def test_corresponding_chromaticities_prediction_CMCCAT2000(self) -> None: """ Test :func:`colour.corresponding.prediction.\ corresponding_chromaticities_prediction_CMCCAT2000` definition. @@ -349,7 +349,7 @@ class TestCorrespondingChromaticitiesPredictionVonKries: methods. """ - def test_corresponding_chromaticities_prediction_VonKries(self): + def test_corresponding_chromaticities_prediction_VonKries(self) -> None: """ Test :func:`colour.corresponding.prediction.\ corresponding_chromaticities_prediction_VonKries` definition. @@ -374,7 +374,7 @@ class TestCorrespondingChromaticitiesPredictionZhai2018: methods. """ - def test_corresponding_chromaticities_prediction_Zhai2018(self): + def test_corresponding_chromaticities_prediction_Zhai2018(self) -> None: """ Test :func:`colour.corresponding.prediction.\ corresponding_chromaticities_prediction_Zhai2018` definition. diff --git a/colour/difference/tests/test__init__.py b/colour/difference/tests/test__init__.py index 76231a564..a4a248e23 100644 --- a/colour/difference/tests/test__init__.py +++ b/colour/difference/tests/test__init__.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.difference` module.""" +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -21,7 +23,7 @@ class TestDelta_E: """Define :func:`colour.difference.delta_E` definition unit tests methods.""" - def test_domain_range_scale_delta_E(self): + def test_domain_range_scale_delta_E(self) -> None: """ Test :func:`colour.difference.delta_E` definition domain and range scale support. diff --git a/colour/difference/tests/test_cam02_ucs.py b/colour/difference/tests/test_cam02_ucs.py index e43ff5119..7e99c2ca7 100644 --- a/colour/difference/tests/test_cam02_ucs.py +++ b/colour/difference/tests/test_cam02_ucs.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.difference.cam02_ucs` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -32,7 +34,7 @@ class TestDelta_E_Luo2006: tests methods. """ - def test_delta_E_Luo2006(self): + def test_delta_E_Luo2006(self) -> None: """Test :func:`colour.difference.cam02_ucs.delta_E_Luo2006` definition.""" np.testing.assert_allclose( @@ -84,7 +86,7 @@ def test_delta_E_Luo2006(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_Luo2006(self): + def test_n_dimensional_delta_E_Luo2006(self) -> None: """ Test :func:`colour.difference.cam02_ucs.delta_E_Luo2006` definition n-dimensional arrays support. @@ -115,7 +117,7 @@ def test_n_dimensional_delta_E_Luo2006(self): ) @ignore_numpy_errors - def test_nan_delta_E_Luo2006(self): + def test_nan_delta_E_Luo2006(self) -> None: """ Test :func:`colour.difference.cam02_ucs.delta_E_Luo2006` definition nan support. diff --git a/colour/difference/tests/test_cam16_ucs.py b/colour/difference/tests/test_cam16_ucs.py index fc428572e..c74483691 100644 --- a/colour/difference/tests/test_cam16_ucs.py +++ b/colour/difference/tests/test_cam16_ucs.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.difference.cam16_ucs` module.""" +from __future__ import annotations + from colour.difference.tests.test_cam02_ucs import TestDelta_E_Luo2006 __author__ = "Colour Developers" diff --git a/colour/difference/tests/test_delta_e.py b/colour/difference/tests/test_delta_e.py index e282b33d6..4cd99bf9d 100644 --- a/colour/difference/tests/test_delta_e.py +++ b/colour/difference/tests/test_delta_e.py @@ -9,6 +9,8 @@ 30(1), 21-30. doi:10.1002/col.20070 """ +from __future__ import annotations + from itertools import product import numpy as np @@ -57,7 +59,7 @@ class TestDelta_E_CIE1976: definition, thus unit tests are not entirely implemented. """ - def test_delta_E_CIE1976(self): + def test_delta_E_CIE1976(self) -> None: """Test :func:`colour.difference.delta_e.delta_E_CIE1976` definition.""" Lab_1 = np.array([48.99183622, -0.10561667, 400.65619925]) @@ -71,13 +73,13 @@ def test_delta_E_CIE1976(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_CIE1976(self): + def test_n_dimensional_delta_E_CIE1976(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE1976` definition n-dimensional arrays support. """ - def test_domain_range_scale_delta_E_CIE1976(self): + def test_domain_range_scale_delta_E_CIE1976(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE1976` definition domain and range scale support. @@ -96,7 +98,7 @@ def test_domain_range_scale_delta_E_CIE1976(self): ) @ignore_numpy_errors - def test_nan_delta_E_CIE1976(self): + def test_nan_delta_E_CIE1976(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE1976` definition nan support. @@ -109,7 +111,7 @@ class TestDelta_E_CIE1994: tests methods. """ - def test_delta_E_CIE1994(self): + def test_delta_E_CIE1994(self) -> None: """Test :func:`colour.difference.delta_e.delta_E_CIE1994` definition.""" np.testing.assert_allclose( @@ -169,7 +171,7 @@ def test_delta_E_CIE1994(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_CIE1994(self): + def test_n_dimensional_delta_E_CIE1994(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE1994` definition n-dimensional arrays support. @@ -197,7 +199,7 @@ def test_n_dimensional_delta_E_CIE1994(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_delta_E_CIE1994(self): + def test_domain_range_scale_delta_E_CIE1994(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE1994` definition domain and range scale support. @@ -217,7 +219,7 @@ def test_domain_range_scale_delta_E_CIE1994(self): ) @ignore_numpy_errors - def test_nan_delta_E_CIE1994(self): + def test_nan_delta_E_CIE1994(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE1994` definition nan support. @@ -234,7 +236,7 @@ class TestIntermediateAttributes_CIE2000: definition unit tests methods. """ - def test_intermediate_attributes_CIE2000(self): + def test_intermediate_attributes_CIE2000(self) -> None: """ Test :func:`colour.difference.delta_e.intermediate_attributes_CIE2000` definition. @@ -266,7 +268,7 @@ class TestDelta_E_CIE2000: tests methods. """ - def test_delta_E_CIE2000(self): + def test_delta_E_CIE2000(self) -> None: """Test :func:`colour.difference.delta_e.delta_E_CIE2000` definition.""" np.testing.assert_allclose( @@ -326,7 +328,7 @@ def test_delta_E_CIE2000(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_CIE2000(self): + def test_n_dimensional_delta_E_CIE2000(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE2000` definition n-dimensional arrays support. @@ -354,7 +356,7 @@ def test_n_dimensional_delta_E_CIE2000(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_delta_E_CIE2000(self): + def test_domain_range_scale_delta_E_CIE2000(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE2000` definition domain and range scale support. @@ -374,7 +376,7 @@ def test_domain_range_scale_delta_E_CIE2000(self): ) @ignore_numpy_errors - def test_nan_delta_E_CIE2000(self): + def test_nan_delta_E_CIE2000(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE2000` definition nan support. @@ -384,7 +386,7 @@ def test_nan_delta_E_CIE2000(self): cases = np.array(list(set(product(cases, repeat=3)))) delta_E_CIE2000(cases, cases) - def test_delta_E_CIE2000_Sharma2004(self): + def test_delta_E_CIE2000_Sharma2004(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CIE2000` definition using Sharma (2004) dataset. @@ -558,7 +560,7 @@ class TestDelta_E_CMC: methods. """ - def test_delta_E_CMC(self): + def test_delta_E_CMC(self) -> None: """Test :func:`colour.difference.delta_e.delta_E_CMC` definition.""" np.testing.assert_allclose( @@ -618,7 +620,7 @@ def test_delta_E_CMC(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_CMC(self): + def test_n_dimensional_delta_E_CMC(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CMC` definition n-dimensional arrays support. @@ -642,7 +644,7 @@ def test_n_dimensional_delta_E_CMC(self): delta_E_CMC(Lab_1, Lab_2), delta_E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_delta_E_CMC(self): + def test_domain_range_scale_delta_E_CMC(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CMC` definition domain and range scale support. @@ -662,7 +664,7 @@ def test_domain_range_scale_delta_E_CMC(self): ) @ignore_numpy_errors - def test_nan_delta_E_CMC(self): + def test_nan_delta_E_CMC(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_CMC` definition nan support. @@ -679,7 +681,7 @@ class TestDelta_E_ITP: methods. """ - def test_delta_E_ITP(self): + def test_delta_E_ITP(self) -> None: """Test :func:`colour.difference.delta_e.delta_E_ITP` definition.""" np.testing.assert_allclose( @@ -772,7 +774,7 @@ def test_delta_E_ITP(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_ITP(self): + def test_n_dimensional_delta_E_ITP(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_ITP` definition n-dimensional arrays support. @@ -796,7 +798,7 @@ def test_n_dimensional_delta_E_ITP(self): delta_E_ITP(ICtCp_1, ICtCp_2), delta_E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_delta_E_ITP(self): + def test_domain_range_scale_delta_E_ITP(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_ITP` definition domain and range scale support. @@ -816,7 +818,7 @@ def test_domain_range_scale_delta_E_ITP(self): ) @ignore_numpy_errors - def test_nan_delta_E_ITP(self): + def test_nan_delta_E_ITP(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_ITP` definition nan support. @@ -833,7 +835,7 @@ class TestDelta_E_HyAB: tests methods. """ - def test_delta_E_HyAB(self): + def test_delta_E_HyAB(self) -> None: """Test :func:`colour.difference.delta_e.delta_E_HyAB` definition.""" np.testing.assert_allclose( @@ -863,7 +865,7 @@ def test_delta_E_HyAB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_HyAB(self): + def test_n_dimensional_delta_E_HyAB(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_HyAB` definition n-dimensional arrays support. @@ -891,7 +893,7 @@ def test_n_dimensional_delta_E_HyAB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_delta_E_HyAB(self): + def test_domain_range_scale_delta_E_HyAB(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_HyAB` definition domain and range scale support. @@ -911,7 +913,7 @@ def test_domain_range_scale_delta_E_HyAB(self): ) @ignore_numpy_errors - def test_nan_delta_E_HyAB(self): + def test_nan_delta_E_HyAB(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_HyAB` definition nan support. @@ -928,7 +930,7 @@ class TestDelta_E_HyCH: tests methods. """ - def test_delta_E_HyCH(self): + def test_delta_E_HyCH(self) -> None: """Test :func:`colour.difference.delta_e.delta_E_HyCH` definition.""" np.testing.assert_allclose( @@ -958,7 +960,7 @@ def test_delta_E_HyCH(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_HyCH(self): + def test_n_dimensional_delta_E_HyCH(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_HyCH` definition n-dimensional arrays support. @@ -986,7 +988,7 @@ def test_n_dimensional_delta_E_HyCH(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_delta_E_HyCH(self): + def test_domain_range_scale_delta_E_HyCH(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_HyCH` definition domain and range scale support. @@ -1006,7 +1008,7 @@ def test_domain_range_scale_delta_E_HyCH(self): ) @ignore_numpy_errors - def test_nan_delta_E_HyCH(self): + def test_nan_delta_E_HyCH(self) -> None: """ Test :func:`colour.difference.delta_e.delta_E_HyCH` definition nan support. diff --git a/colour/difference/tests/test_din99.py b/colour/difference/tests/test_din99.py index b71d680fd..b5ee2ddb5 100644 --- a/colour/difference/tests/test_din99.py +++ b/colour/difference/tests/test_din99.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.difference.din99` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -26,7 +28,7 @@ class TestDelta_E_DIN99: tests methods. """ - def test_delta_E_DIN99(self): + def test_delta_E_DIN99(self) -> None: """Test :func:`colour.difference.din99.delta_E_DIN99` definition.""" np.testing.assert_allclose( @@ -86,7 +88,7 @@ def test_delta_E_DIN99(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_delta_E_DIN99(self): + def test_n_dimensional_delta_E_DIN99(self) -> None: """ Test :func:`colour.difference.din99.delta_E_DIN99` definition n-dimensional arrays support. @@ -110,7 +112,7 @@ def test_n_dimensional_delta_E_DIN99(self): delta_E_DIN99(Lab_1, Lab_2), delta_E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_delta_E_DIN99(self): + def test_domain_range_scale_delta_E_DIN99(self) -> None: """ Test :func:`colour.difference.din99.delta_E_DIN99` definition domain and range scale support. @@ -130,7 +132,7 @@ def test_domain_range_scale_delta_E_DIN99(self): ) @ignore_numpy_errors - def test_nan_delta_E_DIN99(self): + def test_nan_delta_E_DIN99(self) -> None: """ Test :func:`colour.difference.din99.delta_E_DIN99` definition nan support. diff --git a/colour/difference/tests/test_huang2015.py b/colour/difference/tests/test_huang2015.py index cfb6fdf15..34feed9ad 100644 --- a/colour/difference/tests/test_huang2015.py +++ b/colour/difference/tests/test_huang2015.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.difference.huang2015` module.""" +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -23,7 +25,7 @@ class TestPowerFunctionHuang2015: definition unit tests methods. """ - def test_power_function_Huang2015(self): + def test_power_function_Huang2015(self) -> None: """ Test :func:`colour.difference.huang2015.power_function_Huang2015` definition. diff --git a/colour/difference/tests/test_stress.py b/colour/difference/tests/test_stress.py index dd9ad00b7..657616819 100644 --- a/colour/difference/tests/test_stress.py +++ b/colour/difference/tests/test_stress.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.difference.stress` module.""" +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -23,7 +25,7 @@ class TestIndexStress: unit tests methods. """ - def test_index_stress(self): + def test_index_stress(self) -> None: """ Test :func:`colour.difference.stress.index_stress_Garcia2007` definition. diff --git a/colour/examples/io/examples_ctl.py b/colour/examples/io/examples_ctl.py index cdbddae3f..5f2e7d6e4 100644 --- a/colour/examples/io/examples_ctl.py +++ b/colour/examples/io/examples_ctl.py @@ -193,8 +193,9 @@ 'Running the "aces-dev" "Y_2_linCV" "CTL" function to transform an array.' ) - def format_imports(imports): + def format_imports(imports: list[str]) -> list[str]: """Format given imports.""" + return [f'import "{i}";' for i in imports] ctl_Y_2_linCV_float = colour.io.template_ctl_transform_float( diff --git a/colour/examples/plotting/examples_section_plots.py b/colour/examples/plotting/examples_section_plots.py index 8b9909bf8..d3bdfb67a 100644 --- a/colour/examples/plotting/examples_section_plots.py +++ b/colour/examples/plotting/examples_section_plots.py @@ -120,7 +120,7 @@ plot_RGB_colourspace_section( colourspace="sRGB", model="DIN99", - origin=i, + origin=i, # pyright: ignore section_colours=RGB, section_opacity=0.15, contour_colours=RGB, diff --git a/colour/geometry/section.py b/colour/geometry/section.py index 33af5b916..0663d4327 100644 --- a/colour/geometry/section.py +++ b/colour/geometry/section.py @@ -13,7 +13,7 @@ from colour.algebra import linear_conversion from colour.constants import DTYPE_FLOAT_DEFAULT -from colour.hints import Any, ArrayLike, Literal, NDArrayFloat, cast +from colour.hints import Any, ArrayLike, List, Literal, NDArrayFloat, cast from colour.utilities import ( as_float_array, as_float_scalar, @@ -85,7 +85,7 @@ def edges_to_chord(edges: ArrayLike, index: int = 0) -> NDArrayFloat: [-0. , -0.5, 0. ]]) """ - edge_list = as_float_array(edges).tolist() + edge_list = cast(List[List[float]], as_float_array(edges).tolist()) edges_ordered = [edge_list.pop(index)] segment = np.array(edges_ordered[0][1]) diff --git a/colour/geometry/tests/test_ellipse.py b/colour/geometry/tests/test_ellipse.py index 9a2903fd9..1aa5b7686 100644 --- a/colour/geometry/tests/test_ellipse.py +++ b/colour/geometry/tests/test_ellipse.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.geometry.ellipse` module.""" +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -31,7 +33,7 @@ class TestEllipseCoefficientsCanonicalForm: definition unit tests methods. """ - def test_ellipse_coefficients_canonical_form(self): + def test_ellipse_coefficients_canonical_form(self) -> None: """ Test :func:`colour.geometry.ellipse.\ ellipse_coefficients_canonical_form` definition. @@ -60,7 +62,7 @@ class TestEllipseCoefficientsGeneralForm: definition unit tests methods. """ - def test_ellipse_coefficients_general_form(self): + def test_ellipse_coefficients_general_form(self) -> None: """ Test :func:`colour.geometry.ellipse.ellipse_coefficients_general_form` definition. @@ -85,7 +87,7 @@ class TestPointAtAngleOnEllipse: definition unit tests methods. """ - def test_point_at_angle_on_ellipse(self): + def test_point_at_angle_on_ellipse(self) -> None: """ Test :func:`colour.geometry.ellipse.point_at_angle_on_ellipse` definition. @@ -127,7 +129,7 @@ class TestEllipseFittingHalir1998: definition unit tests methods. """ - def test_ellipse_fitting_Halir1998(self): + def test_ellipse_fitting_Halir1998(self) -> None: """ Test :func:`colour.geometry.ellipse.ellipse_fitting_Halir1998` definition. diff --git a/colour/geometry/tests/test_intersection.py b/colour/geometry/tests/test_intersection.py index 0a809f195..18a0ede76 100644 --- a/colour/geometry/tests/test_intersection.py +++ b/colour/geometry/tests/test_intersection.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.geometry.intersection` module.""" +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -27,7 +29,7 @@ class TestExtendLineSegment: tests methods. """ - def test_extend_line_segment(self): + def test_extend_line_segment(self) -> None: """Test :func:`colour.geometry.intersection.extend_line_segment` definition.""" np.testing.assert_allclose( @@ -66,7 +68,7 @@ class TestIntersectLineSegments: definition unit tests methods. """ - def test_intersect_line_segments(self): + def test_intersect_line_segments(self) -> None: """ Test :func:`colour.geometry.intersection.intersect_line_segments` definition. diff --git a/colour/geometry/tests/test_primitives.py b/colour/geometry/tests/test_primitives.py index 1af5b7fe8..749803670 100644 --- a/colour/geometry/tests/test_primitives.py +++ b/colour/geometry/tests/test_primitives.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.geometry.primitives` module.""" +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -28,7 +30,7 @@ class TestPrimitiveGrid: definition unit tests methods. """ - def test_primitive_grid(self): + def test_primitive_grid(self) -> None: """ Test :func:`colour.geometry.primitives.primitive_grid` definition. @@ -187,7 +189,7 @@ class TestPrimitiveCube: definition unit tests methods. """ - def test_primitive_cube(self): + def test_primitive_cube(self) -> None: """ Test :func:`colour.geometry.primitives.primitive_cube` definition. @@ -781,7 +783,7 @@ def test_primitive_cube(self): for plane in MAPPING_PLANE_TO_AXIS: np.testing.assert_allclose( - primitive_cube(planes=[plane])[0]["position"], - primitive_cube(planes=[MAPPING_PLANE_TO_AXIS[plane]])[0]["position"], + primitive_cube(planes=[plane])[0]["position"], # pyright: ignore + primitive_cube(planes=[MAPPING_PLANE_TO_AXIS[plane]])[0]["position"], # pyright: ignore atol=TOLERANCE_ABSOLUTE_TESTS, ) diff --git a/colour/geometry/tests/test_section.py b/colour/geometry/tests/test_section.py index ae7f66176..67a30fbe1 100644 --- a/colour/geometry/tests/test_section.py +++ b/colour/geometry/tests/test_section.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.geometry.section` module.""" +from __future__ import annotations + import numpy as np import pytest @@ -33,7 +35,7 @@ class TestEdgesToChord: tests methods. """ - def test_edges_to_chord(self): + def test_edges_to_chord(self) -> None: """Test :func:`colour.geometry.section.edges_to_chord` definition.""" edges = np.array( @@ -106,7 +108,7 @@ class TestCloseChord: methods. """ - def test_close_chord(self): + def test_close_chord(self) -> None: """Test :func:`colour.geometry.section.close_chord` definition.""" np.testing.assert_allclose( @@ -122,7 +124,7 @@ class TestUniqueVertices: tests methods. """ - def test_unique_vertices(self): + def test_unique_vertices(self) -> None: """Test :func:`colour.geometry.section.unique_vertices` definition.""" np.testing.assert_allclose( @@ -149,7 +151,7 @@ class TestHullSection: methods. """ - def test_hull_section(self): + def test_hull_section(self) -> None: """Test :func:`colour.geometry.section.hull_section` definition.""" if not is_trimesh_installed(): # pragma: no cover diff --git a/colour/geometry/tests/test_vertices.py b/colour/geometry/tests/test_vertices.py index 1289c935f..23321020e 100644 --- a/colour/geometry/tests/test_vertices.py +++ b/colour/geometry/tests/test_vertices.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.geometry.vertices` module.""" +from __future__ import annotations + import numpy as np import pytest @@ -33,7 +35,7 @@ class TestPrimitiveVerticesQuadMpl: definition unit tests methods. """ - def test_primitive_vertices_quad_mpl(self): + def test_primitive_vertices_quad_mpl(self) -> None: """ Test :func:`colour.geometry.vertices.primitive_vertices_quad_mpl` definition. @@ -111,7 +113,7 @@ class TestPrimitiveVerticesGridMpl: definition unit tests methods. """ - def test_primitive_vertices_grid_mpl(self): + def test_primitive_vertices_grid_mpl(self) -> None: """ Test :func:`colour.geometry.vertices.primitive_vertices_grid_mpl` definition. @@ -200,7 +202,7 @@ class TestPrimitiveVerticesCubeMpl: definition unit tests methods. """ - def test_primitive_vertices_cube_mpl(self): + def test_primitive_vertices_cube_mpl(self) -> None: """ Test :func:`colour.geometry.vertices.primitive_vertices_cube_mpl` definition. @@ -599,7 +601,7 @@ class TestPrimitiveVerticesSphere: definition unit tests methods. """ - def test_primitive_vertices_sphere(self): + def test_primitive_vertices_sphere(self) -> None: """ Test :func:`colour.geometry.vertices.primitive_vertices_sphere` definition. diff --git a/colour/geometry/vertices.py b/colour/geometry/vertices.py index 389a773a6..995d67853 100644 --- a/colour/geometry/vertices.py +++ b/colour/geometry/vertices.py @@ -18,7 +18,7 @@ from colour.algebra import spherical_to_cartesian from colour.geometry import MAPPING_PLANE_TO_AXIS -from colour.hints import Any, ArrayLike, Literal, NDArrayFloat +from colour.hints import Any, ArrayLike, Literal, NDArrayFloat, Sequence from colour.utilities import ( CanonicalMapping, as_float_array, @@ -205,19 +205,21 @@ def primitive_vertices_cube_mpl( depth_segments: int = 1, origin: ArrayLike = np.array([0, 0, 0]), planes: ( - Literal[ - "-x", - "+x", - "-y", - "+y", - "-z", - "+z", - "xy", - "xz", - "yz", - "yx", - "zx", - "zy", + Sequence[ + Literal[ + "-x", + "+x", + "-y", + "+y", + "-z", + "+z", + "xy", + "xz", + "yz", + "yx", + "zx", + "zy", + ] ] | None ) = None, diff --git a/colour/graph/conversion.py b/colour/graph/conversion.py index 3be520dc3..b791f14cb 100644 --- a/colour/graph/conversion.py +++ b/colour/graph/conversion.py @@ -243,7 +243,9 @@ class Conversion_Specification( Callable converting from the ``source`` node to the ``target`` node. """ - def __new__(cls, source: str, target: str, conversion_function: Callable): + def __new__( + cls, source: str, target: str, conversion_function: Callable + ) -> Conversion_Specification: """ Return a new instance of the :class:`colour.graph.conversion.Conversion_Specification` class. @@ -316,7 +318,7 @@ def JMh_CIECAM02_to_CIECAM02(JMh: ArrayLike) -> CAM_Specification_CIECAM02: return CAM_Specification_CIECAM02(J=J, M=M, h=h) -def CAM16_to_JMh_CAM16(specification) -> NDArrayFloat: +def CAM16_to_JMh_CAM16(specification: CAM_Specification_CAM16) -> NDArrayFloat: """ Convert from *CAM16* specification to *CAM16* :math:`JMh` correlates. @@ -339,7 +341,7 @@ def CAM16_to_JMh_CAM16(specification) -> NDArrayFloat: array([ 4.1731207...e+01, 1.0743677...e-01, 2.1706796...e+02]) """ - return tstack([specification.J, specification.M, specification.h]) + return tstack([specification.J, specification.M, specification.h]) # pyright: ignore def JMh_CAM16_to_CAM16(JMh: ArrayLike) -> CAM_Specification_CAM16: @@ -370,7 +372,7 @@ def JMh_CAM16_to_CAM16(JMh: ArrayLike) -> CAM_Specification_CAM16: return CAM_Specification_CAM16(J=J, M=M, h=h) -def CIECAM16_to_JMh_CIECAM16(specification) -> NDArrayFloat: +def CIECAM16_to_JMh_CIECAM16(specification: CAM_Specification_CIECAM16) -> NDArrayFloat: """ Convert from *CIECAM16* specification to *CIECAM16* :math:`JMh` correlates. @@ -393,7 +395,7 @@ def CIECAM16_to_JMh_CIECAM16(specification) -> NDArrayFloat: array([ 4.1731207...e+01, 1.0743677...e-01, 2.1706796...e+02]) """ - return tstack([specification.J, specification.M, specification.h]) + return tstack([specification.J, specification.M, specification.h]) # pyright: ignore def JMh_CIECAM16_to_CIECAM16(JMh: ArrayLike) -> CAM_Specification_CIECAM16: @@ -424,7 +426,9 @@ def JMh_CIECAM16_to_CIECAM16(JMh: ArrayLike) -> CAM_Specification_CIECAM16: return CAM_Specification_CIECAM16(J=J, M=M, h=h) -def Hellwig2022_to_JMh_Hellwig2022(specification) -> NDArrayFloat: +def Hellwig2022_to_JMh_Hellwig2022( + specification: CAM_Specification_Hellwig2022, +) -> NDArrayFloat: """ Convert from *Hellwig and Fairchild (2022)* specification to *Hellwig and Fairchild (2022)* :math:`JMh` correlates. @@ -448,7 +452,7 @@ def Hellwig2022_to_JMh_Hellwig2022(specification) -> NDArrayFloat: array([ 4.1731207...e+01, 2.9382869...e-02, 2.1706796...e+02]) """ - return tstack([specification.J, specification.M, specification.h]) + return tstack([specification.J, specification.M, specification.h]) # pyright: ignore def JMh_Hellwig2022_to_Hellwig2022( @@ -974,7 +978,7 @@ def mired_to_CCT_D_uv(mired: ArrayLike) -> NDArrayFloat: # Programmatically defining the colourspace models polar conversions. -def _format_node_name(name): +def _format_node_name(name: str) -> str: """Format given name by applying a series of substitutions.""" for pattern, substitution in [ @@ -1128,7 +1132,7 @@ def describe_conversion_path( padding: int = 3, print_callable: Callable = print, **kwargs: Any, -): +) -> None: """ Describe the conversion path from source colour representation to target colour representation using the automatic colour conversion graph. diff --git a/colour/graph/tests/test_conversion.py b/colour/graph/tests/test_conversion.py index 50529916a..7334a4700 100644 --- a/colour/graph/tests/test_conversion.py +++ b/colour/graph/tests/test_conversion.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.graph.conversion` module.""" +from __future__ import annotations + import numpy as np import pytest @@ -28,7 +30,7 @@ class TestDescribeConversionPath: unit tests methods. """ - def test_describe_conversion_path(self): + def test_describe_conversion_path(self) -> None: """ Test :func:`colour.graph.conversion.describe_conversion_path` definition. @@ -55,7 +57,7 @@ class TestConvert: methods. """ - def test_convert(self): + def test_convert(self) -> None: """Test :func:`colour.graph.conversion.convert` definition.""" RGB_a = convert( @@ -128,7 +130,7 @@ def test_convert(self): model, ) - def test_convert_direct_keyword_argument_passing(self): + def test_convert_direct_keyword_argument_passing(self) -> None: """ Test :func:`colour.graph.conversion.convert` definition behaviour when direct keyword arguments are passed. diff --git a/colour/hints/__init__.py b/colour/hints/__init__.py index caa7830b4..1e271d07d 100644 --- a/colour/hints/__init__.py +++ b/colour/hints/__init__.py @@ -21,6 +21,7 @@ List, Literal, NewType, + NoReturn, Protocol, Set, SupportsIndex, @@ -59,6 +60,7 @@ "List", "Literal", "Mapping", + "NoReturn", "NewType", "Protocol", "Sequence", @@ -148,14 +150,14 @@ def x(self) -> NDArray: # noqa: D102 ... @x.setter - def x(self, value: ArrayLike): ... + def x(self, value: ArrayLike) -> None: ... @property def y(self) -> NDArray: # noqa: D102 ... @y.setter - def y(self, value: ArrayLike): ... + def y(self, value: ArrayLike) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... # pragma: no cover @@ -169,7 +171,7 @@ def interpolator(self) -> ProtocolInterpolator: # noqa: D102 ... @interpolator.setter - def interpolator(self, value: ProtocolInterpolator): ... + def interpolator(self, value: ProtocolInterpolator) -> None: ... def __init__(self, *args: Any, **kwargs: Any) -> None: ... # pragma: no cover diff --git a/colour/io/__init__.py b/colour/io/__init__.py index 326ffa208..42a8a4713 100644 --- a/colour/io/__init__.py +++ b/colour/io/__init__.py @@ -115,7 +115,7 @@ class io(ModuleAPI): """Define a class acting like the *io* 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) diff --git a/colour/io/fichet2021.py b/colour/io/fichet2021.py index 410789360..f1776830c 100644 --- a/colour/io/fichet2021.py +++ b/colour/io/fichet2021.py @@ -15,6 +15,7 @@ import re from collections import defaultdict +from collections.abc import ValuesView from dataclasses import dataclass, field from pathlib import Path @@ -31,9 +32,9 @@ ) from colour.constants import CONSTANT_LIGHT_SPEED from colour.hints import ( + Any, Callable, Dict, - List, Literal, NDArrayFloat, Sequence, @@ -312,7 +313,7 @@ class Specification_Fichet2021: is_emissive: bool = field(default_factory=lambda: False) is_polarised: bool = field(default_factory=lambda: False) is_bispectral: bool = field(default_factory=lambda: False) - attributes: List | None = field(default_factory=lambda: None) + attributes: Tuple = field(default_factory=lambda: ()) @staticmethod @required("OpenImageIO") @@ -413,7 +414,7 @@ def from_spectral_image(path: str | Path) -> Specification_Fichet2021: is_emissive, is_polarised, is_bispectral, - attributes, + tuple(attributes), ) @@ -507,9 +508,10 @@ def read_spectral_image_Fichet2021( def sds_and_msds_to_components_Fichet2021( sds: Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution - | MultiSpectralDistributions, + | MultiSpectralDistributions + | ValuesView, specification: Specification_Fichet2021 = Specification_Fichet2021(), - **kwargs, + **kwargs: Any, ) -> ComponentsFichet2021: """ Convert given spectral and multi-spectral distributions to @@ -716,13 +718,14 @@ def write_spectral_image_Fichet2021( components: Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution | MultiSpectralDistributions - | ComponentsFichet2021, + | ComponentsFichet2021 + | ValuesView, path: str | Path, bit_depth: Literal["float16", "float32"] = "float32", specification: Specification_Fichet2021 = Specification_Fichet2021(), components_to_RGB_callable: Callable = components_to_sRGB_Fichet2021, - **kwargs, -): + **kwargs: Any, +) -> bool: """ Write given *Fichet et al. (2021)* components to given path using *OpenImageIO*. @@ -781,7 +784,8 @@ def write_spectral_image_Fichet2021( path = str(path) if isinstance( - components, (Sequence, SpectralDistribution, MultiSpectralDistributions) + components, + (Sequence, SpectralDistribution, MultiSpectralDistributions, ValuesView), ): components = sds_and_msds_to_components_Fichet2021( components, specification, **kwargs diff --git a/colour/io/image.py b/colour/io/image.py index 9003450c0..b8997bc22 100644 --- a/colour/io/image.py +++ b/colour/io/image.py @@ -147,7 +147,7 @@ class ImageSpec: def add_attributes_to_image_specification_OpenImageIO( image_specification: ImageSpec, attributes: Sequence -): +) -> ImageSpec: """ Add given attributes to given *OpenImageIO* image specification. @@ -336,7 +336,7 @@ def read_image_OpenImageIO( ] = "float32", additional_data: bool = False, **kwargs: Any, -) -> NDArrayReal | Tuple[NDArrayReal, list]: +) -> NDArrayReal | Tuple[NDArrayReal, Tuple[Image_Specification_Attribute]]: """ Read the image data at given path using *OpenImageIO*. @@ -414,7 +414,7 @@ def read_image_OpenImageIO( ) ) - return image, extra_attributes + return image, tuple(extra_attributes) else: return image diff --git a/colour/io/luts/cinespace_csp.py b/colour/io/luts/cinespace_csp.py index ddaa76e6a..8b33034ed 100644 --- a/colour/io/luts/cinespace_csp.py +++ b/colour/io/luts/cinespace_csp.py @@ -21,7 +21,7 @@ import numpy as np -from colour.hints import ArrayLike, List, NDArrayFloat +from colour.hints import ArrayLike, List, NDArrayFloat, NDArrayInt from colour.io.luts import LUT1D, LUT3D, LUT3x1D, LUTSequence from colour.utilities import ( as_float_array, @@ -134,7 +134,7 @@ def _parse_domain_section(lines: List[str]) -> NDArrayFloat: return np.asarray(pre_LUT_padded) - def _parse_table_section(lines): + def _parse_table_section(lines: list[str]) -> tuple[NDArrayInt, NDArrayFloat]: """Parse the table at given lines.""" size = as_int_array(lines[0].split()) @@ -242,7 +242,7 @@ def _parse_table_section(lines): def write_LUT_Cinespace( - LUT: LUT3x1D | LUT3D | LUTSequence, path: str | Path, decimals: int = 7 + LUT: LUT1D | LUT3x1D | LUT3D | LUTSequence, path: str | Path, decimals: int = 7 ) -> bool: """ Write given *LUT* to given *Cinespace* *.csp* *LUT* file. diff --git a/colour/io/luts/iridas_cube.py b/colour/io/luts/iridas_cube.py index eec9f4c8c..1a2910bd3 100644 --- a/colour/io/luts/iridas_cube.py +++ b/colour/io/luts/iridas_cube.py @@ -184,7 +184,7 @@ def read_LUT_IridasCube(path: str | Path) -> LUT3x1D | LUT3D: def write_LUT_IridasCube( - LUT: LUT3x1D | LUT3D | LUTSequence, path: str | Path, decimals: int = 7 + LUT: LUT1D | LUT3x1D | LUT3D | LUTSequence, path: str | Path, decimals: int = 7 ) -> bool: """ Write given *LUT* to given *Iridas* *.cube* *LUT* file. @@ -192,8 +192,8 @@ def write_LUT_IridasCube( Parameters ---------- LUT - :class:`LUT3x1D`, :class:`LUT3D` or :class:`LUTSequence` class instance - to write at given path. + :class:`LUT1D`, :class:`LUT3x1D`, :class:`LUT3D` or :class:`LUTSequence` + class instance to write at given path. path *LUT* path. decimals diff --git a/colour/io/luts/lut.py b/colour/io/luts/lut.py index c298db55c..ef0612a6f 100644 --- a/colour/io/luts/lut.py +++ b/colour/io/luts/lut.py @@ -182,7 +182,7 @@ def table(self) -> NDArrayFloat: return self._table @table.setter - def table(self, value: ArrayLike): + def table(self, value: ArrayLike) -> None: """Setter for the **self.table** property.""" self._table = self._validate_table(value) @@ -206,7 +206,7 @@ def name(self) -> str: return self._name @name.setter - def name(self, value: str): + def name(self, value: str) -> None: """Setter for the **self.name** property.""" attest( @@ -235,7 +235,7 @@ def domain(self) -> NDArrayFloat: return self._domain @domain.setter - def domain(self, value: ArrayLike): + def domain(self, value: ArrayLike) -> None: """Setter for the **self.domain** property.""" self._domain = self._validate_domain(value) @@ -285,7 +285,7 @@ def comments(self) -> list: return self._comments @comments.setter - def comments(self, value: Sequence): + def comments(self, value: Sequence) -> None: """Setter for the **self.comments** property.""" attest( @@ -2120,7 +2120,7 @@ def apply(self, RGB: ArrayLike, **kwargs: Any) -> NDArrayFloat: def LUT_to_LUT( - LUT, + LUT: AbstractLUT, cls: Type[AbstractLUT], force_conversion: bool = False, **kwargs: Any, @@ -2130,6 +2130,8 @@ def LUT_to_LUT( Parameters ---------- + LUT + *LUT* to convert. cls *LUT* class instance. force_conversion diff --git a/colour/io/luts/operator.py b/colour/io/luts/operator.py index 2d9f8ed45..3db8f4884 100644 --- a/colour/io/luts/operator.py +++ b/colour/io/luts/operator.py @@ -97,7 +97,7 @@ def name(self) -> str: return self._name @name.setter - def name(self, value: str): + def name(self, value: str) -> None: """Setter for the **self.name** property.""" attest( @@ -126,7 +126,7 @@ def comments(self) -> List[str]: return self._comments @comments.setter - def comments(self, value: Sequence[str]): + def comments(self, value: Sequence[str]) -> None: """Setter for the **self.comments** property.""" attest( @@ -271,7 +271,7 @@ def matrix(self) -> NDArrayFloat: return self._matrix @matrix.setter - def matrix(self, value: ArrayLike): + def matrix(self, value: ArrayLike) -> None: """Setter for the **self.matrix** property.""" value = as_float_array(value) @@ -309,7 +309,7 @@ def offset(self) -> NDArrayFloat: return self._offset @offset.setter - def offset(self, value: ArrayLike): + def offset(self, value: ArrayLike) -> None: """Setter for the **self.offset** property.""" value = as_float_array(value) diff --git a/colour/io/luts/sequence.py b/colour/io/luts/sequence.py index 49176981f..9e6a576db 100644 --- a/colour/io/luts/sequence.py +++ b/colour/io/luts/sequence.py @@ -132,7 +132,7 @@ def sequence(self) -> List[ProtocolLUTSequenceItem]: return self._sequence @sequence.setter - def sequence(self, value: Sequence[ProtocolLUTSequenceItem]): + def sequence(self, value: Sequence[ProtocolLUTSequenceItem]) -> None: """Setter for the **self.sequence** property.""" for item in value: @@ -161,7 +161,7 @@ def __getitem__(self, index: int | slice) -> Any: return self._sequence[index] - def __setitem__(self, index: int | slice, value: Any): + def __setitem__(self, index: int | slice, value: Any) -> None: """ Set the *LUT* sequence at given index (or slice) with given value. @@ -182,7 +182,7 @@ def __setitem__(self, index: int | slice, value: Any): self._sequence[index] = value - def __delitem__(self, index: int | slice): + def __delitem__(self, index: int | slice) -> None: """ Delete the *LUT* sequence item(s) at given index (or slice). @@ -261,7 +261,7 @@ def __repr__(self) -> str: return f"{self.__class__.__name__}(\n{operations}\n)" - def __eq__(self, other) -> bool: + def __eq__(self, other: Any) -> bool: """ Return whether the *LUT* sequence is equal to given other object. @@ -284,7 +284,7 @@ def __eq__(self, other) -> bool: return all(self[i] == other[i] for i in range(len(self))) - def __ne__(self, other) -> bool: + def __ne__(self, other: Any) -> bool: """ Return whether the *LUT* sequence is not equal to given other object. @@ -301,7 +301,7 @@ def __ne__(self, other) -> bool: return not (self == other) - def insert(self, index: int, value: ProtocolLUTSequenceItem): + def insert(self, index: int, value: ProtocolLUTSequenceItem) -> None: """ Insert given *LUT* at given index into the *LUT* sequence. diff --git a/colour/io/luts/tests/test__init__.py b/colour/io/luts/tests/test__init__.py index 0435fc949..ad85bfd91 100644 --- a/colour/io/luts/tests/test__init__.py +++ b/colour/io/luts/tests/test__init__.py @@ -10,7 +10,8 @@ import pytest from colour.constants import TOLERANCE_ABSOLUTE_TESTS -from colour.io import LUTSequence, read_LUT, write_LUT +from colour.hints import cast +from colour.io import LUT1D, LUTSequence, read_LUT, write_LUT __author__ = "Colour Developers" __copyright__ = "Copyright 2013 Colour Developers" @@ -34,10 +35,12 @@ class TestReadLUT: methods. """ - def test_read_LUT(self): + def test_read_LUT(self) -> None: """Test :func:`colour.io.luts.__init__.read_LUT` definition.""" - LUT_1 = read_LUT(os.path.join(ROOT_LUTS, "sony_spi1d", "eotf_sRGB_1D.spi1d")) + LUT_1 = cast( + LUT1D, read_LUT(os.path.join(ROOT_LUTS, "sony_spi1d", "eotf_sRGB_1D.spi1d")) + ) np.testing.assert_allclose( LUT_1.table, @@ -72,7 +75,10 @@ def test_read_LUT(self): '"colour.models.eotf_sRGB".', ] - LUT_2 = read_LUT(os.path.join(ROOT_LUTS, "resolve_cube", "LogC_Video.cube")) + LUT_2 = cast( + LUTSequence, + read_LUT(os.path.join(ROOT_LUTS, "resolve_cube", "LogC_Video.cube")), + ) np.testing.assert_allclose( LUT_2[0].table, np.array( @@ -106,7 +112,7 @@ def test_read_LUT(self): method="Sony SPI1D", ) - def test_raise_exception_read_LUT(self): + def test_raise_exception_read_LUT(self) -> None: """ Test :func:`colour.io.luts.__init__.read_LUT` definition raised exception. @@ -125,17 +131,17 @@ class TestWriteLUT: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_LUT(self): + def test_write_LUT(self) -> None: """Test :func:`colour.io.luts.__init__.write_LUT` definition.""" LUT_1_r = read_LUT(os.path.join(ROOT_LUTS, "sony_spi1d", "eotf_sRGB_1D.spi1d")) diff --git a/colour/io/luts/tests/test_cinespace_csp.py b/colour/io/luts/tests/test_cinespace_csp.py index 692011700..e543a60ee 100644 --- a/colour/io/luts/tests/test_cinespace_csp.py +++ b/colour/io/luts/tests/test_cinespace_csp.py @@ -10,7 +10,15 @@ import pytest from colour.constants import TOLERANCE_ABSOLUTE_TESTS -from colour.io import LUT1D, LUT3x1D, read_LUT_Cinespace, write_LUT_Cinespace +from colour.hints import cast +from colour.io import ( + LUT1D, + LUT3D, + LUT3x1D, + LUTSequence, + read_LUT_Cinespace, + write_LUT_Cinespace, +) from colour.utilities import tstack __author__ = "Colour Developers" @@ -35,13 +43,16 @@ class TestReadLUTCinespace: unit tests methods. """ - def test_read_LUT_Cinespace(self): + def test_read_LUT_Cinespace(self) -> None: """ Test :func:`colour.io.luts.cinespace_csp.read_LUT_Cinespace` definition. """ - LUT_1 = read_LUT_Cinespace(os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.csp")) + LUT_1 = cast( + LUT3x1D, + read_LUT_Cinespace(os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.csp")), + ) np.testing.assert_allclose( LUT_1.table, @@ -89,22 +100,29 @@ def test_read_LUT_Cinespace(self): assert LUT_1.size == 32 assert LUT_1.comments == [] - LUT_2 = read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Demo.csp")) + LUT_2 = cast(LUT3x1D, read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Demo.csp"))) assert LUT_2.comments == ["Comments are ignored by most parsers"] np.testing.assert_array_equal(LUT_2.domain, np.array([[0, 0, 0], [1, 2, 3]])) - LUT_3 = read_LUT_Cinespace( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table.csp") + LUT_3 = cast( + LUT3D, + read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Three_Dimensional_Table.csp")), ) assert LUT_3.dimensions == 3 assert LUT_3.size == 2 - LUT_4 = read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Explicit_Domain.csp")) + LUT_4 = cast( + LUTSequence, + read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Explicit_Domain.csp")), + ) assert LUT_4[0].is_domain_explicit() is True assert LUT_4[1].table.shape == (2, 3, 4, 3) - LUT_5 = read_LUT_Cinespace( - os.path.join(ROOT_LUTS, "Uncommon_3x1D_With_Pre_Lut.csp") + LUT_5 = cast( + LUTSequence, + read_LUT_Cinespace( + os.path.join(ROOT_LUTS, "Uncommon_3x1D_With_Pre_Lut.csp") + ), ) assert isinstance(LUT_5[0], LUT3x1D) assert isinstance(LUT_5[1], LUT3x1D) @@ -116,17 +134,17 @@ class TestWriteLUTCinespace: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_LUT_Cinespace(self): + def test_write_LUT_Cinespace(self) -> None: """ Test :func:`colour.io.luts.cinespace_csp.write_LUT_Cinespace` definition. @@ -145,25 +163,30 @@ def test_write_LUT_Cinespace(self): assert LUT_1_r == LUT_1_t assert LUT_1_r == LUT_1_t - LUT_2_r = read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Demo.csp")) + LUT_2_r = cast(LUT3x1D, read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Demo.csp"))) write_LUT_Cinespace( LUT_2_r, os.path.join(self._temporary_directory, "Demo.csp") ) - LUT_2_t = read_LUT_Cinespace( - os.path.join(self._temporary_directory, "Demo.csp") + LUT_2_t = cast( + LUT3x1D, + read_LUT_Cinespace(os.path.join(self._temporary_directory, "Demo.csp")), ) assert LUT_2_r == LUT_2_t assert LUT_2_r.comments == LUT_2_t.comments - LUT_3_r = read_LUT_Cinespace( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table.csp") + LUT_3_r = cast( + LUT3D, + read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Three_Dimensional_Table.csp")), ) write_LUT_Cinespace( LUT_3_r, os.path.join(self._temporary_directory, "Three_Dimensional_Table.csp"), ) - LUT_3_t = read_LUT_Cinespace( - os.path.join(self._temporary_directory, "Three_Dimensional_Table.csp") + LUT_3_t = cast( + LUT3D, + read_LUT_Cinespace( + os.path.join(self._temporary_directory, "Three_Dimensional_Table.csp") + ), ) assert LUT_3_r == LUT_3_t @@ -179,16 +202,23 @@ def test_write_LUT_Cinespace(self): LUT_4_t, os.path.join(self._temporary_directory, "Ragged_Domain.csp"), ) - LUT_4_r = read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Ragged_Domain.csp")) + LUT_4_r = cast( + LUT3x1D, read_LUT_Cinespace(os.path.join(ROOT_LUTS, "Ragged_Domain.csp")) + ) np.testing.assert_allclose( LUT_4_t.domain, LUT_4_r.domain, atol=TOLERANCE_ABSOLUTE_TESTS ) np.testing.assert_allclose(LUT_4_t.table, LUT_4_r.table, atol=5e-5) - LUT_5_r = read_LUT_Cinespace( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.csp") + LUT_5_r = cast( + LUTSequence, + read_LUT_Cinespace( + os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.csp") + ), + ) + LUT_5_r.sequence[0] = LUT_5_r.sequence[0].convert( # pyright: ignore + LUT1D, force_conversion=True ) - LUT_5_r.sequence[0] = LUT_5_r.sequence[0].convert(LUT1D, force_conversion=True) write_LUT_Cinespace( LUT_5_r, os.path.join( @@ -196,21 +226,30 @@ def test_write_LUT_Cinespace(self): "Three_Dimensional_Table_With_Shaper.csp", ), ) - LUT_5_r = read_LUT_Cinespace( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.csp") + LUT_5_r = cast( + LUTSequence, + read_LUT_Cinespace( + os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.csp") + ), ) - LUT_5_t = read_LUT_Cinespace( - os.path.join( - self._temporary_directory, - "Three_Dimensional_Table_With_Shaper.csp", - ) + LUT_5_t = cast( + LUTSequence, + read_LUT_Cinespace( + os.path.join( + self._temporary_directory, + "Three_Dimensional_Table_With_Shaper.csp", + ) + ), ) assert LUT_5_r == LUT_5_t - LUT_6_r = read_LUT_Cinespace( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.csp") + LUT_6_r = cast( + LUTSequence, + read_LUT_Cinespace( + os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.csp") + ), ) - LUT_6_r.sequence[0] = LUT_6_r.sequence[0].convert( + LUT_6_r.sequence[0] = LUT_6_r.sequence[0].convert( # pyright: ignore LUT3x1D, force_conversion=True ) write_LUT_Cinespace( @@ -220,30 +259,40 @@ def test_write_LUT_Cinespace(self): "Three_Dimensional_Table_With_Shaper.csp", ), ) - LUT_6_r = read_LUT_Cinespace( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.csp") + LUT_6_r = cast( + LUTSequence, + read_LUT_Cinespace( + os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.csp") + ), ) - LUT_6_t = read_LUT_Cinespace( - os.path.join( - self._temporary_directory, - "Three_Dimensional_Table_With_Shaper.csp", - ) + LUT_6_t = cast( + LUTSequence, + read_LUT_Cinespace( + os.path.join( + self._temporary_directory, + "Three_Dimensional_Table_With_Shaper.csp", + ) + ), ) assert LUT_6_r == LUT_6_t - LUT_7_r = read_LUT_Cinespace( - os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.csp") + LUT_7_r = cast( + LUT3x1D, + read_LUT_Cinespace(os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.csp")), ) write_LUT_Cinespace( - LUT_7_r.convert(LUT1D, force_conversion=True), + cast(LUT1D, LUT_7_r.convert(LUT1D, force_conversion=True)), os.path.join(self._temporary_directory, "ACES_Proxy_10_to_ACES.csp"), ) - LUT_7_t = read_LUT_Cinespace( - os.path.join(self._temporary_directory, "ACES_Proxy_10_to_ACES.csp") + LUT_7_t = cast( + LUT3x1D, + read_LUT_Cinespace( + os.path.join(self._temporary_directory, "ACES_Proxy_10_to_ACES.csp") + ), ) assert LUT_7_r == LUT_7_t - def test_raise_exception_write_LUT_Cinespace(self): + def test_raise_exception_write_LUT_Cinespace(self) -> None: """ Test :func:`colour.io.luts.cinespace_csp.write_LUT_Cinespace` definition raised exception. diff --git a/colour/io/luts/tests/test_common.py b/colour/io/luts/tests/test_common.py index 5ef5cb618..e44ec3539 100644 --- a/colour/io/luts/tests/test_common.py +++ b/colour/io/luts/tests/test_common.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.io.luts.common` module.""" +from __future__ import annotations + from colour.io.luts.common import path_to_title __author__ = "Colour Developers" @@ -20,7 +22,7 @@ class TestPathToTitle: methods. """ - def test_path_to_title(self): + def test_path_to_title(self) -> None: """Test :func:`colour.io.luts.common.path_to_title` definition.""" assert ( diff --git a/colour/io/luts/tests/test_iridas_cube.py b/colour/io/luts/tests/test_iridas_cube.py index b65e80f20..28bdb53fd 100644 --- a/colour/io/luts/tests/test_iridas_cube.py +++ b/colour/io/luts/tests/test_iridas_cube.py @@ -9,6 +9,7 @@ import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS +from colour.hints import cast from colour.io import ( LUT1D, LUTSequence, @@ -38,7 +39,7 @@ class TestReadLUTIridasCube: unit tests methods. """ - def test_read_LUT_IridasCube(self): + def test_read_LUT_IridasCube(self) -> None: """ Test :func:`colour.io.luts.iridas_cube.read_LUT_IridasCube` definition. @@ -111,17 +112,17 @@ class TestWriteLUTIridasCube: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_LUT_IridasCube(self): + def test_write_LUT_IridasCube(self) -> None: """ Test :func:`colour.io.luts.iridas_cube.write_LUT_IridasCube` definition. @@ -171,7 +172,7 @@ def test_write_LUT_IridasCube(self): os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.cube") ) write_LUT_IridasCube( - LUT_4_r.convert(LUT1D, force_conversion=True), + cast(LUT1D, LUT_4_r.convert(LUT1D, force_conversion=True)), os.path.join(self._temporary_directory, "ACES_Proxy_10_to_ACES.cube"), ) LUT_4_t = read_LUT_IridasCube( diff --git a/colour/io/luts/tests/test_lut.py b/colour/io/luts/tests/test_lut.py index daebf7e97..6f2121856 100644 --- a/colour/io/luts/tests/test_lut.py +++ b/colour/io/luts/tests/test_lut.py @@ -56,7 +56,7 @@ class TestAbstractLUT: """Define :class:`colour.io.luts.lut.AbstractLUT` class unit tests methods.""" - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -71,7 +71,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(AbstractLUT) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -110,39 +110,43 @@ class FixtureAbstractLUT: :class:`colour.io.luts.lut.LUT3D` classes fixture. """ - @pytest.fixture(autouse=True) - def setup_fixture_abstract_lut(self) -> None: - """Configure the class instance.""" - + def __init__(self) -> None: self._LUT_factory: Any = None - self._size: int | None = None - self._dimensions: int | None = None - self._domain_1: NDArrayFloat | None = None - self._domain_2: NDArrayFloat | None = None - self._domain_3: NDArrayFloat | None = None - self._table_1: NDArrayFloat | None = None - self._table_2: NDArrayFloat | None = None - self._table_3: NDArrayFloat | None = None - self._table_1_kwargs: dict | None = None - self._table_2_kwargs: dict | None = None - self._table_3_kwargs: dict | None = None - self._interpolator_1: Callable | Type[ProtocolInterpolator] | None = None + self._size: int = -1 + self._dimensions: int = -1 + self._domain_1: NDArrayFloat = np.array([]) + self._domain_2: NDArrayFloat = np.array([]) + self._domain_3: NDArrayFloat = np.array([]) + self._domain_4: NDArrayFloat = np.array([]) + self._table_1: NDArrayFloat = np.array([]) + self._table_2: NDArrayFloat = np.array([]) + self._table_3: NDArrayFloat = np.array([]) + self._table_1_kwargs: dict = {} + self._table_2_kwargs: dict = {} + self._table_3_kwargs: dict = {} + self._interpolator_1: Callable | Type[ProtocolInterpolator] = LinearInterpolator self._interpolator_kwargs_1: dict = {} - self._interpolator_2: Callable | Type[ProtocolInterpolator] | None = None + self._interpolator_2: Callable | Type[ProtocolInterpolator] = LinearInterpolator self._interpolator_kwargs_2: dict = {} self._invert_kwargs_1: dict = {} self._invert_kwargs_2: dict = {} - self._str: str | None = None + self._str: str = "" self._repr: str | None = None - self._inverted_apply_1: NDArrayFloat | None = None - self._inverted_apply_2: NDArrayFloat | None = None - self._applied_1: NDArrayFloat | None = None - self._applied_2: NDArrayFloat | None = None - self._applied_3: NDArrayFloat | None = None - self._applied_4: NDArrayFloat | None = None - - def test_required_methods(self): + self._inverted_apply_1: NDArrayFloat = np.array([]) + self._inverted_apply_2: NDArrayFloat = np.array([]) + self._applied_1: NDArrayFloat = np.array([]) + self._applied_2: NDArrayFloat = np.array([]) + self._applied_3: NDArrayFloat = np.array([]) + self._applied_4: NDArrayFloat = np.array([]) + + @pytest.fixture(autouse=True) + def setup_fixture_abstract_lut(self) -> None: + """Configure the class instance.""" + + self.__init__() + + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -158,7 +162,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(class_) - def test__init__(self): + def test__init__(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.__init__`, :class:`colour.io.luts.lut.LUT3x1D.__init__` and @@ -181,7 +185,7 @@ def test__init__(self): self._LUT_factory(self._table_3, domain=self._domain_3), self._LUT_factory ) - def test_table(self): + def test_table(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.table`, :class:`colour.io.luts.lut.LUT3x1D.table` and @@ -196,7 +200,7 @@ def test_table(self): LUT.table = table_1 np.testing.assert_allclose(LUT.table, table_1, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_name(self): + def test_name(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.name`, :class:`colour.io.luts.lut.LUT3x1D.name` and @@ -211,7 +215,7 @@ def test_name(self): assert LUT.name == f"Unity {self._table_1.shape[0]}" - def test_domain(self): + def test_domain(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.domain`, :class:`colour.io.luts.lut.LUT3x1D.domain` and @@ -226,7 +230,7 @@ def test_domain(self): LUT.domain = domain np.testing.assert_array_equal(LUT.domain, domain) - def test_size(self): + def test_size(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.size`, :class:`colour.io.luts.lut.LUT3x1D.size` and @@ -237,7 +241,7 @@ def test_size(self): assert LUT.size == LUT.table.shape[0] - def test_dimensions(self): + def test_dimensions(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.dimensions`, :class:`colour.io.luts.lut.LUT3x1D.dimensions` and @@ -248,7 +252,7 @@ def test_dimensions(self): assert LUT.dimensions == self._dimensions - def test_comments(self): + def test_comments(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.comments`, :class:`colour.io.luts.lut.LUT3x1D.comments` and @@ -263,7 +267,7 @@ def test_comments(self): assert LUT.comments == comments - def test__str__(self): + def test__str__(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.__str__`, :class:`colour.io.luts.lut.LUT3x1D.__str__` and @@ -274,7 +278,7 @@ def test__str__(self): assert str(LUT) == self._str - def test__repr__(self): + def test__repr__(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.__repr__`, :class:`colour.io.luts.lut.LUT3x1D.__repr__` and @@ -294,7 +298,7 @@ def test__repr__(self): assert repr(LUT) == self._repr - def test__eq__(self): + def test__eq__(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.__eq__`, :class:`colour.io.luts.lut.LUT3x1D.__eq__` and @@ -306,7 +310,7 @@ def test__eq__(self): assert LUT_1 == LUT_2 - def test__ne__(self): + def test__ne__(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.__ne__`, :class:`colour.io.luts.lut.LUT3x1D.__ne__` and @@ -323,7 +327,7 @@ def test__ne__(self): LUT_2.domain = self._domain_1 * 0.8 + 0.1 assert LUT_1 != LUT_2 - def test_is_domain_explicit(self): + def test_is_domain_explicit(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.is_domain_explicit`, :class:`colour.io.luts.lut.LUT3x1D.is_domain_explicit` and @@ -336,7 +340,7 @@ def test_is_domain_explicit(self): self._table_3, domain=self._domain_3 ).is_domain_explicit() - def test_arithmetical_operation(self): + def test_arithmetical_operation(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.arithmetical_operation`, :class:`colour.io.luts.lut.LUT3x1D.arithmetical_operation` and @@ -450,7 +454,7 @@ def test_arithmetical_operation(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_linear_table(self): + def test_linear_table(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.linear_table`, :class:`colour.io.luts.lut.LUT3x1D.linear_table` and @@ -471,7 +475,7 @@ def test_linear_table(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_copy(self): + def test_copy(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.copy`, :class:`colour.io.luts.lut.LUT3x1D.copy` and @@ -483,7 +487,7 @@ def test_copy(self): assert LUT_1 is not LUT_1.copy() assert LUT_1.copy() == LUT_1 - def test_invert(self): + def test_invert(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.invert`, :class:`colour.io.luts.lut.LUT3x1D.invert` and @@ -525,7 +529,7 @@ def test_invert(self): except NotImplementedError: pass - def test_apply(self): + def test_apply(self) -> None: """ Test :class:`colour.io.luts.lut.LUT1D.apply`, :class:`colour.io.luts.lut.LUT3x1D.apply` and @@ -954,7 +958,7 @@ def setup_test_lut_3_d(self) -> None: Size : (33, 33, 33, 3) """ ).strip() - self._repr = None + self._repr = None # pyright: ignore self._inverted_apply_1 = np.array( [ [ @@ -1066,7 +1070,7 @@ class TestLUT_to_LUT: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._domain = np.array([[0.0, -0.1, -0.2], [1.0, 1.5, 3.0]]) @@ -1078,7 +1082,7 @@ def setup_method(self): ) self._LUT_3 = LUT3D(LUT3D.linear_table(16) ** (1 / 2.2), domain=self._domain) - def test_LUT_to_LUT(self): + def test_LUT_to_LUT(self) -> None: """Test :func:`colour.io.luts.lut.LUT_to_LUT` definition.""" # "LUT" 1D to "LUT" 1D. diff --git a/colour/io/luts/tests/test_operator.py b/colour/io/luts/tests/test_operator.py index 416ce1ba3..598f65924 100644 --- a/colour/io/luts/tests/test_operator.py +++ b/colour/io/luts/tests/test_operator.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.io.luts.operator` module.""" +from __future__ import annotations + import textwrap import numpy as np @@ -27,7 +29,7 @@ class TestAbstractLUTSequenceOperator: unit tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("name", "comments") @@ -35,7 +37,7 @@ def test_required_attributes(self): for method in required_attributes: assert method in dir(AbstractLUTSequenceOperator) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("apply",) @@ -50,7 +52,7 @@ class TestLUTOperatorMatrix: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._lut_operator_matrix = LUTOperatorMatrix( @@ -60,7 +62,7 @@ def setup_method(self): comments=["A first comment.", "A second comment."], ) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("matrix", "offset") @@ -68,7 +70,7 @@ def test_required_attributes(self): for method in required_attributes: assert method in dir(LUTOperatorMatrix) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__", "__repr__", "__eq__", "__ne__", "apply") @@ -76,7 +78,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(LUTOperatorMatrix) - def test_matrix(self): + def test_matrix(self) -> None: """ Test :class:`colour.io.luts.operator.LUTOperatorMatrix.matrix` property. @@ -87,7 +89,7 @@ def test_matrix(self): lut_operator_matrix = LUTOperatorMatrix(M) np.testing.assert_array_equal(lut_operator_matrix.matrix, np.identity(4)) - def test_offset(self): + def test_offset(self) -> None: """ Test :class:`colour.io.luts.operator.LUTOperatorMatrix.offset` property. @@ -98,7 +100,7 @@ def test_offset(self): lut_operator_matrix = LUTOperatorMatrix(np.identity(3), offset) np.testing.assert_array_equal(lut_operator_matrix.offset, zeros(4)) - def test__str__(self): + def test__str__(self) -> None: """ Test :class:`colour.io.luts.operator.LUTOperatorMatrix.__str__` method. @@ -124,7 +126,7 @@ def test__str__(self): ) ) - def test__repr__(self): + def test__repr__(self) -> None: """ Test :class:`colour.io.luts.operator.LUTOperatorMatrix.__repr__` method. @@ -143,7 +145,7 @@ def test__repr__(self): ) ) - def test__eq__(self): + def test__eq__(self) -> None: """Test :class:`colour.io.luts.operator.LUTOperatorMatrix.__eq__` method.""" matrix = LUTOperatorMatrix( @@ -153,7 +155,7 @@ def test__eq__(self): assert self._lut_operator_matrix == matrix - def test__neq__(self): + def test__neq__(self) -> None: """ Test :class:`colour.io.luts.operator.LUTOperatorMatrix.__neq__` method. @@ -163,7 +165,7 @@ def test__neq__(self): assert self._lut_operator_matrix != matrix - def test_apply(self): + def test_apply(self) -> None: """Test :class:`colour.io.luts.operator.LUTOperatorMatrix.apply` method.""" samples = np.linspace(0, 1, 5) diff --git a/colour/io/luts/tests/test_resolve_cube.py b/colour/io/luts/tests/test_resolve_cube.py index 4cb24be0a..436c2ffd4 100644 --- a/colour/io/luts/tests/test_resolve_cube.py +++ b/colour/io/luts/tests/test_resolve_cube.py @@ -10,7 +10,15 @@ import pytest from colour.constants import TOLERANCE_ABSOLUTE_TESTS -from colour.io import LUT1D, read_LUT_ResolveCube, write_LUT_ResolveCube +from colour.hints import cast +from colour.io import ( + LUT1D, + LUT3D, + LUT3x1D, + LUTSequence, + read_LUT_ResolveCube, + write_LUT_ResolveCube, +) __author__ = "Colour Developers" __copyright__ = "Copyright 2013 Colour Developers" @@ -34,14 +42,15 @@ class TestReadLUTResolveCube: unit tests methods. """ - def test_read_LUT_ResolveCube(self): + def test_read_LUT_ResolveCube(self) -> None: """ Test :func:`colour.io.luts.resolve_cube.read_LUT_ResolveCube` definition. """ - LUT_1 = read_LUT_ResolveCube( - os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.cube") + LUT_1 = cast( + LUT3x1D, + read_LUT_ResolveCube(os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.cube")), ) np.testing.assert_allclose( @@ -90,17 +99,25 @@ def test_read_LUT_ResolveCube(self): assert LUT_1.size == 32 assert LUT_1.comments == [] - LUT_2 = read_LUT_ResolveCube(os.path.join(ROOT_LUTS, "Demo.cube")) + LUT_2 = cast( + LUT3x1D, read_LUT_ResolveCube(os.path.join(ROOT_LUTS, "Demo.cube")) + ) assert LUT_2.comments == ["Comments can't go anywhere"] np.testing.assert_array_equal(LUT_2.domain, np.array([[0, 0, 0], [3, 3, 3]])) - LUT_3 = read_LUT_ResolveCube( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table.cube") + LUT_3 = cast( + LUT3D, + read_LUT_ResolveCube( + os.path.join(ROOT_LUTS, "Three_Dimensional_Table.cube") + ), ) assert LUT_3.dimensions == 3 assert LUT_3.size == 2 - LUT_4 = read_LUT_ResolveCube(os.path.join(ROOT_LUTS, "LogC_Video.cube")) + LUT_4 = cast( + LUTSequence, + read_LUT_ResolveCube(os.path.join(ROOT_LUTS, "LogC_Video.cube")), + ) np.testing.assert_allclose( LUT_4[0].table, np.array( @@ -134,17 +151,17 @@ class TestWriteLUTResolveCube: definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_LUT_ResolveCube(self): + def test_write_LUT_ResolveCube(self) -> None: """ Test :func:`colour.io.luts.resolve_cube.write_LUT_ResolveCube` definition. @@ -165,21 +182,27 @@ def test_write_LUT_ResolveCube(self): assert LUT_1_r == LUT_1_t - LUT_2_r = read_LUT_ResolveCube(os.path.join(ROOT_LUTS, "Demo.cube")) + LUT_2_r = cast( + LUT3x1D, read_LUT_ResolveCube(os.path.join(ROOT_LUTS, "Demo.cube")) + ) write_LUT_ResolveCube( LUT_2_r, os.path.join(self._temporary_directory, "Demo.cube") ) - LUT_2_t = read_LUT_ResolveCube( - os.path.join(self._temporary_directory, "Demo.cube") + LUT_2_t = cast( + LUT3x1D, + read_LUT_ResolveCube(os.path.join(self._temporary_directory, "Demo.cube")), ) assert LUT_2_r == LUT_2_t assert LUT_2_r.comments == LUT_2_t.comments - LUT_3_r = read_LUT_ResolveCube( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table.cube") + LUT_3_r = cast( + LUT3D, + read_LUT_ResolveCube( + os.path.join(ROOT_LUTS, "Three_Dimensional_Table.cube") + ), ) write_LUT_ResolveCube( @@ -187,17 +210,24 @@ def test_write_LUT_ResolveCube(self): os.path.join(self._temporary_directory, "Three_Dimensional_Table.cube"), ) - LUT_3_t = read_LUT_ResolveCube( - os.path.join(self._temporary_directory, "Three_Dimensional_Table.cube") + LUT_3_t = cast( + LUT3D, + read_LUT_ResolveCube( + os.path.join(self._temporary_directory, "Three_Dimensional_Table.cube") + ), ) - assert LUT_3_r == LUT_3_t - LUT_4_r = read_LUT_ResolveCube( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.cube") + LUT_4_r = cast( + LUTSequence, + read_LUT_ResolveCube( + os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.cube") + ), ) - LUT_4_r.sequence[0] = LUT_4_r.sequence[0].convert(LUT1D, force_conversion=True) + LUT_4_r.sequence[0] = LUT_4_r.sequence[0].convert( # pyright: ignore + LUT1D, force_conversion=True + ) write_LUT_ResolveCube( LUT_4_r, @@ -207,35 +237,45 @@ def test_write_LUT_ResolveCube(self): ), ) - LUT_4_t = read_LUT_ResolveCube( - os.path.join( - self._temporary_directory, - "Three_Dimensional_Table_With_Shaper.cube", - ) + LUT_4_t = cast( + LUTSequence, + read_LUT_ResolveCube( + os.path.join( + self._temporary_directory, + "Three_Dimensional_Table_With_Shaper.cube", + ) + ), ) - LUT_4_r = read_LUT_ResolveCube( - os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.cube") + LUT_4_r = cast( + LUTSequence, + read_LUT_ResolveCube( + os.path.join(ROOT_LUTS, "Three_Dimensional_Table_With_Shaper.cube") + ), ) assert LUT_4_r == LUT_4_t - LUT_5_r = read_LUT_ResolveCube( - os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.cube") + LUT_5_r = cast( + LUT3x1D, + read_LUT_ResolveCube(os.path.join(ROOT_LUTS, "ACES_Proxy_10_to_ACES.cube")), ) write_LUT_ResolveCube( - LUT_5_r.convert(LUT1D, force_conversion=True), + cast(LUT1D, LUT_5_r.convert(LUT1D, force_conversion=True)), os.path.join(self._temporary_directory, "ACES_Proxy_10_to_ACES.cube"), ) - LUT_5_t = read_LUT_ResolveCube( - os.path.join(self._temporary_directory, "ACES_Proxy_10_to_ACES.cube") + LUT_5_t = cast( + LUT3x1D, + read_LUT_ResolveCube( + os.path.join(self._temporary_directory, "ACES_Proxy_10_to_ACES.cube") + ), ) assert LUT_5_r == LUT_5_t - def test_raise_exception_write_LUT_ResolveCube(self): + def test_raise_exception_write_LUT_ResolveCube(self) -> None: """ Test :func:`colour.io.luts.resolve_cube.write_LUT_ResolveCube` definition raised exception. diff --git a/colour/io/luts/tests/test_sequence.py b/colour/io/luts/tests/test_sequence.py index ee7967b23..806335de3 100644 --- a/colour/io/luts/tests/test_sequence.py +++ b/colour/io/luts/tests/test_sequence.py @@ -36,7 +36,7 @@ class TestLUTSequence: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._LUT_1 = LUT1D(LUT1D.linear_table(16) + 0.125, "Nemo 1D") @@ -48,7 +48,7 @@ def setup_method(self): self._RGB = tstack([samples, samples, samples]) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("sequence",) @@ -56,7 +56,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(LUTSequence) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -77,7 +77,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(LUTSequence) - def test_sequence(self): + def test_sequence(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.sequence` property.""" sequence = [self._LUT_1, self._LUT_2, self._LUT_3] @@ -85,19 +85,19 @@ def test_sequence(self): LUT_sequence.sequence = sequence assert self._LUT_sequence.sequence == sequence - def test__init__(self): + def test__init__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__init__` method.""" assert LUTSequence(self._LUT_1, self._LUT_2, self._LUT_3) == self._LUT_sequence - def test__getitem__(self): + def test__getitem__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__getitem__` method.""" assert self._LUT_sequence[0] == self._LUT_1 assert self._LUT_sequence[1] == self._LUT_2 assert self._LUT_sequence[2] == self._LUT_3 - def test__setitem__(self): + def test__setitem__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__setitem__` method.""" LUT_sequence = self._LUT_sequence.copy() @@ -109,7 +109,7 @@ def test__setitem__(self): assert LUT_sequence[2] == self._LUT_2 assert LUT_sequence[0] == self._LUT_3 - def test__delitem__(self): + def test__delitem__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__delitem__` method.""" LUT_sequence = self._LUT_sequence.copy() @@ -119,12 +119,12 @@ def test__delitem__(self): assert LUT_sequence[0] == self._LUT_3 - def test__len__(self): + def test__len__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__len__` method.""" assert len(self._LUT_sequence) == 3 - def test__str__(self): + def test__str__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__str__` method.""" assert str(self._LUT_sequence) == ( @@ -165,7 +165,7 @@ def test__str__(self): ).strip() ) - def test__repr__(self): + def test__repr__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__repr__` method.""" LUT_sequence = self._LUT_sequence.copy() @@ -360,7 +360,7 @@ def test__repr__(self): ) ) - def test__eq__(self): + def test__eq__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__eq__` method.""" LUT_sequence_1 = LUTSequence(self._LUT_1, self._LUT_2, self._LUT_3) @@ -372,14 +372,14 @@ def test__eq__(self): assert LUT_sequence_1 != LUT_sequence_2 - def test__neq__(self): + def test__neq__(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.__neq__` method.""" assert self._LUT_sequence != LUTSequence( self._LUT_1, self._LUT_2.copy() * 0.75, self._LUT_3 ) - def test_insert(self): + def test_insert(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.insert` method.""" LUT_sequence = self._LUT_sequence.copy() @@ -393,7 +393,7 @@ def test_insert(self): self._LUT_3, ) - def test_apply(self): + def test_apply(self) -> None: """Test :class:`colour.io.luts.sequence.LUTSequence.apply` method.""" class GammaOperator(AbstractLUTSequenceOperator): diff --git a/colour/io/luts/tests/test_sony_spi1d.py b/colour/io/luts/tests/test_sony_spi1d.py index 0f38327c2..8c3d07e2e 100644 --- a/colour/io/luts/tests/test_sony_spi1d.py +++ b/colour/io/luts/tests/test_sony_spi1d.py @@ -33,7 +33,7 @@ class TestReadLUTSonySPI1D: unit tests methods. """ - def test_read_LUT_SonySPI1D(self): + def test_read_LUT_SonySPI1D(self) -> None: """Test :func:`colour.io.luts.sony_spi1d.read_LUT_SonySPI1D` definition.""" LUT_1 = read_LUT_SonySPI1D(os.path.join(ROOT_LUTS, "eotf_sRGB_1D.spi1d")) @@ -87,17 +87,17 @@ class TestWriteLUTSonySPI1D: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_LUT_SonySPI1D(self): + def test_write_LUT_SonySPI1D(self) -> None: """Test :func:`colour.io.luts.sony_spi1d.write_LUT_SonySPI1D` definition.""" LUT_1_r = read_LUT_SonySPI1D(os.path.join(ROOT_LUTS, "eotf_sRGB_1D.spi1d")) diff --git a/colour/io/luts/tests/test_sony_spi3d.py b/colour/io/luts/tests/test_sony_spi3d.py index 84c041538..52e2e00a9 100644 --- a/colour/io/luts/tests/test_sony_spi3d.py +++ b/colour/io/luts/tests/test_sony_spi3d.py @@ -39,7 +39,7 @@ class TestReadLUTSonySPI3D: unit tests methods. """ - def test_read_LUT_SonySPI3D(self): + def test_read_LUT_SonySPI3D(self) -> None: """Test :func:`colour.io.luts.sony_spi3d.read_LUT_SonySPI3D` definition.""" LUT_1 = read_LUT_SonySPI3D(os.path.join(ROOT_LUTS, "Colour_Correct.spi3d")) @@ -179,17 +179,17 @@ class TestWriteLUTSonySPI3D: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_LUT_SonySPI3D(self): + def test_write_LUT_SonySPI3D(self) -> None: """Test :func:`colour.io.luts.sony_spi3d.write_LUT_SonySPI3D` definition.""" LUT_r = read_LUT_SonySPI3D(os.path.join(ROOT_LUTS, "Colour_Correct.spi3d")) diff --git a/colour/io/luts/tests/test_sony_spimtx.py b/colour/io/luts/tests/test_sony_spimtx.py index b04d3bb9d..88f839be5 100644 --- a/colour/io/luts/tests/test_sony_spimtx.py +++ b/colour/io/luts/tests/test_sony_spimtx.py @@ -33,7 +33,7 @@ class TestReadLUTSonySPImtx: unit tests methods. """ - def test_read_LUT_SonySPImtx(self): + def test_read_LUT_SonySPImtx(self) -> None: """ Test :func:`colour.io.luts.sony_spimtx.read_LUT_SonySPImtx` definition. @@ -107,17 +107,17 @@ class TestWriteLUTSonySPImtx: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_LUT_SonySPImtx(self): + def test_write_LUT_SonySPImtx(self) -> None: """ Test :func:`colour.io.luts.sony_spimtx.write_LUT_SonySPImtx` definition. diff --git a/colour/io/tests/test_ctl.py b/colour/io/tests/test_ctl.py index f2e533b95..ebcfe500d 100644 --- a/colour/io/tests/test_ctl.py +++ b/colour/io/tests/test_ctl.py @@ -43,17 +43,17 @@ class TestCtlRender: """Define :func:`colour.io.ctl.ctl_render` definition unit tests methods.""" - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_ctl_render(self): # pragma: no cover + def test_ctl_render(self) -> None: # pragma: no cover """Test :func:`colour.io.ctl.ctl_render` definition.""" if not is_ctlrender_installed(): @@ -123,7 +123,7 @@ class TestProcessImageCtl: methods. """ - def test_process_image_ctl(self): # pragma: no cover + def test_process_image_ctl(self) -> None: # pragma: no cover """Test :func:`colour.io.ctl.process_image_ctl` definition.""" if not is_ctlrender_installed(): @@ -201,7 +201,7 @@ class TestTemplateCtlTransformFloat: tests methods. """ - def test_template_ctl_transform_float(self): + def test_template_ctl_transform_float(self) -> None: """Test :func:`colour.io.ctl.template_ctl_transform_float` definition.""" ctl_foo_bar_float = template_ctl_transform_float( @@ -254,7 +254,7 @@ class TestTemplateCtlTransformFloat3: tests methods. """ - def test_template_ctl_transform_float3(self): + def test_template_ctl_transform_float3(self) -> None: """Test :func:`colour.io.ctl.template_ctl_transform_float3` definition.""" ctl_foo_bar_float3 = template_ctl_transform_float3( diff --git a/colour/io/tests/test_fichet2021.py b/colour/io/tests/test_fichet2021.py index 1bc145328..36a78e7c0 100644 --- a/colour/io/tests/test_fichet2021.py +++ b/colour/io/tests/test_fichet2021.py @@ -16,7 +16,9 @@ sds_and_msds_to_msds, ) from colour.constants import CONSTANT_LIGHT_SPEED, TOLERANCE_ABSOLUTE_TESTS +from colour.hints import NDArrayFloat, Tuple, cast from colour.io import ( + ComponentsFichet2021, Specification_Fichet2021, read_spectral_image_Fichet2021, sd_to_spectrum_attribute_Fichet2021, @@ -57,7 +59,7 @@ class TestMatchGroupsToNm: tests methods. """ - def test_match_groups_to_nm(self): + def test_match_groups_to_nm(self) -> None: """Test :func:`colour.io.fichet2021.match_groups_to_nm` definition.""" np.testing.assert_allclose( @@ -85,7 +87,7 @@ class TestSdToSpectrumAttributeFichet2021: definition unit tests methods. """ - def test_sd_to_spectrum_attribute_Fichet2021(self): + def test_sd_to_spectrum_attribute_Fichet2021(self) -> None: """ Test :func:`colour.io.fichet2021.\ sd_to_spectrum_attribute_Fichet2021` definition. @@ -103,7 +105,7 @@ class TestSpectrumAttributeToSdFichet2021: definition unit tests methods. """ - def test_spectrum_attribute_to_sd_Fichet2021(self): + def test_spectrum_attribute_to_sd_Fichet2021(self) -> None: """ Test :func:`colour.io.fichet2021.\ spectrum_attribute_to_sd_Fichet2021` definition. @@ -132,7 +134,7 @@ class TestSdsAndMsdsToComponentsFichet2021: definition unit tests methods. """ - def test_sds_and_msds_to_components_Fichet2021(self): + def test_sds_and_msds_to_components_Fichet2021(self) -> None: """ Test :func:`colour.io.fichet2021.\ sds_and_msds_to_components_Fichet2021` definition. @@ -173,7 +175,7 @@ class TestComponentsToSRGBFichet2021: definition unit tests methods. """ - def test_components_to_sRGB_Fichet2021(self): + def test_components_to_sRGB_Fichet2021(self) -> None: """ Test :func:`colour.io.fichet2021.components_to_sRGB_Fichet2021` definition. @@ -189,7 +191,7 @@ def test_components_to_sRGB_Fichet2021(self): RGB, attributes = components_to_sRGB_Fichet2021(components, specification) np.testing.assert_allclose( - RGB, + cast(NDArrayFloat, RGB), np.array([[[0.17998291, 0.18000802, 0.18000908]]]), atol=TOLERANCE_ABSOLUTE_TESTS, ) @@ -239,7 +241,7 @@ def test_components_to_sRGB_Fichet2021(self): RGB, attributes = components_to_sRGB_Fichet2021(components, specification) np.testing.assert_allclose( - RGB, + cast(NDArrayFloat, RGB), np.array( [ [ @@ -291,10 +293,10 @@ def test_components_to_sRGB_Fichet2021(self): ) -def _test_spectral_image_D65(path): +def _test_spectral_image_D65(path: str) -> None: """Test the *D65* spectral image.""" - components = read_spectral_image_Fichet2021(path) + components = cast(ComponentsFichet2021, read_spectral_image_Fichet2021(path)) assert "S0" in components @@ -310,8 +312,11 @@ def _test_spectral_image_D65(path): atol=0.05, ) - components, specification = read_spectral_image_Fichet2021( - os.path.join(ROOT_RESOURCES, "D65.exr"), additional_data=True + components, specification = cast( + Tuple[ComponentsFichet2021, Specification_Fichet2021], + read_spectral_image_Fichet2021( + os.path.join(ROOT_RESOURCES, "D65.exr"), additional_data=True + ), ) assert specification.is_emissive is True @@ -349,11 +354,12 @@ def _test_spectral_image_D65(path): ) -def _test_spectral_image_Ohta1997(path): +def _test_spectral_image_Ohta1997(path: str) -> None: """Test the *Ohta (1997)* spectral image.""" - components, specification = read_spectral_image_Fichet2021( - path, additional_data=True + components, specification = cast( + Tuple[ComponentsFichet2021, Specification_Fichet2021], + read_spectral_image_Fichet2021(path, additional_data=True), ) assert "T" in components @@ -382,11 +388,12 @@ def _test_spectral_image_Ohta1997(path): assert specification.is_bispectral is False -def _test_spectral_image_Polarised(path): +def _test_spectral_image_Polarised(path: str) -> None: """Test the *Polarised* spectral image.""" - components, specification = read_spectral_image_Fichet2021( - path, additional_data=True + components, specification = cast( + Tuple[ComponentsFichet2021, Specification_Fichet2021], + read_spectral_image_Fichet2021(path, additional_data=True), ) assert list(components.keys()) == ["S0", "S1", "S2", "S3"] @@ -396,11 +403,12 @@ def _test_spectral_image_Polarised(path): assert specification.is_bispectral is False -def _test_spectral_image_BiSpectral(path): +def _test_spectral_image_BiSpectral(path: str) -> None: """Test the *Bi-Spectral* image.""" - components, specification = read_spectral_image_Fichet2021( - path, additional_data=True + components, specification = cast( + Tuple[ComponentsFichet2021, Specification_Fichet2021], + read_spectral_image_Fichet2021(path, additional_data=True), ) assert list(components.keys()) == [ @@ -458,7 +466,7 @@ class TestReadSpectralImageFichet2021: definition unit tests methods. """ - def test_read_spectral_image_Fichet2021(self): + def test_read_spectral_image_Fichet2021(self) -> None: """ Test :func:`colour.io.fichet2021.read_spectral_image_Fichet2021` definition. @@ -482,17 +490,17 @@ class TestWriteSpectralImageFichet2021: definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_spectral_image_Fichet2021(self): + def test_write_spectral_image_Fichet2021(self) -> None: """ Test :func:`colour.io.fichet2021.write_spectral_image_Fichet2021` definition. @@ -523,8 +531,11 @@ def test_write_spectral_image_Fichet2021(self): ("Polarised.exr", _test_spectral_image_Polarised), ("BiSpectral.exr", _test_spectral_image_BiSpectral), ]: - components, specification = read_spectral_image_Fichet2021( - os.path.join(ROOT_RESOURCES, basename), additional_data=True + components, specification = cast( + Tuple[ComponentsFichet2021, Specification_Fichet2021], + read_spectral_image_Fichet2021( + os.path.join(ROOT_RESOURCES, basename), additional_data=True + ), ) path = os.path.join(self._temporary_directory, basename) write_spectral_image_Fichet2021(components, path, "float16", specification) diff --git a/colour/io/tests/test_image.py b/colour/io/tests/test_image.py index d83cc4f98..d45338455 100644 --- a/colour/io/tests/test_image.py +++ b/colour/io/tests/test_image.py @@ -11,6 +11,7 @@ import pytest from colour.constants import TOLERANCE_ABSOLUTE_TESTS +from colour.hints import NDArrayReal, Tuple, cast from colour.io import ( Image_Specification_Attribute, as_3_channels_image, @@ -54,7 +55,7 @@ class TestImageSpecificationOpenImageIO: unit tests methods. """ - def test_image_specification_OpenImageIO(self): # pragma: no cover + def test_image_specification_OpenImageIO(self) -> None: # pragma: no cover """ Test :func:`colour.io.image.image_specification_OpenImageIO` definition. @@ -70,11 +71,11 @@ def test_image_specification_OpenImageIO(self): # pragma: no cover 1920, 1080, 3, "float16", [compression] ) - assert specification.width == 1920 - assert specification.height == 1080 - assert specification.nchannels == 3 - assert specification.format == HALF - assert specification.extra_attribs[0].name == "Compression" + assert specification.width == 1920 # pyright: ignore + assert specification.height == 1080 # pyright: ignore + assert specification.nchannels == 3 # pyright: ignore + assert specification.format == HALF # pyright: ignore + assert specification.extra_attribs[0].name == "Compression" # pyright: ignore class TestConvertBitDepth: @@ -83,7 +84,7 @@ class TestConvertBitDepth: methods. """ - def test_convert_bit_depth(self): + def test_convert_bit_depth(self) -> None: """Test :func:`colour.io.image.convert_bit_depth` definition.""" a = np.around(np.linspace(0, 1, 10) * 255).astype("uint8") @@ -272,47 +273,63 @@ class TestReadImageOpenImageIO: tests methods. """ - def test_read_image_OpenImageIO(self): # pragma: no cover + def test_read_image_OpenImageIO(self) -> None: # pragma: no cover """Test :func:`colour.io.image.read_image_OpenImageIO` definition.""" if not is_openimageio_installed(): return - image = read_image_OpenImageIO( - os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr") + image = cast( + NDArrayReal, + read_image_OpenImageIO( + os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr") + ), ) assert image.shape == (1267, 1274, 3) assert image.dtype is np.dtype("float32") - image = read_image_OpenImageIO( - os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr"), - "float16", + image = cast( + NDArrayReal, + read_image_OpenImageIO( + os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr"), + "float16", + ), ) assert image.dtype is np.dtype("float16") - image, attributes = read_image_OpenImageIO( - os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr"), - additional_data=True, + image, attributes = cast( + Tuple[NDArrayReal, Tuple[Image_Specification_Attribute]], + read_image_OpenImageIO( + os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr"), + additional_data=True, + ), ) assert image.shape == (1267, 1274, 3) assert attributes[0].name == "oiio:ColorSpace" assert attributes[0].value in ("Linear", "lin_rec709") - image = read_image_OpenImageIO( - os.path.join(ROOT_RESOURCES, "Single_Channel.exr") + image = cast( + NDArrayReal, + read_image_OpenImageIO(os.path.join(ROOT_RESOURCES, "Single_Channel.exr")), ) assert image.shape == (256, 256) - image = read_image_OpenImageIO( - os.path.join(ROOT_RESOURCES, "Colour_Logo.png"), "uint8" + image = cast( + NDArrayReal, + read_image_OpenImageIO( + os.path.join(ROOT_RESOURCES, "Colour_Logo.png"), "uint8" + ), ) assert image.shape == (128, 256, 4) assert image.dtype is np.dtype("uint8") assert np.min(image) == 0 assert np.max(image) == 255 - image = read_image_OpenImageIO( - os.path.join(ROOT_RESOURCES, "Colour_Logo.png"), "uint16" + image = cast( + NDArrayReal, + read_image_OpenImageIO( + os.path.join(ROOT_RESOURCES, "Colour_Logo.png"), "uint16" + ), ) assert image.shape == (128, 256, 4) assert image.dtype is np.dtype("uint16") @@ -326,8 +343,11 @@ def test_read_image_OpenImageIO(self): # pragma: no cover # self.assertEqual(np.min(image), 0.0) # self.assertEqual(np.max(image), 1.0) - image = read_image_OpenImageIO( - os.path.join(ROOT_RESOURCES, "Colour_Logo.png"), "float32" + image = cast( + NDArrayReal, + read_image_OpenImageIO( + os.path.join(ROOT_RESOURCES, "Colour_Logo.png"), "float32" + ), ) assert image.dtype is np.dtype("float32") assert np.min(image) == 0.0 @@ -340,17 +360,17 @@ class TestWriteImageOpenImageIO: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_image_OpenImageIO(self): # pragma: no cover + def test_write_image_OpenImageIO(self) -> None: # pragma: no cover """Test :func:`colour.io.image.write_image_OpenImageIO` definition.""" if not is_openimageio_installed(): @@ -381,9 +401,9 @@ def test_write_image_OpenImageIO(self): # pragma: no cover source_path = os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr") target_path = os.path.join(self._temporary_directory, "CMS_Test_Pattern.exr") - image = read_image_OpenImageIO(source_path) + image = cast(NDArrayReal, read_image_OpenImageIO(source_path)) write_image_OpenImageIO(image, target_path) - image = read_image_OpenImageIO(target_path) + image = cast(NDArrayReal, read_image_OpenImageIO(target_path)) assert image.shape == (1267, 1274, 3) assert image.dtype is np.dtype("float32") @@ -434,7 +454,7 @@ class TestReadImageImageio: methods. """ - def test_read_image_Imageio(self): + def test_read_image_Imageio(self) -> None: """Test :func:`colour.io.image.read_image_Imageio` definition.""" image = read_image_Imageio(os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr")) @@ -488,17 +508,17 @@ class TestWriteImageImageio: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_image_Imageio(self): + def test_write_image_Imageio(self) -> None: """Test :func:`colour.io.image.write_image_Imageio` definition.""" source_path = os.path.join(ROOT_RESOURCES, "Overflowing_Gradient.png") @@ -539,7 +559,7 @@ class TestReadImage: methods. """ - def test_read_image(self): + def test_read_image(self) -> None: """Test :func:`colour.io.image.read_image` definition.""" image = read_image(os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr")) @@ -553,17 +573,17 @@ def test_read_image(self): class TestWriteImage: """Define :func:`colour.io.image.write_image` definition unit tests methods.""" - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_image(self): + def test_write_image(self) -> None: """Test :func:`colour.io.image.write_image` definition.""" source_path = os.path.join(ROOT_RESOURCES, "CMS_Test_Pattern.exr") @@ -581,7 +601,7 @@ class TestAs3ChannelsImage: methods. """ - def test_as_3_channels_image(self): + def test_as_3_channels_image(self) -> None: """Test :func:`colour.io.image.as_3_channels_image` definition.""" a = 0.18 @@ -598,7 +618,7 @@ def test_as_3_channels_image(self): a = np.array([[[[0.18, 0.18, 0.18]]]]) np.testing.assert_equal(as_3_channels_image(a), b) - def test_raise_exception_as_3_channels_image(self): + def test_raise_exception_as_3_channels_image(self) -> None: """ Test :func:`colour.io.image.as_3_channels_image` definition raised exception. diff --git a/colour/io/tests/test_ocio.py b/colour/io/tests/test_ocio.py index ae5a18eea..5d0f10c9f 100644 --- a/colour/io/tests/test_ocio.py +++ b/colour/io/tests/test_ocio.py @@ -31,7 +31,7 @@ class TestProcessImageOpenColorIO: tests methods. """ - def test_process_image_OpenColorIO(self): + def test_process_image_OpenColorIO(self) -> None: """Test :func:`colour.io.ocio.process_image_OpenColorIO` definition.""" # TODO: Remove when "Pypi" wheel compatible with "ARM" on "macOS" is @@ -78,7 +78,7 @@ def test_process_image_OpenColorIO(self): "ACES - ACES2065-1", "Display - sRGB", "Output - SDR Video - ACES 1.0", - ocio.TRANSFORM_DIR_FORWARD, + ocio.TRANSFORM_DIR_FORWARD, # pyright: ignore config=config, ), np.array( diff --git a/colour/io/tests/test_tabular.py b/colour/io/tests/test_tabular.py index 5cc290263..7b6b276f1 100644 --- a/colour/io/tests/test_tabular.py +++ b/colour/io/tests/test_tabular.py @@ -123,7 +123,7 @@ class TestReadSpectralDataFromCsvFile: definition unit tests methods. """ - def test_read_spectral_data_from_csv_file(self): + def test_read_spectral_data_from_csv_file(self) -> None: """ Test :func:`colour.io.tabular.read_spectral_data_from_csv_file` definition. @@ -165,7 +165,7 @@ class TestReadSdsFromCsvFile: tests methods. """ - def test_read_sds_from_csv_file(self): + def test_read_sds_from_csv_file(self) -> None: """Test :func:`colour.io.tabular.read_sds_from_csv_file` definition.""" colour_checker_n_ohta = os.path.join(ROOT_RESOURCES, "colorchecker_n_ohta.csv") @@ -182,17 +182,17 @@ class TestWriteSdsToCsvFile: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_write_sds_to_csv_file(self): + def test_write_sds_to_csv_file(self) -> None: """Test :func:`colour.io.tabular.write_sds_to_csv_file` definition.""" colour_checker_n_ohta = os.path.join(ROOT_RESOURCES, "colorchecker_n_ohta.csv") @@ -205,7 +205,7 @@ def test_write_sds_to_csv_file(self): for key, value in sds.items(): assert value == sds_test[key] - def test_raise_exception_write_sds_to_csv_file(self): + def test_raise_exception_write_sds_to_csv_file(self) -> None: """ Test :func:`colour.io.tabular.write_sds_to_csv_file` definition raised exception. diff --git a/colour/io/tests/test_tm2714.py b/colour/io/tests/test_tm2714.py index 1001bc388..be17e5917 100644 --- a/colour/io/tests/test_tm2714.py +++ b/colour/io/tests/test_tm2714.py @@ -150,7 +150,7 @@ class TestIES_TM2714_Header: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._header = Header_IESTM2714( @@ -167,7 +167,7 @@ def setup_method(self): comments="k", ) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -188,7 +188,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(Header_IESTM2714) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -203,7 +203,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(Header_IESTM2714) - def test__str__(self): + def test__str__(self) -> None: """Test :meth:`colour.io.tm2714.Header_IESTM2714.__str__` method.""" assert str(self._header) == ( @@ -224,7 +224,7 @@ def test__str__(self): ).strip() ) - def test__repr__(self): + def test__repr__(self) -> None: """Test :meth:`colour.io.tm2714.Header_IESTM2714.__repr__` method.""" assert repr(self._header) == ( @@ -245,7 +245,7 @@ def test__repr__(self): ).strip() ) - def test__eq__(self): + def test__eq__(self) -> None: """Test :meth:`colour.io.tm2714.Header_IESTM2714.__eq__` method.""" header = deepcopy(self._header) @@ -254,7 +254,7 @@ def test__eq__(self): assert self._header != () - def test__ne__(self): + def test__ne__(self) -> None: """Test :meth:`colour.io.tm2714.Header_IESTM2714.__ne__` method.""" header = deepcopy(self._header) @@ -265,7 +265,7 @@ def test__ne__(self): header.manufacturer = "a" assert self._header == header - def test__hash__(self): + def test__hash__(self) -> None: """Test :meth:`colour.io.tm2714.Header_IESTM2714.__hash__` method.""" assert isinstance(hash(self._header), int) @@ -277,7 +277,7 @@ class TestIES_TM2714_Sd: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() @@ -286,12 +286,12 @@ def setup_method(self): os.path.join(ROOT_RESOURCES, "Fluorescent.spdx") ).read() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -308,7 +308,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(SpectralDistribution_IESTM2714) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__", "__str__", "__repr__", "read", "write") @@ -316,7 +316,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(SpectralDistribution_IESTM2714) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.io.tm2714.SpectralDistribution_IESTM2714.__str__` method. @@ -446,7 +446,7 @@ def test__str__(self): ).strip() ) - def test__repr__(self): + def test__repr__(self) -> None: """ Test :meth:`colour.io.tm2714.SpectralDistribution_IESTM2714.__repr__` method. @@ -569,7 +569,7 @@ def test__repr__(self): ).strip() ) - def test_read(self, sd: SpectralDistribution | None = None): + def test_read(self, sd: SpectralDistribution | None = None) -> None: """ Test :meth:`colour.io.tm2714.SpectralDistribution_IESTM2714.read` method. @@ -609,7 +609,7 @@ def test_read(self, sd: SpectralDistribution | None = None): if key == specification.element: assert getattr(read, specification.attribute) == value - def test_raise_exception_read(self): + def test_raise_exception_read(self) -> None: """ Test :func:`colour.io.tm2714.SpectralDistribution_IESTM2714.read` method raised exception. @@ -623,7 +623,7 @@ def test_raise_exception_read(self): os.path.join(ROOT_RESOURCES, "Invalid.spdx") ) - def test_write(self): + def test_write(self) -> None: """ Test :meth:`colour.io.tm2714.SpectralDistribution_IESTM2714.write` method. @@ -662,7 +662,7 @@ def test_write(self): ): assert getattr(sd_r, attribute) == getattr(sd_t, attribute) - def test_raise_exception_write(self): + def test_raise_exception_write(self) -> None: """ Test :func:`colour.io.tm2714.SpectralDistribution_IESTM2714.write` method raised exception. diff --git a/colour/io/tests/test_uprtek_sekonic.py b/colour/io/tests/test_uprtek_sekonic.py index d23fc275d..7d0265e53 100644 --- a/colour/io/tests/test_uprtek_sekonic.py +++ b/colour/io/tests/test_uprtek_sekonic.py @@ -39,16 +39,22 @@ class FixtureAbstractSpectralDistribution: methods. """ - @pytest.fixture(autouse=True) - def setup_fixture_abstract_spectral_distribution(self) -> None: + def __init__(self) -> None: """Configure the class instance.""" self._sd_factory: Any = None - self._path: str | None = None + self._path: str = ROOT_RESOURCES self._spectral_data: dict | None = None - self._prefix: str | None = None + self._prefix: str = "" + self._header: dict = {} + + @pytest.fixture(autouse=True) + def setup_fixture_abstract_spectral_distribution(self) -> None: + """Configure the class instance.""" + + self.__init__() - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -66,7 +72,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(SpectralDistribution_UPRTek) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__", "__str__", "read", "write") @@ -74,7 +80,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(SpectralDistribution_UPRTek) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.SpectralDistribution_UPRTek.__str__` and :meth:`colour.SpectralDistribution_Sekonic.__str__` methods. @@ -84,7 +90,7 @@ def test__str__(self): self._sd_factory(os.path.join(ROOT_RESOURCES, self._path)).read() ).startswith(self._prefix) - def test_read(self): + def test_read(self) -> None: """ Test :meth:`colour.SpectralDistribution_UPRTek.read` and :meth:`colour.SpectralDistribution_Sekonic.read` methods. diff --git a/colour/io/tests/test_xrite.py b/colour/io/tests/test_xrite.py index 74c517e2b..5e7aea0f7 100644 --- a/colour/io/tests/test_xrite.py +++ b/colour/io/tests/test_xrite.py @@ -68,7 +68,7 @@ class TestReadSdsFromXRiteFile: tests methods. """ - def test_read_sds_from_xrite_file(self): + def test_read_sds_from_xrite_file(self) -> None: """Test :func:`colour.io.xrite.read_sds_from_xrite_file` definition.""" colour_checker_xrite = os.path.join( diff --git a/colour/io/tm2714.py b/colour/io/tm2714.py index 2d0a45048..1a7e8a2df 100644 --- a/colour/io/tm2714.py +++ b/colour/io/tm2714.py @@ -262,7 +262,7 @@ def manufacturer(self) -> str | None: return self._manufacturer @manufacturer.setter - def manufacturer(self, value: str | None): + def manufacturer(self, value: str | None) -> None: """Setter for the **self.manufacturer** property.""" if value is not None: @@ -292,7 +292,7 @@ def catalog_number(self) -> str | None: return self._catalog_number @catalog_number.setter - def catalog_number(self, value: str | None): + def catalog_number(self, value: str | None) -> None: """Setter for the **self.catalog_number** property.""" if value is not None: @@ -322,7 +322,7 @@ def description(self) -> str | None: return self._description @description.setter - def description(self, value: str | None): + def description(self, value: str | None) -> None: """Setter for the **self.description** property.""" if value is not None: @@ -352,7 +352,7 @@ def document_creator(self) -> str | None: return self._document_creator @document_creator.setter - def document_creator(self, value: str | None): + def document_creator(self, value: str | None) -> None: """Setter for the **self.document_creator** property.""" if value is not None: @@ -382,7 +382,7 @@ def unique_identifier(self) -> str | None: return self._unique_identifier @unique_identifier.setter - def unique_identifier(self, value: str | None): + def unique_identifier(self, value: str | None) -> None: """Setter for the **self.unique_identifier** property.""" if value is not None: @@ -412,7 +412,7 @@ def measurement_equipment(self) -> str | None: return self._measurement_equipment @measurement_equipment.setter - def measurement_equipment(self, value: str | None): + def measurement_equipment(self, value: str | None) -> None: """Setter for the **self.measurement_equipment** property.""" if value is not None: @@ -442,7 +442,7 @@ def laboratory(self) -> str | None: return self._laboratory @laboratory.setter - def laboratory(self, value: str | None): + def laboratory(self, value: str | None) -> None: """Setter for the **self.measurement_equipment** property.""" if value is not None: @@ -472,7 +472,7 @@ def report_number(self) -> str | None: return self._report_number @report_number.setter - def report_number(self, value: str | None): + def report_number(self, value: str | None) -> None: """Setter for the **self.report_number** property.""" if value is not None: @@ -502,7 +502,7 @@ def report_date(self) -> str | None: return self._report_date @report_date.setter - def report_date(self, value: str | None): + def report_date(self, value: str | None) -> None: """Setter for the **self.report_date** property.""" if value is not None: @@ -532,7 +532,7 @@ def document_creation_date(self) -> str | None: return self._document_creation_date @document_creation_date.setter - def document_creation_date(self, value: str | None): + def document_creation_date(self, value: str | None) -> None: """Setter for the **self.document_creation_date** property.""" if value is not None: @@ -562,7 +562,7 @@ def comments(self) -> str | None: return self._comments @comments.setter - def comments(self, value: str | None): + def comments(self, value: str | None) -> None: """Setter for the **self.comments** property.""" if value is not None: @@ -908,7 +908,7 @@ def __init__( ) = None, bandwidth_FWHM: float | None = None, bandwidth_corrected: bool | None = None, - **kwargs, + **kwargs: Any, ) -> None: super().__init__(**kwargs) @@ -1031,7 +1031,7 @@ def path(self) -> str | None: return self._path @path.setter - def path(self, value: str | Path | None): + def path(self, value: str | Path | None) -> None: """Setter for the **self.path** property.""" if value is not None: @@ -1063,7 +1063,7 @@ def header(self) -> Header_IESTM2714: return self._header @header.setter - def header(self, value: Header_IESTM2714): + def header(self, value: Header_IESTM2714) -> None: """Setter for the **self.header** property.""" attest( @@ -1129,7 +1129,7 @@ def spectral_quantity( ] | None ), - ): + ) -> None: """Setter for the **self.spectral_quantity** property.""" if value is not None: @@ -1196,7 +1196,7 @@ def reflection_geometry( ] | None ), - ): + ) -> None: """Setter for the **self.reflection_geometry** property.""" if value is not None: @@ -1231,7 +1231,7 @@ def transmission_geometry( def transmission_geometry( self, value: (Literal["0:0", "di:0", "de:0", "0:di", "0:de", "d:d", "other"] | None), - ): + ) -> None: """Setter for the **self.transmission_geometry** property.""" if value is not None: @@ -1261,7 +1261,7 @@ def bandwidth_FWHM(self) -> float | None: return self._bandwidth_FWHM @bandwidth_FWHM.setter - def bandwidth_FWHM(self, value: float | None): + def bandwidth_FWHM(self, value: float | None) -> None: """Setter for the **self.bandwidth_FWHM** property.""" if value is not None: @@ -1294,7 +1294,7 @@ def bandwidth_corrected(self) -> bool | None: return self._bandwidth_corrected @bandwidth_corrected.setter - def bandwidth_corrected(self, value: bool | None): + def bandwidth_corrected(self, value: bool | None) -> None: """Setter for the **self.bandwidth_corrected** property.""" if value is not None: diff --git a/colour/models/cie_luv.py b/colour/models/cie_luv.py index 3fec11323..649e5f80b 100644 --- a/colour/models/cie_luv.py +++ b/colour/models/cie_luv.py @@ -291,7 +291,7 @@ def uv_to_Luv( illuminant: ArrayLike = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"][ "D65" ], - L: NDArrayFloat = np.array(100), + L: ArrayLike = np.array(100), ) -> NDArrayFloat: """ Return the *CIE L\\*u\\*v\\** colourspace array from given :math:`uv^p` diff --git a/colour/models/cie_ucs.py b/colour/models/cie_ucs.py index d568d5120..82a999363 100644 --- a/colour/models/cie_ucs.py +++ b/colour/models/cie_ucs.py @@ -195,7 +195,7 @@ def UCS_to_uv(UVW: ArrayLike) -> NDArrayFloat: return uv -def uv_to_UCS(uv: ArrayLike, V: NDArrayFloat = np.array(1)) -> NDArrayFloat: +def uv_to_UCS(uv: ArrayLike, V: ArrayLike = np.array(1)) -> NDArrayFloat: """ Return the *CIE 1960 UCS* :math:`UVW` colourspace array from given *uv* chromaticity coordinates. diff --git a/colour/models/cie_xyy.py b/colour/models/cie_xyy.py index b6c7b7d74..525a1ca3f 100644 --- a/colour/models/cie_xyy.py +++ b/colour/models/cie_xyy.py @@ -203,7 +203,7 @@ def xyY_to_xy(xyY: ArrayLike) -> NDArrayFloat: return xy -def xy_to_xyY(xy: ArrayLike, Y: NDArrayFloat = np.array(1)) -> NDArrayFloat: +def xy_to_xyY(xy: ArrayLike, Y: ArrayLike = np.array(1)) -> NDArrayFloat: """ Convert from *CIE xy* chromaticity coordinates to *CIE xyY* colourspace by extending the array last dimension with given :math:`Y` *luminance*. diff --git a/colour/models/hunter_lab.py b/colour/models/hunter_lab.py index 392584b8a..d9637ca35 100644 --- a/colour/models/hunter_lab.py +++ b/colour/models/hunter_lab.py @@ -83,9 +83,9 @@ def XYZ_to_Hunter_Lab( XYZ_n: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB["CIE 1931 2 Degree Standard Observer"][ "D65" ].XYZ_n, - K_ab: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB["CIE 1931 2 Degree Standard Observer"][ - "D65" - ].K_ab, + K_ab: ArrayLike | None = TVS_ILLUMINANTS_HUNTERLAB[ + "CIE 1931 2 Degree Standard Observer" + ]["D65"].K_ab, ) -> NDArrayFloat: """ Convert from *CIE XYZ* tristimulus values to *Hunter L,a,b* colour scale. @@ -161,9 +161,9 @@ def Hunter_Lab_to_XYZ( XYZ_n: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB["CIE 1931 2 Degree Standard Observer"][ "D65" ].XYZ_n, - K_ab: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB["CIE 1931 2 Degree Standard Observer"][ - "D65" - ].K_ab, + K_ab: ArrayLike | None = TVS_ILLUMINANTS_HUNTERLAB[ + "CIE 1931 2 Degree Standard Observer" + ]["D65"].K_ab, ) -> NDArrayFloat: """ Convert from *Hunter L,a,b* colour scale to *CIE XYZ* tristimulus values. diff --git a/colour/models/hunter_rdab.py b/colour/models/hunter_rdab.py index 35f20a01f..c818da467 100644 --- a/colour/models/hunter_rdab.py +++ b/colour/models/hunter_rdab.py @@ -40,9 +40,9 @@ def XYZ_to_Hunter_Rdab( XYZ_n: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB["CIE 1931 2 Degree Standard Observer"][ "D65" ].XYZ_n, - K_ab: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB["CIE 1931 2 Degree Standard Observer"][ - "D65" - ].K_ab, + K_ab: ArrayLike | None = TVS_ILLUMINANTS_HUNTERLAB[ + "CIE 1931 2 Degree Standard Observer" + ]["D65"].K_ab, ) -> NDArrayFloat: """ Convert from *CIE XYZ* tristimulus values to *Hunter Rd,a,b* colour scale. @@ -120,9 +120,9 @@ def Hunter_Rdab_to_XYZ( XYZ_n: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB["CIE 1931 2 Degree Standard Observer"][ "D65" ].XYZ_n, - K_ab: ArrayLike = TVS_ILLUMINANTS_HUNTERLAB["CIE 1931 2 Degree Standard Observer"][ - "D65" - ].K_ab, + K_ab: ArrayLike | None = TVS_ILLUMINANTS_HUNTERLAB[ + "CIE 1931 2 Degree Standard Observer" + ]["D65"].K_ab, ) -> NDArrayFloat: """ Convert from *Hunter Rd,a,b* colour scale to *CIE XYZ* tristimulus values. diff --git a/colour/models/rgb/datasets/tests/test__init__.py b/colour/models/rgb/datasets/tests/test__init__.py index 3baa44ca1..96ec47bca 100644 --- a/colour/models/rgb/datasets/tests/test__init__.py +++ b/colour/models/rgb/datasets/tests/test__init__.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.datasets` module.""" +from __future__ import annotations + import pickle from copy import deepcopy @@ -30,7 +32,7 @@ class TestRGB_COLOURSPACES: attribute unit tests methods. """ - def test_transformation_matrices(self): + def test_transformation_matrices(self) -> None: """ Test the transformations matrices from the :attr:`colour.models.rgb.datasets.RGB_COLOURSPACES` attribute @@ -73,7 +75,7 @@ def test_transformation_matrices(self): XYZ = np.dot(colourspace.matrix_RGB_to_XYZ, RGB) np.testing.assert_allclose(XYZ_r, XYZ, atol=tolerance) - def test_cctf(self): + def test_cctf(self) -> None: """ Test colour component transfer functions from the :attr:`colour.models.rgb.datasets.RGB_COLOURSPACES` attribute @@ -101,7 +103,7 @@ def test_cctf(self): atol=tolerance.get(colourspace.name, TOLERANCE_ABSOLUTE_TESTS), ) - def test_n_dimensional_cctf(self): + def test_n_dimensional_cctf(self) -> None: """ Test colour component transfer functions from the :attr:`colour.models.rgb.datasets.RGB_COLOURSPACES` attribute @@ -146,7 +148,7 @@ def test_n_dimensional_cctf(self): ) @ignore_numpy_errors - def test_nan_cctf(self): + def test_nan_cctf(self) -> None: """ Test colour component transfer functions from the :attr:`colour.models.rgb.datasets.RGB_COLOURSPACES` attribute @@ -158,7 +160,7 @@ def test_nan_cctf(self): colourspace.cctf_encoding(cases) colourspace.cctf_decoding(cases) - def test_pickle(self): + def test_pickle(self) -> None: """Test the "pickle-ability" of the *RGB* colourspaces.""" for colourspace in RGB_COLOURSPACES.values(): diff --git a/colour/models/rgb/ictcp.py b/colour/models/rgb/ictcp.py index 0c8d26e33..14186ae17 100644 --- a/colour/models/rgb/ictcp.py +++ b/colour/models/rgb/ictcp.py @@ -400,7 +400,9 @@ def ICtCp_to_RGB( def XYZ_to_ICtCp( XYZ: ArrayLike, - illuminant=CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"], + illuminant: ArrayLike = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"][ + "D65" + ], chromatic_adaptation_transform: ( LiteralChromaticAdaptationTransform | str | None ) = "CAT02", @@ -521,7 +523,9 @@ def XYZ_to_ICtCp( def ICtCp_to_XYZ( ICtCp: ArrayLike, - illuminant=CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"], + illuminant: ArrayLike = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"][ + "D65" + ], chromatic_adaptation_transform: ( LiteralChromaticAdaptationTransform | str | None ) = "CAT02", diff --git a/colour/models/rgb/itut_h_273.py b/colour/models/rgb/itut_h_273.py index c54212c0b..96646b2a8 100644 --- a/colour/models/rgb/itut_h_273.py +++ b/colour/models/rgb/itut_h_273.py @@ -60,7 +60,7 @@ import numpy as np -from colour.hints import Any, Callable, Dict, NDArrayFloat +from colour.hints import Any, ArrayLike, Callable, Dict, NDArrayFloat, NoReturn from colour.models.rgb.datasets.dcdm_xyz import ( CCS_WHITEPOINT_DCDM_XYZ, MATRIX_DCDM_XYZ_TO_XYZ, @@ -208,7 +208,7 @@ def _clipped_domain_function( """ @functools.wraps(function) - def wrapped(x, *args: Any, **kwargs: Any) -> Any: + def wrapped(x: ArrayLike, *args: Any, **kwargs: Any) -> Any: """Wrap given function.""" return function(np.clip(x, *domain), *args, **kwargs) @@ -216,7 +216,7 @@ def wrapped(x, *args: Any, **kwargs: Any) -> Any: return wrapped -def _reserved(*args: Any): # noqa: ARG001 +def _reserved(*args: Any) -> NoReturn: # noqa: ARG001 """ Define a reserved function. @@ -231,7 +231,7 @@ def _reserved(*args: Any): # noqa: ARG001 raise RuntimeError("Reserved; For future use by ITU-T | ISO/IEC.") -def _unspecified(*args: Any): # noqa: ARG001 +def _unspecified(*args: Any) -> NoReturn: # noqa: ARG001 """ Define an unspecified function. @@ -887,7 +887,7 @@ class FFmpegConstantsMatrixCoefficients_ITUTH273(IntEnum): def describe_video_signal_colour_primaries( - code_point: int, print_description: bool = True, **kwargs + code_point: int, print_description: bool = True, **kwargs: Any ) -> str: """ Describe given video signal colour primaries code point. @@ -1043,7 +1043,7 @@ class SpecificationColourPrimaries: def describe_video_signal_transfer_characteristics( - code_point: int, print_description: bool = True, **kwargs + code_point: int, print_description: bool = True, **kwargs: Any ) -> str: """ Describe given video signal transfer characteristics code point. @@ -1167,7 +1167,7 @@ class SpecificationTransferCharacteristics: def describe_video_signal_matrix_coefficients( - code_point: int, print_description: bool = True, **kwargs + code_point: int, print_description: bool = True, **kwargs: Any ) -> str: """ Describe given video signal matrix coefficients code point. diff --git a/colour/models/rgb/rgb_colourspace.py b/colour/models/rgb/rgb_colourspace.py index 88b4f5d72..06be42397 100644 --- a/colour/models/rgb/rgb_colourspace.py +++ b/colour/models/rgb/rgb_colourspace.py @@ -295,7 +295,7 @@ def name(self) -> str: return self._name @name.setter - def name(self, value: str): + def name(self, value: str) -> None: """Setter for the **self.name** property.""" attest( @@ -324,7 +324,7 @@ def primaries(self) -> NDArrayFloat: return self._primaries @primaries.setter - def primaries(self, value: ArrayLike): + def primaries(self, value: ArrayLike) -> None: """Setter for the **self.primaries** property.""" attest( @@ -361,7 +361,7 @@ def whitepoint(self) -> NDArrayFloat: return self._whitepoint @whitepoint.setter - def whitepoint(self, value: ArrayLike): + def whitepoint(self, value: ArrayLike) -> None: """Setter for the **self.whitepoint** property.""" attest( @@ -395,7 +395,7 @@ def whitepoint_name(self) -> str | None: return self._whitepoint_name @whitepoint_name.setter - def whitepoint_name(self, value: str | None): + def whitepoint_name(self, value: str | None) -> None: """Setter for the **self.whitepoint_name** property.""" if value is not None: @@ -433,7 +433,7 @@ def matrix_RGB_to_XYZ(self) -> NDArrayFloat: return self._matrix_RGB_to_XYZ @matrix_RGB_to_XYZ.setter - def matrix_RGB_to_XYZ(self, value: ArrayLike | None): + def matrix_RGB_to_XYZ(self, value: ArrayLike | None) -> None: """Setter for the **self.matrix_RGB_to_XYZ** property.""" if value is not None: @@ -474,7 +474,7 @@ def matrix_XYZ_to_RGB(self) -> NDArrayFloat: return self._matrix_XYZ_to_RGB @matrix_XYZ_to_RGB.setter - def matrix_XYZ_to_RGB(self, value: ArrayLike | None): + def matrix_XYZ_to_RGB(self, value: ArrayLike | None) -> None: """Setter for the **self.matrix_XYZ_to_RGB** property.""" if value is not None: @@ -511,7 +511,7 @@ def cctf_encoding(self) -> Callable | None: return self._cctf_encoding @cctf_encoding.setter - def cctf_encoding(self, value: Callable | None): + def cctf_encoding(self, value: Callable | None) -> None: """Setter for the **self.cctf_encoding** property.""" if value is not None: @@ -545,7 +545,7 @@ def cctf_decoding(self) -> Callable | None: return self._cctf_decoding @cctf_decoding.setter - def cctf_decoding(self, value: Callable | None): + def cctf_decoding(self, value: Callable | None) -> None: """Setter for the **self.cctf_decoding** property.""" if value is not None: @@ -579,7 +579,7 @@ def use_derived_matrix_RGB_to_XYZ(self) -> bool: return self._use_derived_matrix_RGB_to_XYZ @use_derived_matrix_RGB_to_XYZ.setter - def use_derived_matrix_RGB_to_XYZ(self, value: bool): + def use_derived_matrix_RGB_to_XYZ(self, value: bool) -> None: """Setter for the **self.use_derived_matrix_RGB_to_XYZ** property.""" attest( @@ -614,7 +614,7 @@ def use_derived_matrix_XYZ_to_RGB(self) -> bool: return self._use_derived_matrix_XYZ_to_RGB @use_derived_matrix_XYZ_to_RGB.setter - def use_derived_matrix_XYZ_to_RGB(self, value: bool): + def use_derived_matrix_XYZ_to_RGB(self, value: bool) -> None: """Setter for the **self.use_derived_matrix_XYZ_to_RGB** property.""" attest( @@ -804,7 +804,7 @@ def __repr__(self) -> str: ], ) - def _derive_transformation_matrices(self): + def _derive_transformation_matrices(self) -> None: """ Compute the derived transformations matrices, the normalised primary matrix and its inverse. @@ -816,7 +816,7 @@ def _derive_transformation_matrices(self): self._derived_matrix_RGB_to_XYZ = npm self._derived_matrix_XYZ_to_RGB = np.linalg.inv(npm) - def use_derived_transformation_matrices(self, usage: bool = True): + def use_derived_transformation_matrices(self, usage: bool = True) -> None: """ Enable or disables usage of both derived transformations matrices, the normalised primary matrix and its inverse in subsequent @@ -1067,8 +1067,8 @@ def RGB_to_XYZ( LiteralChromaticAdaptationTransform | str | None ) = "CAT02", apply_cctf_decoding: bool = False, - *args, - **kwargs, + *args: Any, + **kwargs: Any, ) -> NDArrayFloat: """ Convert given *RGB* colourspace array to *CIE XYZ* tristimulus values. diff --git a/colour/models/rgb/tests/test_cmyk.py b/colour/models/rgb/tests/test_cmyk.py index 2745f0280..eb0f6a8e2 100644 --- a/colour/models/rgb/tests/test_cmyk.py +++ b/colour/models/rgb/tests/test_cmyk.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.cmyk` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -34,7 +36,7 @@ class TestRGB_to_CMY: methods. """ - def test_RGB_to_CMY(self): + def test_RGB_to_CMY(self) -> None: """Test :func:`colour.models.rgb.cmyk.RGB_to_CMY` definition.""" np.testing.assert_allclose( @@ -55,7 +57,7 @@ def test_RGB_to_CMY(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_CMY(self): + def test_n_dimensional_RGB_to_CMY(self) -> None: """ Test :func:`colour.models.rgb.cmyk.RGB_to_CMY` definition n-dimensional arrays support. @@ -72,7 +74,7 @@ def test_n_dimensional_RGB_to_CMY(self): CMY = np.reshape(CMY, (2, 3, 3)) np.testing.assert_allclose(RGB_to_CMY(RGB), CMY, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_RGB_to_CMY(self): + def test_domain_range_scale_RGB_to_CMY(self) -> None: """ Test :func:`colour.models.rgb.cmyk.RGB_to_CMY` definition domain and range scale support. @@ -91,7 +93,7 @@ def test_domain_range_scale_RGB_to_CMY(self): ) @ignore_numpy_errors - def test_nan_RGB_to_CMY(self): + def test_nan_RGB_to_CMY(self) -> None: """ Test :func:`colour.models.rgb.cmyk.RGB_to_CMY` definition nan support. @@ -108,7 +110,7 @@ class TestCMY_to_RGB: methods. """ - def test_CMY_to_RGB(self): + def test_CMY_to_RGB(self) -> None: """Test :func:`colour.models.rgb.cmyk.CMY_to_RGB` definition.""" np.testing.assert_allclose( @@ -129,7 +131,7 @@ def test_CMY_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CMY_to_RGB(self): + def test_n_dimensional_CMY_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cmyk.CMY_to_RGB` definition n-dimensional arrays support. @@ -146,7 +148,7 @@ def test_n_dimensional_CMY_to_RGB(self): RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_allclose(CMY_to_RGB(CMY), RGB, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_CMY_to_RGB(self): + def test_domain_range_scale_CMY_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cmyk.CMY_to_RGB` definition domain and range scale support. @@ -165,7 +167,7 @@ def test_domain_range_scale_CMY_to_RGB(self): ) @ignore_numpy_errors - def test_nan_CMY_to_RGB(self): + def test_nan_CMY_to_RGB(self) -> None: """Test :func:`colour.models.rgb.cmyk.CMY_to_RGB` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -179,7 +181,7 @@ class TestCMY_to_CMYK: methods. """ - def test_CMY_to_CMYK(self): + def test_CMY_to_CMYK(self) -> None: """Test :func:`colour.models.rgb.cmyk.CMY_to_CMYK` definition.""" np.testing.assert_allclose( @@ -200,7 +202,7 @@ def test_CMY_to_CMYK(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CMY_to_CMYK(self): + def test_n_dimensional_CMY_to_CMYK(self) -> None: """ Test :func:`colour.models.rgb.cmyk.CMY_to_CMYK` definition n-dimensional arrays support. @@ -221,7 +223,7 @@ def test_n_dimensional_CMY_to_CMYK(self): CMY_to_CMYK(CMY), CMYK, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_CMY_to_CMYK(self): + def test_domain_range_scale_CMY_to_CMYK(self) -> None: """ Test :func:`colour.models.rgb.cmyk.CMY_to_CMYK` definition domain and range scale support. @@ -240,7 +242,7 @@ def test_domain_range_scale_CMY_to_CMYK(self): ) @ignore_numpy_errors - def test_nan_CMY_to_CMYK(self): + def test_nan_CMY_to_CMYK(self) -> None: """ Test :func:`colour.models.rgb.cmyk.CMY_to_CMYK` definition nan support. @@ -257,7 +259,7 @@ class TestCMYK_to_CMY: methods. """ - def test_CMYK_to_CMY(self): + def test_CMYK_to_CMY(self) -> None: """Test :func:`colour.models.rgb.cmyk.CMYK_to_CMY` definition.""" np.testing.assert_allclose( @@ -278,7 +280,7 @@ def test_CMYK_to_CMY(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CMYK_to_CMY(self): + def test_n_dimensional_CMYK_to_CMY(self) -> None: """ Test :func:`colour.models.rgb.cmyk.CMYK_to_CMY` definition n-dimensional arrays support. @@ -299,7 +301,7 @@ def test_n_dimensional_CMYK_to_CMY(self): CMYK_to_CMY(CMYK), CMY, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_CMYK_to_CMY(self): + def test_domain_range_scale_CMYK_to_CMY(self) -> None: """ Test :func:`colour.models.rgb.cmyk.CMYK_to_CMY` definition domain and range scale support. @@ -318,7 +320,7 @@ def test_domain_range_scale_CMYK_to_CMY(self): ) @ignore_numpy_errors - def test_nan_CMYK_to_CMY(self): + def test_nan_CMYK_to_CMY(self) -> None: """ Test :func:`colour.models.rgb.cmyk.CMYK_to_CMY` definition nan support. diff --git a/colour/models/rgb/tests/test_common.py b/colour/models/rgb/tests/test_common.py index e80a91834..667a43a5c 100644 --- a/colour/models/rgb/tests/test_common.py +++ b/colour/models/rgb/tests/test_common.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.common` module.""" +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -24,7 +26,7 @@ class TestXYZ_to_sRGB: methods. """ - def test_XYZ_to_sRGB(self): + def test_XYZ_to_sRGB(self) -> None: """Test :func:`colour.models.rgb.common.XYZ_to_sRGB` definition.""" np.testing.assert_allclose( @@ -83,7 +85,7 @@ class TestsRGB_to_XYZ: methods. """ - def test_sRGB_to_XYZ(self): + def test_sRGB_to_XYZ(self) -> None: """Test :func:`colour.models.rgb.common.sRGB_to_XYZ` definition.""" np.testing.assert_allclose( diff --git a/colour/models/rgb/tests/test_cylindrical.py b/colour/models/rgb/tests/test_cylindrical.py index 4cee31734..2373776b4 100644 --- a/colour/models/rgb/tests/test_cylindrical.py +++ b/colour/models/rgb/tests/test_cylindrical.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.cylindrical` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -38,7 +40,7 @@ class TestRGB_to_HSV: tests methods. """ - def test_RGB_to_HSV(self): + def test_RGB_to_HSV(self) -> None: """Test :func:`colour.models.rgb.cylindrical.RGB_to_HSV` definition.""" np.testing.assert_allclose( @@ -65,7 +67,7 @@ def test_RGB_to_HSV(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_HSV(self): + def test_n_dimensional_RGB_to_HSV(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HSV` definition n-dimensional arrays support. @@ -82,7 +84,7 @@ def test_n_dimensional_RGB_to_HSV(self): HSV = np.reshape(HSV, (2, 3, 3)) np.testing.assert_allclose(RGB_to_HSV(RGB), HSV, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_RGB_to_HSV(self): + def test_domain_range_scale_RGB_to_HSV(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HSV` definition domain and range scale support. @@ -101,7 +103,7 @@ def test_domain_range_scale_RGB_to_HSV(self): ) @ignore_numpy_errors - def test_nan_RGB_to_HSV(self): + def test_nan_RGB_to_HSV(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HSV` definition nan support. @@ -118,7 +120,7 @@ class TestHSV_to_RGB: tests methods. """ - def test_HSV_to_RGB(self): + def test_HSV_to_RGB(self) -> None: """Test :func:`colour.models.rgb.cylindrical.HSV_to_RGB` definition.""" np.testing.assert_allclose( @@ -145,7 +147,7 @@ def test_HSV_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_HSV_to_RGB(self): + def test_n_dimensional_HSV_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HSV_to_RGB` definition n-dimensional arrays support. @@ -162,7 +164,7 @@ def test_n_dimensional_HSV_to_RGB(self): RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_allclose(HSV_to_RGB(HSV), RGB, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_HSV_to_RGB(self): + def test_domain_range_scale_HSV_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HSV_to_RGB` definition domain and range scale support. @@ -181,7 +183,7 @@ def test_domain_range_scale_HSV_to_RGB(self): ) @ignore_numpy_errors - def test_nan_HSV_to_RGB(self): + def test_nan_HSV_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HSV_to_RGB` definition nan support. @@ -198,7 +200,7 @@ class TestRGB_to_HSL: tests methods. """ - def test_RGB_to_HSL(self): + def test_RGB_to_HSL(self) -> None: """Test :func:`colour.models.rgb.cylindrical.RGB_to_HSL` definition.""" np.testing.assert_allclose( @@ -225,7 +227,7 @@ def test_RGB_to_HSL(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_HSL(self): + def test_n_dimensional_RGB_to_HSL(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HSL` definition n-dimensional arrays support. @@ -242,7 +244,7 @@ def test_n_dimensional_RGB_to_HSL(self): HSL = np.reshape(HSL, (2, 3, 3)) np.testing.assert_allclose(RGB_to_HSL(RGB), HSL, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_RGB_to_HSL(self): + def test_domain_range_scale_RGB_to_HSL(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HSL` definition domain and range scale support. @@ -261,7 +263,7 @@ def test_domain_range_scale_RGB_to_HSL(self): ) @ignore_numpy_errors - def test_nan_RGB_to_HSL(self): + def test_nan_RGB_to_HSL(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HSL` definition nan support. @@ -278,7 +280,7 @@ class TestHSL_to_RGB: tests methods. """ - def test_HSL_to_RGB(self): + def test_HSL_to_RGB(self) -> None: """Test :func:`colour.models.rgb.cylindrical.HSL_to_RGB` definition.""" np.testing.assert_allclose( @@ -305,7 +307,7 @@ def test_HSL_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_HSL_to_RGB(self): + def test_n_dimensional_HSL_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HSL_to_RGB` definition n-dimensional arrays support. @@ -322,7 +324,7 @@ def test_n_dimensional_HSL_to_RGB(self): RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_allclose(HSL_to_RGB(HSL), RGB, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_HSL_to_RGB(self): + def test_domain_range_scale_HSL_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HSL_to_RGB` definition domain and range scale support. @@ -341,7 +343,7 @@ def test_domain_range_scale_HSL_to_RGB(self): ) @ignore_numpy_errors - def test_nan_HSL_to_RGB(self): + def test_nan_HSL_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HSL_to_RGB` definition nan support. @@ -358,7 +360,7 @@ class TestRGB_to_HCL: tests methods. """ - def test_RGB_to_HCL(self): + def test_RGB_to_HCL(self) -> None: """Test :func:`colour.models.rgb.cylindrical.RGB_to_HCL` definition.""" np.testing.assert_allclose( @@ -385,7 +387,7 @@ def test_RGB_to_HCL(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_HCL(self): + def test_n_dimensional_RGB_to_HCL(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HCL` definition n-dimensional arrays support. @@ -402,7 +404,7 @@ def test_n_dimensional_RGB_to_HCL(self): HCL = np.reshape(HCL, (2, 3, 3)) np.testing.assert_allclose(RGB_to_HCL(RGB), HCL, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_RGB_to_HCL(self): + def test_domain_range_scale_RGB_to_HCL(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HCL` definition domain and range scale support. @@ -421,7 +423,7 @@ def test_domain_range_scale_RGB_to_HCL(self): ) @ignore_numpy_errors - def test_nan_RGB_to_HCL(self): + def test_nan_RGB_to_HCL(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.RGB_to_HCL` definition nan support. @@ -438,7 +440,7 @@ class TestHCL_to_RGB: tests methods. """ - def test_HCL_to_RGB(self): + def test_HCL_to_RGB(self) -> None: """Test :func:`colour.models.rgb.cylindrical.HCL_to_RGB` definition.""" np.testing.assert_allclose( @@ -465,7 +467,7 @@ def test_HCL_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_HCL_to_RGB(self): + def test_n_dimensional_HCL_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HCL_to_RGB` definition n-dimensional arrays support. @@ -482,7 +484,7 @@ def test_n_dimensional_HCL_to_RGB(self): RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_allclose(HCL_to_RGB(HCL), RGB, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_HCL_to_RGB(self): + def test_domain_range_scale_HCL_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HCL_to_RGB` definition domain and range scale support. @@ -501,7 +503,7 @@ def test_domain_range_scale_HCL_to_RGB(self): ) @ignore_numpy_errors - def test_nan_HCL_to_RGB(self): + def test_nan_HCL_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.cylindrical.HCL_to_RGB` definition nan support. diff --git a/colour/models/rgb/tests/test_derivation.py b/colour/models/rgb/tests/test_derivation.py index 07a2c9ece..5a50b6abd 100644 --- a/colour/models/rgb/tests/test_derivation.py +++ b/colour/models/rgb/tests/test_derivation.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.derivation` module.""" +from __future__ import annotations + import contextlib import re from itertools import product @@ -41,7 +43,7 @@ class Testxy_to_z: tests methods. """ - def test_xy_to_z(self): + def test_xy_to_z(self) -> None: """Test :func:`colour.models.rgb.derivation.xy_to_z` definition.""" np.testing.assert_allclose( @@ -62,7 +64,7 @@ def test_xy_to_z(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_z(self): + def test_n_dimensional_xy_to_z(self) -> None: """ Test :func:`colour.models.rgb.derivation.xy_to_z` definition n-dimensional arrays support. @@ -83,7 +85,7 @@ def test_n_dimensional_xy_to_z(self): np.testing.assert_allclose(xy_to_z(xy), z, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_xy_to_z(self): + def test_nan_xy_to_z(self) -> None: """ Test :func:`colour.models.rgb.derivation.xy_to_z` definition nan support. @@ -100,7 +102,7 @@ class TestNormalisedPrimaryMatrix: definition unit tests methods. """ - def test_normalised_primary_matrix(self): + def test_normalised_primary_matrix(self) -> None: """ Test :func:`colour.models.rgb.derivation.normalised_primary_matrix` definition. @@ -137,7 +139,7 @@ def test_normalised_primary_matrix(self): ) @ignore_numpy_errors - def test_nan_normalised_primary_matrix(self): + def test_nan_normalised_primary_matrix(self) -> None: """ Test :func:`colour.models.rgb.derivation.normalised_primary_matrix` definition nan support. @@ -158,7 +160,7 @@ class TestChromaticallyAdaptedPrimaries: chromatically_adapted_primaries` definition unit tests methods. """ - def test_chromatically_adapted_primaries(self): + def test_chromatically_adapted_primaries(self) -> None: """ Test :func:`colour.models.rgb.derivation.\ chromatically_adapted_primaries` definition. @@ -214,7 +216,7 @@ def test_chromatically_adapted_primaries(self): ) @ignore_numpy_errors - def test_nan_chromatically_adapted_primaries(self): + def test_nan_chromatically_adapted_primaries(self) -> None: """ Test :func:`colour.models.rgb.derivation.\ chromatically_adapted_primaries` definition nan support. @@ -234,7 +236,7 @@ class TestPrimariesWhitepoint: definition unit tests methods. """ - def test_primaries_whitepoint(self): + def test_primaries_whitepoint(self) -> None: """ Test :func:`colour.models.rgb.derivation.primaries_whitepoint` definition. @@ -291,7 +293,7 @@ def test_primaries_whitepoint(self): ) @ignore_numpy_errors - def test_nan_primaries_whitepoint(self): + def test_nan_primaries_whitepoint(self) -> None: """ Test :func:`colour.models.rgb.derivation.primaries_whitepoint` definition nan support. @@ -310,7 +312,7 @@ class TestRGBLuminanceEquation: definition unit tests methods. """ - def test_RGB_luminance_equation(self): + def test_RGB_luminance_equation(self) -> None: """ Test :func:`colour.models.rgb.derivation.RGB_luminance_equation` definition. @@ -344,7 +346,7 @@ class TestRGBLuminance: unit tests methods. """ - def test_RGB_luminance(self): + def test_RGB_luminance(self) -> None: """ Test :func:`colour.models.rgb.derivation.RGB_luminance` definition. @@ -380,7 +382,7 @@ def test_RGB_luminance(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_luminance(self): + def test_n_dimensional_RGB_luminance(self) -> None: """ Test :func:`colour.models.rgb.derivation.RGB_luminance` definition n_dimensional arrays support. @@ -404,7 +406,7 @@ def test_n_dimensional_RGB_luminance(self): ) @ignore_numpy_errors - def test_nan_RGB_luminance(self): + def test_nan_RGB_luminance(self) -> None: """ Test :func:`colour.models.rgb.derivation.RGB_luminance` definition nan support. diff --git a/colour/models/rgb/tests/test_hanbury2003.py b/colour/models/rgb/tests/test_hanbury2003.py index 4b99607b0..7490cb9a2 100644 --- a/colour/models/rgb/tests/test_hanbury2003.py +++ b/colour/models/rgb/tests/test_hanbury2003.py @@ -1,5 +1,7 @@ """Defines unit tests for :mod:`colour.models.rgb.hanbury2003` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestRGB_to_IHLS: tests methods. """ - def test_RGB_to_IHLS(self): + def test_RGB_to_IHLS(self) -> None: """Test :func:`colour.models.rgb.hanbury2003.RGB_to_IHLS` definition.""" np.testing.assert_allclose( @@ -48,7 +50,7 @@ def test_RGB_to_IHLS(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_IHLS(self): + def test_n_dimensional_RGB_to_IHLS(self) -> None: """ Test :func:`colour.models.rgb.hanbury2003.RGB_to_IHLS` definition n-dimensional arrays support. @@ -65,7 +67,7 @@ def test_n_dimensional_RGB_to_IHLS(self): HYS = np.reshape(HYS, (2, 3, 3)) np.testing.assert_allclose(RGB_to_IHLS(RGB), HYS, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_RGB_to_IHLS(self): + def test_domain_range_scale_RGB_to_IHLS(self) -> None: """ Test :func:`colour.models.rgb.hanbury2003.RGB_to_IHLS` definition domain and range scale support. @@ -84,7 +86,7 @@ def test_domain_range_scale_RGB_to_IHLS(self): ) @ignore_numpy_errors - def test_nan_RGB_to_IHLS(self): + def test_nan_RGB_to_IHLS(self) -> None: """ Test :func:`colour.models.rgb.hanbury2003.RGB_to_IHLS` definition nan support. @@ -101,7 +103,7 @@ class TestIHLS_to_RGB: tests methods. """ - def test_IHLS_to_RGB(self): + def test_IHLS_to_RGB(self) -> None: """Test :func:`colour.models.rgb.hanbury2003.IHLS_to_RGB` definition.""" np.testing.assert_allclose( @@ -122,7 +124,7 @@ def test_IHLS_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_IHLS_to_RGB(self): + def test_n_dimensional_IHLS_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.hanbury2003.IHLS_to_RGB` definition n-dimensional arrays support. @@ -139,7 +141,7 @@ def test_n_dimensional_IHLS_to_RGB(self): RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_allclose(IHLS_to_RGB(HYS), RGB, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_IHLS_to_RGB(self): + def test_domain_range_scale_IHLS_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.hanbury2003.IHLS_to_RGB` definition domain and range scale support. @@ -158,7 +160,7 @@ def test_domain_range_scale_IHLS_to_RGB(self): ) @ignore_numpy_errors - def test_nan_IHLS_to_RGB(self): + def test_nan_IHLS_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.hanbury2003.IHLS_to_RGB` definition nan support. diff --git a/colour/models/rgb/tests/test_ictcp.py b/colour/models/rgb/tests/test_ictcp.py index 034752ed2..926680bc7 100644 --- a/colour/models/rgb/tests/test_ictcp.py +++ b/colour/models/rgb/tests/test_ictcp.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.ictcp` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -34,7 +36,7 @@ class TestRGB_to_ICtCp: tests methods. """ - def test_RGB_to_ICtCp(self): + def test_RGB_to_ICtCp(self) -> None: """Test :func:`colour.models.rgb.ictcp.RGB_to_ICtCp` definition.""" np.testing.assert_allclose( @@ -91,7 +93,7 @@ def test_RGB_to_ICtCp(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_ICtCp(self): + def test_n_dimensional_RGB_to_ICtCp(self) -> None: """ Test :func:`colour.models.rgb.ictcp.RGB_to_ICtCp` definition n-dimensional support. @@ -112,7 +114,7 @@ def test_n_dimensional_RGB_to_ICtCp(self): RGB_to_ICtCp(RGB), ICtCp, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_RGB_to_ICtCp(self): + def test_domain_range_scale_RGB_to_ICtCp(self) -> None: """ Test :func:`colour.models.rgb.ictcp.RGB_to_ICtCp` definition domain and range scale support. @@ -131,7 +133,7 @@ def test_domain_range_scale_RGB_to_ICtCp(self): ) @ignore_numpy_errors - def test_nan_RGB_to_ICtCp(self): + def test_nan_RGB_to_ICtCp(self) -> None: """ Test :func:`colour.models.rgb.ictcp.RGB_to_ICtCp` definition nan support. @@ -148,7 +150,7 @@ class TestICtCp_to_RGB: methods. """ - def test_ICtCp_to_RGB(self): + def test_ICtCp_to_RGB(self) -> None: """Test :func:`colour.models.rgb.ictcp.ICtCp_to_RGB` definition.""" np.testing.assert_allclose( @@ -205,7 +207,7 @@ def test_ICtCp_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ICtCp_to_RGB(self): + def test_n_dimensional_ICtCp_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ictcp.ICtCp_to_RGB` definition n-dimensional support. @@ -226,7 +228,7 @@ def test_n_dimensional_ICtCp_to_RGB(self): ICtCp_to_RGB(ICtCp), RGB, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ICtCp_to_RGB(self): + def test_domain_range_scale_ICtCp_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ictcp.ICtCp_to_RGB` definition domain and range scale support. @@ -245,7 +247,7 @@ def test_domain_range_scale_ICtCp_to_RGB(self): ) @ignore_numpy_errors - def test_nan_ICtCp_to_RGB(self): + def test_nan_ICtCp_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ictcp.ICtCp_to_RGB` definition nan support. @@ -262,7 +264,7 @@ class TestXYZ_to_ICtCp: tests methods. """ - def test_XYZ_to_ICtCp(self): + def test_XYZ_to_ICtCp(self) -> None: """Test :func:`colour.models.rgb.ictcp.XYZ_to_ICtCp` definition.""" np.testing.assert_allclose( @@ -338,7 +340,7 @@ def test_XYZ_to_ICtCp(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_ICtCp(self): + def test_n_dimensional_XYZ_to_ICtCp(self) -> None: """ Test :func:`colour.models.rgb.ictcp.XYZ_to_ICtCp` definition n-dimensional support. @@ -359,7 +361,7 @@ def test_n_dimensional_XYZ_to_ICtCp(self): XYZ_to_ICtCp(XYZ), ICtCp, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_ICtCp(self): + def test_domain_range_scale_XYZ_to_ICtCp(self) -> None: """ Test :func:`colour.models.rgb.ictcp.XYZ_to_ICtCp` definition domain and range scale support. @@ -378,7 +380,7 @@ def test_domain_range_scale_XYZ_to_ICtCp(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_ICtCp(self): + def test_nan_XYZ_to_ICtCp(self) -> None: """ Test :func:`colour.models.rgb.ictcp.XYZ_to_ICtCp` definition nan support. @@ -395,7 +397,7 @@ class TestICtCp_to_XYZ: methods. """ - def test_ICtCp_to_XYZ(self): + def test_ICtCp_to_XYZ(self) -> None: """Test :func:`colour.models.rgb.ictcp.ICtCp_to_XYZ` definition.""" np.testing.assert_allclose( @@ -471,7 +473,7 @@ def test_ICtCp_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ICtCp_to_XYZ(self): + def test_n_dimensional_ICtCp_to_XYZ(self) -> None: """ Test :func:`colour.models.rgb.ictcp.ICtCp_to_XYZ` definition n-dimensional support. @@ -492,7 +494,7 @@ def test_n_dimensional_ICtCp_to_XYZ(self): ICtCp_to_XYZ(ICtCp), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ICtCp_to_XYZ(self): + def test_domain_range_scale_ICtCp_to_XYZ(self) -> None: """ Test :func:`colour.models.rgb.ictcp.ICtCp_to_XYZ` definition domain and range scale support. @@ -511,7 +513,7 @@ def test_domain_range_scale_ICtCp_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_ICtCp_to_XYZ(self): + def test_nan_ICtCp_to_XYZ(self) -> None: """ Test :func:`colour.models.rgb.ictcp.ICtCp_to_XYZ` definition nan support. diff --git a/colour/models/rgb/tests/test_itut_h_273.py b/colour/models/rgb/tests/test_itut_h_273.py index 33efe82e3..660fce04c 100644 --- a/colour/models/rgb/tests/test_itut_h_273.py +++ b/colour/models/rgb/tests/test_itut_h_273.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.itut_h_273` module.""" +from __future__ import annotations + from colour.models import ( describe_video_signal_colour_primaries, describe_video_signal_matrix_coefficients, @@ -26,7 +28,7 @@ class TestDescribeVideoSignalColourPrimaries: describe_video_signal_colour_primaries` definition unit tests methods. """ - def test_describe_video_signal_colour_primaries(self): + def test_describe_video_signal_colour_primaries(self) -> None: """ Test :func:`colour.models.rgb.itut_h_273.\ @@ -43,7 +45,7 @@ class TestDescribeVideoSignalTransferCharacteristics: describe_video_signal_transfer_characteristics` definition unit tests methods. """ - def test_describe_video_signal_transfer_characteristics(self): + def test_describe_video_signal_transfer_characteristics(self) -> None: """ Test :func:`colour.models.rgb.itut_h_273.\ describe_video_signal_transfer_characteristics` definition. @@ -59,7 +61,7 @@ class TestDescribeVideoSignalMatrixCoefficients: describe_video_signal_matrix_coefficients` definition unit tests methods. """ - def test_describe_video_signal_matrix_coefficients(self): + def test_describe_video_signal_matrix_coefficients(self) -> None: """ Test :func:`colour.models.rgb.itut_h_273.\ describe_video_signal_matrix_coefficients` definition. diff --git a/colour/models/rgb/tests/test_prismatic.py b/colour/models/rgb/tests/test_prismatic.py index d434a9493..339bb4baa 100644 --- a/colour/models/rgb/tests/test_prismatic.py +++ b/colour/models/rgb/tests/test_prismatic.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.prismatic` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestRGB_to_Prismatic: unit tests methods. """ - def test_RGB_to_Prismatic(self): + def test_RGB_to_Prismatic(self) -> None: """Test :func:`colour.models.rgb.prismatic.RGB_to_Prismatic` definition.""" np.testing.assert_allclose( @@ -42,7 +44,7 @@ def test_RGB_to_Prismatic(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_Prismatic(self): + def test_n_dimensional_RGB_to_Prismatic(self) -> None: """ Test :func:`colour.models.rgb.prismatic.RGB_to_Prismatic` definition n-dimensional support. @@ -63,7 +65,7 @@ def test_n_dimensional_RGB_to_Prismatic(self): RGB_to_Prismatic(RGB), Lrgb, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_RGB_to_Prismatic(self): + def test_domain_range_scale_RGB_to_Prismatic(self) -> None: """ Test :func:`colour.models.rgb.prismatic.RGB_to_Prismatic` definition domain and range scale support. @@ -82,7 +84,7 @@ def test_domain_range_scale_RGB_to_Prismatic(self): ) @ignore_numpy_errors - def test_nan_RGB_to_Prismatic(self): + def test_nan_RGB_to_Prismatic(self) -> None: """ Test :func:`colour.models.rgb.prismatic.RGB_to_Prismatic` definition nan support. @@ -99,7 +101,7 @@ class TestPrismatic_to_RGB: unit tests methods. """ - def test_Prismatic_to_RGB(self): + def test_Prismatic_to_RGB(self) -> None: """Test :func:`colour.models.rgb.prismatic.Prismatic_to_RGB` definition.""" np.testing.assert_allclose( @@ -114,7 +116,7 @@ def test_Prismatic_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Prismatic_to_RGB(self): + def test_n_dimensional_Prismatic_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.prismatic.Prismatic_to_RGB` definition n-dimensional support. @@ -135,7 +137,7 @@ def test_n_dimensional_Prismatic_to_RGB(self): Prismatic_to_RGB(Lrgb), RGB, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Prismatic_to_RGB(self): + def test_domain_range_scale_Prismatic_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.prismatic.Prismatic_to_RGB` definition domain and range scale support. @@ -154,7 +156,7 @@ def test_domain_range_scale_Prismatic_to_RGB(self): ) @ignore_numpy_errors - def test_nan_Prismatic_to_RGB(self): + def test_nan_Prismatic_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.prismatic.Prismatic_to_RGB` definition nan support. diff --git a/colour/models/rgb/tests/test_rgb_colourspace.py b/colour/models/rgb/tests/test_rgb_colourspace.py index d0cfc1d09..7415f2e21 100644 --- a/colour/models/rgb/tests/test_rgb_colourspace.py +++ b/colour/models/rgb/tests/test_rgb_colourspace.py @@ -2,6 +2,8 @@ Define the unit tests for the :mod:`colour.models.rgb.rgb_colourspace` module. """ +from __future__ import annotations + import re import textwrap from itertools import product @@ -48,7 +50,7 @@ class TestRGB_Colourspace: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" p = np.array([0.73470, 0.26530, 0.00000, 1.00000, 0.00010, -0.07700]) @@ -66,7 +68,7 @@ def setup_method(self): linear_function, ) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -85,7 +87,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(RGB_Colourspace) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -100,7 +102,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(RGB_Colourspace) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.models.rgb.rgb_colourspace.RGB_Colourspace.__str__` method. @@ -137,7 +139,7 @@ def test__str__(self): ).strip() ) - def test__repr__(self): + def test__repr__(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_Colourspace.\ __repr__` method. @@ -166,7 +168,7 @@ def test__repr__(self): ).strip() ) - def test_use_derived_transformation_matrices(self): + def test_use_derived_transformation_matrices(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_Colourspace.\ use_derived_transformation_matrices` method. @@ -213,7 +215,7 @@ def test_use_derived_transformation_matrices(self): self._colourspace.matrix_XYZ_to_RGB, np.identity(3) ) - def test_chromatically_adapt(self): + def test_chromatically_adapt(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_Colourspace.\ chromatically_adapt` method. @@ -266,7 +268,7 @@ def test_chromatically_adapt(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_copy(self): + def test_copy(self) -> None: """ Test :meth:`colour.models.rgb.rgb_colourspace.RGB_Colourspace.copy` method. @@ -281,7 +283,7 @@ class TestXYZ_to_RGB: unit tests methods. """ - def test_XYZ_to_RGB(self): + def test_XYZ_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.XYZ_to_RGB` definition. @@ -338,50 +340,50 @@ def test_XYZ_to_RGB(self): ) # TODO: Remove tests when dropping deprecated signature support. - np.testing.assert_allclose( - XYZ_to_RGB( + np.testing.assert_allclose( # pyright: ignore + XYZ_to_RGB( # pyright: ignore np.array([0.21638819, 0.12570000, 0.03847493]), - np.array([0.34570, 0.35850]), + np.array([0.34570, 0.35850]), # pyright: ignore np.array([0.31270, 0.32900]), - np.array( + np.array( # pyright: ignore [ [3.24062548, -1.53720797, -0.49862860], [-0.96893071, 1.87575606, 0.04151752], [0.05571012, -0.20402105, 1.05699594], ] ), - "Bradford", + "Bradford", # pyright: ignore eotf_inverse_sRGB, ), np.array([0.70556599, 0.19109268, 0.22340812]), atol=TOLERANCE_ABSOLUTE_TESTS, ) - np.testing.assert_allclose( - XYZ_to_RGB( + np.testing.assert_allclose( # pyright: ignore + XYZ_to_RGB( # pyright: ignore np.array([0.21638819, 0.12570000, 0.03847493]), - np.array([0.34570, 0.35850]), + np.array([0.34570, 0.35850]), # pyright: ignore np.array([0.31270, 0.32900]), - np.array( + np.array( # pyright: ignore [ [3.24062548, -1.53720797, -0.49862860], [-0.96893071, 1.87575606, 0.04151752], [0.05571012, -0.20402105, 1.05699594], ] ), - None, + None, # pyright: ignore eotf_inverse_sRGB, ), np.array([0.72794579, 0.18180021, 0.17951580]), atol=TOLERANCE_ABSOLUTE_TESTS, ) - np.testing.assert_allclose( - XYZ_to_RGB( + np.testing.assert_allclose( # pyright: ignore + XYZ_to_RGB( # pyright: ignore np.array([0.21638819, 0.12570000, 0.03847493]), - np.array([0.34570, 0.35850]), + np.array([0.34570, 0.35850]), # pyright: ignore np.array([0.32168, 0.33767]), - np.array( + np.array( # pyright: ignore [ [1.04981102, 0.00000000, -0.00009748], [-0.49590302, 1.37331305, 0.09824004], @@ -393,12 +395,12 @@ def test_XYZ_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - np.testing.assert_allclose( - XYZ_to_RGB( + np.testing.assert_allclose( # pyright: ignore + XYZ_to_RGB( # pyright: ignore np.array([0.21638819, 0.12570000, 0.03847493]), - np.array([0.34570, 0.35850]), + np.array([0.34570, 0.35850]), # pyright: ignore np.array([0.31270, 0.32900, 1.00000]), - np.array( + np.array( # pyright: ignore [ [3.24062548, -1.53720797, -0.49862860], [-0.96893071, 1.87575606, 0.04151752], @@ -410,7 +412,7 @@ def test_XYZ_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_RGB(self): + def test_n_dimensional_XYZ_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.XYZ_to_RGB` definition n-dimensional support. @@ -444,7 +446,7 @@ def test_n_dimensional_XYZ_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_RGB(self): + def test_domain_range_scale_XYZ_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.XYZ_to_RGB` definition domain and range scale support. @@ -464,7 +466,7 @@ def test_domain_range_scale_XYZ_to_RGB(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_RGB(self): + def test_nan_XYZ_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.XYZ_to_RGB` definition nan support. @@ -472,8 +474,7 @@ def test_nan_XYZ_to_RGB(self): cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = np.array(list(set(product(cases, repeat=3)))) - M = np.reshape(np.vstack([cases[0, ...], cases[0, ...], cases[0, ...]]), (3, 3)) - XYZ_to_RGB(cases, cases[..., 0:2], cases[..., 0:2], M) + XYZ_to_RGB(cases, "sRGB", cases[..., 0:2]) class TestRGB_to_XYZ: @@ -482,7 +483,7 @@ class TestRGB_to_XYZ: unit tests methods. """ - def test_RGB_to_XYZ(self): + def test_RGB_to_XYZ(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_to_XYZ` definition. @@ -539,50 +540,50 @@ def test_RGB_to_XYZ(self): ) # TODO: Remove tests when dropping deprecated signature support. - np.testing.assert_allclose( - RGB_to_XYZ( + np.testing.assert_allclose( # pyright: ignore + RGB_to_XYZ( # pyright: ignore np.array([0.70556599, 0.19109268, 0.22340812]), - np.array([0.31270, 0.32900]), + np.array([0.31270, 0.32900]), # pyright: ignore np.array([0.34570, 0.35850]), - np.array( + np.array( # pyright: ignore [ [0.41240000, 0.35760000, 0.18050000], [0.21260000, 0.71520000, 0.07220000], [0.01930000, 0.11920000, 0.95050000], ] ), - "Bradford", + "Bradford", # pyright: ignore eotf_sRGB, ), np.array([0.21638819, 0.12570000, 0.03847493]), atol=TOLERANCE_ABSOLUTE_TESTS, ) - np.testing.assert_allclose( - RGB_to_XYZ( + np.testing.assert_allclose( # pyright: ignore + RGB_to_XYZ( # pyright: ignore np.array([0.72794579, 0.18180021, 0.17951580]), - np.array([0.31270, 0.32900]), + np.array([0.31270, 0.32900]), # pyright: ignore np.array([0.34570, 0.35850]), - np.array( + np.array( # pyright: ignore [ [0.41240000, 0.35760000, 0.18050000], [0.21260000, 0.71520000, 0.07220000], [0.01930000, 0.11920000, 0.95050000], ] ), - None, + None, # pyright: ignore eotf_sRGB, ), np.array([0.21638819, 0.12570000, 0.03847493]), atol=TOLERANCE_ABSOLUTE_TESTS, ) - np.testing.assert_allclose( - RGB_to_XYZ( + np.testing.assert_allclose( # pyright: ignore + RGB_to_XYZ( # pyright: ignore np.array([0.21959099, 0.06985815, 0.04703704]), - np.array([0.32168, 0.33767]), + np.array([0.32168, 0.33767]), # pyright: ignore np.array([0.34570, 0.35850]), - np.array( + np.array( # pyright: ignore [ [0.95255240, 0.00000000, 0.00009368], [0.34396645, 0.72816610, -0.07213255], @@ -594,12 +595,12 @@ def test_RGB_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - np.testing.assert_allclose( - RGB_to_XYZ( + np.testing.assert_allclose( # pyright: ignore + RGB_to_XYZ( # pyright: ignore np.array([0.45620801, 0.03079991, 0.04091883]), - np.array([0.31270, 0.32900, 1.00000]), + np.array([0.31270, 0.32900, 1.00000]), # pyright: ignore np.array([0.34570, 0.35850]), - np.array( + np.array( # pyright: ignore [ [0.41240000, 0.35760000, 0.18050000], [0.21260000, 0.71520000, 0.07220000], @@ -611,7 +612,7 @@ def test_RGB_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_XYZ(self): + def test_n_dimensional_RGB_to_XYZ(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_to_XYZ` definition n-dimensional support. @@ -645,7 +646,7 @@ def test_n_dimensional_RGB_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_RGB(self): + def test_domain_range_scale_XYZ_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_to_XYZ` definition domain and range scale support. @@ -665,7 +666,7 @@ def test_domain_range_scale_XYZ_to_RGB(self): ) @ignore_numpy_errors - def test_nan_RGB_to_XYZ(self): + def test_nan_RGB_to_XYZ(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_to_XYZ` definition nan support. @@ -673,8 +674,7 @@ def test_nan_RGB_to_XYZ(self): cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] cases = np.array(list(set(product(cases, repeat=3)))) - M = np.reshape(np.vstack([cases[0, ...], cases[0, ...], cases[0, ...]]), (3, 3)) - RGB_to_XYZ(cases, cases[..., 0:2], cases[..., 0:2], M) + RGB_to_XYZ(cases, "sRGB", cases[..., 0:2]) class TestMatrix_RGB_to_RGB: @@ -683,7 +683,7 @@ class TestMatrix_RGB_to_RGB: definition unit tests methods. """ - def test_matrix_RGB_to_RGB(self): + def test_matrix_RGB_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.matrix_RGB_to_RGB` definition. @@ -766,7 +766,7 @@ class TestRGB_to_RGB: unit tests methods. """ - def test_RGB_to_RGB(self): + def test_RGB_to_RGB(self) -> None: """Test :func:`colour.models.rgb.rgb_colourspace.RGB_to_RGB` definition.""" aces_2065_1_colourspace = RGB_COLOURSPACES["ACES2065-1"] @@ -866,7 +866,7 @@ def test_RGB_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_RGB(self): + def test_n_dimensional_RGB_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_to_RGB` definition n-dimensional support. @@ -893,7 +893,7 @@ def test_n_dimensional_RGB_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_RGB(self): + def test_domain_range_scale_XYZ_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_to_RGB` definition domain and range scale support. @@ -918,7 +918,7 @@ def test_domain_range_scale_XYZ_to_RGB(self): ) @ignore_numpy_errors - def test_nan_RGB_to_RGB(self): + def test_nan_RGB_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.rgb_colourspace.RGB_to_RGB` definition nan support. diff --git a/colour/models/rgb/tests/test_ycbcr.py b/colour/models/rgb/tests/test_ycbcr.py index 4f471f1e1..f62ff5016 100644 --- a/colour/models/rgb/tests/test_ycbcr.py +++ b/colour/models/rgb/tests/test_ycbcr.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.ycbcr` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -43,7 +45,7 @@ class TestRoundBT2100: methods. """ - def test_round_BT2100(self): + def test_round_BT2100(self) -> None: """Test :func:`colour.models.rgb.ycbcr.round_BT2100` definition.""" np.testing.assert_array_equal( @@ -58,7 +60,7 @@ class TestRangeYCbCr: methods. """ - def test_ranges_YCbCr(self): + def test_ranges_YCbCr(self) -> None: """Test :func:`colour.models.rgb.ycbcr.ranges_YCbCr` definition.""" np.testing.assert_allclose( @@ -116,7 +118,7 @@ class TestMatrixYCbCr: methods. """ - def test_matrix_YCbCr(self): + def test_matrix_YCbCr(self) -> None: """Test :func:`colour.models.rgb.ycbcr.matrix_YCbCr` definition.""" np.testing.assert_allclose( @@ -186,7 +188,7 @@ class TestOffsetYCbCr: methods. """ - def test_offset_YCbCr(self): + def test_offset_YCbCr(self) -> None: """Test :func:`colour.models.rgb.ycbcr.offset_YCbCr` definition.""" np.testing.assert_allclose( @@ -220,7 +222,7 @@ class TestRGB_to_YCbCr: methods. """ - def test_RGB_to_YCbCr(self): + def test_RGB_to_YCbCr(self) -> None: """Test :func:`colour.models.rgb.ycbcr.RGB_to_YCbCr` definition.""" np.testing.assert_allclose( @@ -262,7 +264,7 @@ def test_RGB_to_YCbCr(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_YCbCr(self): + def test_n_dimensional_RGB_to_YCbCr(self) -> None: """ Test :func:`colour.models.rgb.ycbcr.RGB_to_YCbCr` definition n-dimensional arrays support. @@ -289,7 +291,7 @@ def test_n_dimensional_RGB_to_YCbCr(self): YCbCr = np.reshape(YCbCr, (4, 4, 4, 3)) np.testing.assert_allclose(RGB_to_YCbCr(RGB), YCbCr) - def test_domain_range_scale_RGB_to_YCbCr(self): + def test_domain_range_scale_RGB_to_YCbCr(self) -> None: """ Test :func:`colour.models.rgb.prismatic.RGB_to_YCbCr` definition domain and range scale support. @@ -308,7 +310,7 @@ def test_domain_range_scale_RGB_to_YCbCr(self): ) @ignore_numpy_errors - def test_nan_RGB_to_YCbCr(self): + def test_nan_RGB_to_YCbCr(self) -> None: """ Test :func:`colour.models.rgb.ycbcr.RGB_to_YCbCr` definition nan support. @@ -325,7 +327,7 @@ class TestYCbCr_to_RGB: methods. """ - def test_YCbCr_to_RGB(self): + def test_YCbCr_to_RGB(self) -> None: """Test :func:`colour.models.rgb.ycbcr.YCbCr_to_RGB` definition.""" np.testing.assert_allclose( @@ -359,7 +361,7 @@ def test_YCbCr_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_YCbCr_to_RGB(self): + def test_n_dimensional_YCbCr_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ycbcr.YCbCr_to_RGB` definition n-dimensional arrays support. @@ -386,7 +388,7 @@ def test_n_dimensional_YCbCr_to_RGB(self): YCbCr = np.reshape(YCbCr, (4, 4, 4, 3)) np.testing.assert_allclose(YCbCr_to_RGB(YCbCr), RGB) - def test_domain_range_scale_YCbCr_to_RGB(self): + def test_domain_range_scale_YCbCr_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.prismatic.YCbCr_to_RGB` definition domain and range scale support. @@ -405,7 +407,7 @@ def test_domain_range_scale_YCbCr_to_RGB(self): ) @ignore_numpy_errors - def test_nan_YCbCr_to_RGB(self): + def test_nan_YCbCr_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ycbcr.YCbCr_to_RGB` definition nan support. @@ -422,7 +424,7 @@ class TestRGB_to_YcCbcCrc: tests methods. """ - def test_RGB_to_YcCbcCrc(self): + def test_RGB_to_YcCbcCrc(self) -> None: """Test :func:`colour.models.rgb.ycbcr.RGB_to_YcCbcCrc` definition.""" np.testing.assert_allclose( @@ -443,7 +445,7 @@ def test_RGB_to_YcCbcCrc(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_RGB_to_YcCbcCrc(self): + def test_n_dimensional_RGB_to_YcCbcCrc(self) -> None: """ Test :func:`colour.models.rgb.ycbcr.RGB_to_YcCbcCrc` definition n-dimensional arrays support. @@ -476,7 +478,7 @@ def test_n_dimensional_RGB_to_YcCbcCrc(self): RGB_to_YcCbcCrc(RGB), YcCbcCrc, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_RGB_to_YcCbcCrc(self): + def test_domain_range_scale_RGB_to_YcCbcCrc(self) -> None: """ Test :func:`colour.models.rgb.prismatic.RGB_to_YcCbcCrc` definition domain and range scale support. @@ -495,7 +497,7 @@ def test_domain_range_scale_RGB_to_YcCbcCrc(self): ) @ignore_numpy_errors - def test_nan_RGB_to_YcCbcCrc(self): + def test_nan_RGB_to_YcCbcCrc(self) -> None: """ Test :func:`colour.models.rgb.ycbcr.RGB_to_YcCbcCrc` definition nan support. @@ -512,7 +514,7 @@ class TestYcCbcCrc_to_RGB: methods. """ - def test_YcCbcCrc_to_RGB(self): + def test_YcCbcCrc_to_RGB(self) -> None: """Test :func:`colour.models.rgb.ycbcr.YCbCr_to_RGB` definition.""" np.testing.assert_allclose( @@ -533,7 +535,7 @@ def test_YcCbcCrc_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_YcCbcCrc_to_RGB(self): + def test_n_dimensional_YcCbcCrc_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ycbcr.YcCbcCrc_to_RGB` definition n-dimensional arrays support. @@ -566,7 +568,7 @@ def test_n_dimensional_YcCbcCrc_to_RGB(self): YcCbcCrc_to_RGB(YcCbcCrc), RGB, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_YcCbcCrc_to_RGB(self): + def test_domain_range_scale_YcCbcCrc_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.prismatic.YcCbcCrc_to_RGB` definition domain and range scale support. @@ -585,7 +587,7 @@ def test_domain_range_scale_YcCbcCrc_to_RGB(self): ) @ignore_numpy_errors - def test_nan_YcCbcCrc_to_RGB(self): + def test_nan_YcCbcCrc_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ycbcr.YcCbcCrc_to_RGB` definition nan support. diff --git a/colour/models/rgb/tests/test_ycocg.py b/colour/models/rgb/tests/test_ycocg.py index 385453504..3bd5d4069 100644 --- a/colour/models/rgb/tests/test_ycocg.py +++ b/colour/models/rgb/tests/test_ycocg.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.rgb.ycocg` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestRGB_to_YCoCg: methods. """ - def test_RGB_to_YCoCg(self): + def test_RGB_to_YCoCg(self) -> None: """Test :func:`colour.models.rgb.ycocg.RGB_to_YCoCg` definition.""" np.testing.assert_array_equal( @@ -45,7 +47,7 @@ def test_RGB_to_YCoCg(self): np.array([0.5625, -0.375, 0.1875]), ) - def test_n_dimensional_RGB_to_YCoCg(self): + def test_n_dimensional_RGB_to_YCoCg(self) -> None: """ Test :func:`colour.models.rgb.ycocg.RGB_to_YCoCg` definition n-dimensional arrays support. @@ -79,7 +81,7 @@ def test_n_dimensional_RGB_to_YCoCg(self): ) @ignore_numpy_errors - def test_nan_RGB_to_YCoCg(self): + def test_nan_RGB_to_YCoCg(self) -> None: """ Test :func:`colour.models.rgb.ycocg.RGB_to_YCoCg` definition nan support. @@ -96,7 +98,7 @@ class TestYCoCg_to_RGB: methods. """ - def test_YCoCg_to_RGB(self): + def test_YCoCg_to_RGB(self) -> None: """Test :func:`colour.models.rgb.ycocg.YCoCg_to_RGB` definition.""" np.testing.assert_array_equal( @@ -114,7 +116,7 @@ def test_YCoCg_to_RGB(self): np.array([0.0, 0.75, 0.75]), ) - def test_n_dimensional_YCoCg_to_RGB(self): + def test_n_dimensional_YCoCg_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ycocg.YCoCg_to_RGB` definition n-dimensional arrays support. @@ -148,7 +150,7 @@ def test_n_dimensional_YCoCg_to_RGB(self): ) @ignore_numpy_errors - def test_nan_YCoCg_to_RGB(self): + def test_nan_YCoCg_to_RGB(self) -> None: """ Test :func:`colour.models.rgb.ycocg.YCoCg_to_RGB` definition nan support. diff --git a/colour/models/rgb/transfer_functions/__init__.py b/colour/models/rgb/transfer_functions/__init__.py index 6f4b17bae..375aed9db 100644 --- a/colour/models/rgb/transfer_functions/__init__.py +++ b/colour/models/rgb/transfer_functions/__init__.py @@ -874,7 +874,7 @@ def eotf( def eotf_inverse( value: ArrayLike, function: LiteralEOTFInverse | str = "ITU-R BT.1886", - **kwargs, + **kwargs: Any, ) -> NDArrayFloat | NDArrayInt: """ Encode estimated tristimulus values in a scene to :math:`R'G'B'` video diff --git a/colour/models/rgb/transfer_functions/itur_bt_1361.py b/colour/models/rgb/transfer_functions/itur_bt_1361.py index fb4f2adf0..65be8b234 100644 --- a/colour/models/rgb/transfer_functions/itur_bt_1361.py +++ b/colour/models/rgb/transfer_functions/itur_bt_1361.py @@ -17,9 +17,12 @@ R-REC-BT.1361-0-199802-W!!PDF-E.pdf """ +from __future__ import annotations + import numpy as np from colour.algebra import spow +from colour.hints import ArrayLike, NDArrayFloat from colour.models.rgb.transfer_functions import oetf_BT709, oetf_inverse_BT709 from colour.utilities import ( as_float, @@ -41,7 +44,7 @@ ] -def oetf_BT1361(L): +def oetf_BT1361(L: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-R BT.1361* extended color gamut system opto-electronic transfer function (OETF). @@ -102,7 +105,7 @@ def oetf_BT1361(L): return as_float(from_range_1(E_p)) -def oetf_inverse_BT1361(E_p): +def oetf_inverse_BT1361(E_p: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-R BT.1361* extended color gamut system inverse opto-electronic transfer functions (OETF). diff --git a/colour/models/rgb/transfer_functions/itut_h_273.py b/colour/models/rgb/transfer_functions/itut_h_273.py index e2a10e450..c7c1512c3 100644 --- a/colour/models/rgb/transfer_functions/itut_h_273.py +++ b/colour/models/rgb/transfer_functions/itut_h_273.py @@ -25,9 +25,12 @@ Distribution Master — Image Characteristic. doi:10.5594/SMPTE.ST428-1.2019 """ +from __future__ import annotations + import numpy as np from colour.algebra import spow +from colour.hints import ArrayLike, NDArrayFloat from colour.models.rgb.transfer_functions import ( eotf_DCDM, eotf_inverse_DCDM, @@ -60,7 +63,7 @@ ] -def oetf_H273_Log(L_c): +def oetf_H273_Log(L_c: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-T H.273* opto-electronic transfer function (OETF) for logarithmic encoding (100:1 range). @@ -122,7 +125,7 @@ def oetf_H273_Log(L_c): return as_float(from_range_1(V)) -def oetf_inverse_H273_Log(V): +def oetf_inverse_H273_Log(V: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-T H.273* inverse-opto-electronic transfer function (OETF) for logarithmic encoding (100:1 range). @@ -183,7 +186,7 @@ def oetf_inverse_H273_Log(V): return as_float(from_range_1(L_c)) -def oetf_H273_LogSqrt(L_c): +def oetf_H273_LogSqrt(L_c: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-T H.273* opto-electronic transfer function (OETF) for logarithmic encoding (100\\*Sqrt(10):1 range). @@ -246,7 +249,7 @@ def oetf_H273_LogSqrt(L_c): return as_float(from_range_1(V)) -def oetf_inverse_H273_LogSqrt(V): +def oetf_inverse_H273_LogSqrt(V: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-T H.273* inverse-opto-electronic transfer function (OETF) for logarithmic encoding (100\\*Sqrt(10):1 range). @@ -306,7 +309,7 @@ def oetf_inverse_H273_LogSqrt(V): return as_float(from_range_1(L_c)) -def oetf_H273_IEC61966_2(L_c): +def oetf_H273_IEC61966_2(L_c: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-T H.273* opto-electronic transfer function (OETF) for *IEC 61966-2* family of transfer functions (*2-1 sRGB*, @@ -356,8 +359,10 @@ def oetf_H273_IEC61966_2(L_c): -0.4613561295004... """ + L_c = as_float_array(L_c) + V = np.where( - as_float_array(L_c) >= 0, + L_c >= 0, eotf_inverse_sRGB(L_c), -eotf_inverse_sRGB(-L_c), ) @@ -365,7 +370,7 @@ def oetf_H273_IEC61966_2(L_c): return as_float(V) -def oetf_inverse_H273_IEC61966_2(V): +def oetf_inverse_H273_IEC61966_2(V: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-T H.273* inverse opto-electronic transfer function (OETF) for *IEC 61966-2* family of transfer functions (*2-1 sRGB*, @@ -415,8 +420,10 @@ def oetf_inverse_H273_IEC61966_2(V): -0.1799999999... """ + V = as_float_array(V) + L_c = np.where( - as_float_array(V) >= 0, + V >= 0, eotf_sRGB(V), -eotf_sRGB(-V), ) @@ -424,7 +431,7 @@ def oetf_inverse_H273_IEC61966_2(V): return as_float(L_c) -def eotf_inverse_H273_ST428_1(L_o): +def eotf_inverse_H273_ST428_1(L_o: ArrayLike) -> NDArrayFloat: """ Define *Recommendation ITU-T H.273* inverse electro-optical transfer function (EOTF) for *SMPTE ST 428-1 (2019)*. @@ -474,7 +481,7 @@ def eotf_inverse_H273_ST428_1(L_o): return as_float(from_range_1(eotf_inverse_DCDM(L_o * 48))) -def eotf_H273_ST428_1(V): +def eotf_H273_ST428_1(V: ArrayLike) -> NDArrayFloat: """ Define the *SMPTE ST 428-1 (2019)* electro-optical transfer function (EOTF). diff --git a/colour/models/rgb/transfer_functions/red.py b/colour/models/rgb/transfer_functions/red.py index 7369f0d9d..a3b8fadbf 100644 --- a/colour/models/rgb/transfer_functions/red.py +++ b/colour/models/rgb/transfer_functions/red.py @@ -685,7 +685,7 @@ def log_encoding_Log3G10( def log_decoding_Log3G10( - y, method: Literal["v1", "v2", "v3"] | str = "v3" + y: ArrayLike, method: Literal["v1", "v2", "v3"] | str = "v3" ) -> NDArrayFloat: """ Define the *Log3G10* log decoding curve / electro-optical transfer diff --git a/colour/models/rgb/transfer_functions/tests/test__init__.py b/colour/models/rgb/transfer_functions/tests/test__init__.py index bc5ee0336..723e64eb3 100644 --- a/colour/models/rgb/transfer_functions/tests/test__init__.py +++ b/colour/models/rgb/transfer_functions/tests/test__init__.py @@ -43,7 +43,7 @@ class TestCctfEncoding: definition unit tests methods. """ - def test_raise_exception_cctf_encoding(self): + def test_raise_exception_cctf_encoding(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACESproxy` definition raised exception. @@ -69,7 +69,7 @@ class TestCctfDecoding: definition unit tests methods. """ - def test_raise_exception_cctf_decoding(self): + def test_raise_exception_cctf_decoding(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACESproxy` definition raised exception. @@ -92,7 +92,7 @@ def test_raise_exception_cctf_decoding(self): class TestTransferFunctions: """Define the transfer functions unit tests methods.""" - def test_transfer_functions(self): + def test_transfer_functions(self) -> None: """Test the transfer functions reciprocity.""" ignored_transfer_functions = ( diff --git a/colour/models/rgb/transfer_functions/tests/test_aces.py b/colour/models/rgb/transfer_functions/tests/test_aces.py index 19df0007a..8611f6163 100644 --- a/colour/models/rgb/transfer_functions/tests/test_aces.py +++ b/colour/models/rgb/transfer_functions/tests/test_aces.py @@ -39,7 +39,7 @@ class TestLogEncoding_ACESproxy: definition unit tests methods. """ - def test_log_encoding_ACESproxy(self): + def test_log_encoding_ACESproxy(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACESproxy` definition. @@ -71,7 +71,7 @@ def test_log_encoding_ACESproxy(self): assert log_encoding_ACESproxy(0.18, out_int=True) == 426 - def test_n_dimensional_log_encoding_ACESproxy(self): + def test_n_dimensional_log_encoding_ACESproxy(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACESproxy` definition n-dimensional arrays support. @@ -104,7 +104,7 @@ def test_n_dimensional_log_encoding_ACESproxy(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_log_encoding_ACESproxy(self): + def test_domain_range_scale_log_encoding_ACESproxy(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACESproxy` definition domain and range scale support. @@ -123,7 +123,7 @@ def test_domain_range_scale_log_encoding_ACESproxy(self): ) @ignore_numpy_errors - def test_nan_log_encoding_ACESproxy(self): + def test_nan_log_encoding_ACESproxy(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACESproxy` definition nan support. @@ -139,7 +139,7 @@ class TestLogDecoding_ACESproxy: definition unit tests methods. """ - def test_log_decoding_ACESproxy(self): + def test_log_decoding_ACESproxy(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACESproxy` definition. @@ -175,7 +175,7 @@ def test_log_decoding_ACESproxy(self): atol=0.01, ) - def test_n_dimensional_log_decoding_ACESproxy(self): + def test_n_dimensional_log_decoding_ACESproxy(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACESproxy` definition n-dimensional arrays support. @@ -208,7 +208,7 @@ def test_n_dimensional_log_decoding_ACESproxy(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_log_decoding_ACESproxy(self): + def test_domain_range_scale_log_decoding_ACESproxy(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACESproxy` definition domain and range scale support. @@ -227,7 +227,7 @@ def test_domain_range_scale_log_decoding_ACESproxy(self): ) @ignore_numpy_errors - def test_nan_log_decoding_ACESproxy(self): + def test_nan_log_decoding_ACESproxy(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACESproxy` definition nan support. @@ -242,7 +242,7 @@ class TestLogEncoding_ACEScc: log_encoding_ACEScc` definition unit tests methods. """ - def test_log_encoding_ACEScc(self): + def test_log_encoding_ACEScc(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScc` definition. @@ -266,7 +266,7 @@ def test_log_encoding_ACEScc(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_ACEScc(self): + def test_n_dimensional_log_encoding_ACEScc(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScc` definition n-dimensional arrays support. @@ -293,7 +293,7 @@ def test_n_dimensional_log_encoding_ACEScc(self): log_encoding_ACEScc(lin_AP1), ACEScc, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_ACEScc(self): + def test_domain_range_scale_log_encoding_ACEScc(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScc` definition domain and range scale support. @@ -312,7 +312,7 @@ def test_domain_range_scale_log_encoding_ACEScc(self): ) @ignore_numpy_errors - def test_nan_log_encoding_ACEScc(self): + def test_nan_log_encoding_ACEScc(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScc` definition nan support. @@ -327,7 +327,7 @@ class TestLogDecoding_ACEScc: log_decoding_ACEScc` definition unit tests methods. """ - def test_log_decoding_ACEScc(self): + def test_log_decoding_ACEScc(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScc` definition. @@ -351,7 +351,7 @@ def test_log_decoding_ACEScc(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_ACEScc(self): + def test_n_dimensional_log_decoding_ACEScc(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScc` definition n-dimensional arrays support. @@ -378,7 +378,7 @@ def test_n_dimensional_log_decoding_ACEScc(self): log_decoding_ACEScc(ACEScc), lin_AP1, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_ACEScc(self): + def test_domain_range_scale_log_decoding_ACEScc(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScc` definition domain and range scale support. @@ -397,7 +397,7 @@ def test_domain_range_scale_log_decoding_ACEScc(self): ) @ignore_numpy_errors - def test_nan_log_decoding_ACEScc(self): + def test_nan_log_decoding_ACEScc(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScc` definition nan support. @@ -412,7 +412,7 @@ class TestLogEncoding_ACEScct: log_encoding_ACEScct` definition unit tests methods. """ - def test_log_encoding_ACEScct(self): + def test_log_encoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScct` definition. @@ -436,7 +436,7 @@ def test_log_encoding_ACEScct(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_ACEScct(self): + def test_n_dimensional_log_encoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScct` definition n-dimensional arrays support. @@ -469,7 +469,7 @@ def test_n_dimensional_log_encoding_ACEScct(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_log_encoding_ACEScct(self): + def test_domain_range_scale_log_encoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScct` definition domain and range scale support. @@ -487,7 +487,7 @@ def test_domain_range_scale_log_encoding_ACEScct(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_ACEScc_equivalency_log_encoding_ACEScct(self): + def test_ACEScc_equivalency_log_encoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScct` definition ACEScc equivalency, and explicit requirement @@ -504,7 +504,7 @@ def test_ACEScc_equivalency_log_encoding_ACEScct(self): ) @ignore_numpy_errors - def test_nan_log_encoding_ACEScct(self): + def test_nan_log_encoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_encoding_ACEScct` definition nan support. @@ -519,7 +519,7 @@ class TestLogDecoding_ACEScct: log_decoding_ACEScct` definition unit tests methods. """ - def test_log_decoding_ACEScct(self): + def test_log_decoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScct` definition. @@ -543,7 +543,7 @@ def test_log_decoding_ACEScct(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_ACEScct(self): + def test_n_dimensional_log_decoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScct` definition n-dimensional arrays support. @@ -576,7 +576,7 @@ def test_n_dimensional_log_decoding_ACEScct(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_log_decoding_ACEScct(self): + def test_domain_range_scale_log_decoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScct` definition domain and range scale support. @@ -594,7 +594,7 @@ def test_domain_range_scale_log_decoding_ACEScct(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_ACEScc_equivalency_log_decoding_ACEScct(self): + def test_ACEScc_equivalency_log_decoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScct` definition ACEScc equivalency, and explicit requirement @@ -611,7 +611,7 @@ def test_ACEScc_equivalency_log_decoding_ACEScct(self): ) @ignore_numpy_errors - def test_nan_log_decoding_ACEScct(self): + def test_nan_log_decoding_ACEScct(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.aces.\ log_decoding_ACEScct` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_apple_log_profile.py b/colour/models/rgb/transfer_functions/tests/test_apple_log_profile.py index ff5b9f0df..19e64508f 100644 --- a/colour/models/rgb/transfer_functions/tests/test_apple_log_profile.py +++ b/colour/models/rgb/transfer_functions/tests/test_apple_log_profile.py @@ -31,7 +31,7 @@ class TestLogEncoding_AppleLogProfile: log_encoding_AppleLogProfile` definition unit tests methods. """ - def test_log_encoding_AppleLogProfile(self): + def test_log_encoding_AppleLogProfile(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.apple_log_profile.\ log_encoding_AppleLogProfile` definition. @@ -55,7 +55,7 @@ def test_log_encoding_AppleLogProfile(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_DLog(self): + def test_n_dimensional_log_encoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.apple_log_profile.\ log_encoding_AppleLogProfile` definition n-dimensional arrays support. @@ -82,7 +82,7 @@ def test_n_dimensional_log_encoding_DLog(self): log_encoding_AppleLogProfile(R), P, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_DLog(self): + def test_domain_range_scale_log_encoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.apple_log_profile.\ log_encoding_AppleLogProfile` definition domain and range scale support. @@ -101,7 +101,7 @@ def test_domain_range_scale_log_encoding_DLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_DLog(self): + def test_nan_log_encoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.apple_log_profile.\ log_encoding_AppleLogProfile` definition nan support. @@ -118,7 +118,7 @@ class TestLogDecoding_AppleLogProfile: log_decoding_AppleLogProfile` definition unit tests methods. """ - def test_log_decoding_AppleLogProfile(self): + def test_log_decoding_AppleLogProfile(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.apple_log_profile.\ log_decoding_AppleLogProfile` definition. @@ -142,7 +142,7 @@ def test_log_decoding_AppleLogProfile(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_DLog(self): + def test_n_dimensional_log_decoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.apple_log_profile.\ log_decoding_AppleLogProfile` definition n-dimensional arrays support. @@ -169,7 +169,7 @@ def test_n_dimensional_log_decoding_DLog(self): log_decoding_AppleLogProfile(P), R, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_DLog(self): + def test_domain_range_scale_log_decoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.apple_log_profile.\ log_decoding_AppleLogProfile` definition domain and range scale support. @@ -188,7 +188,7 @@ def test_domain_range_scale_log_decoding_DLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_DLog(self): + def test_nan_log_decoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.apple_log_profile.\ log_decoding_AppleLogProfile` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_arib_std_b67.py b/colour/models/rgb/transfer_functions/tests/test_arib_std_b67.py index fefb6a7ea..f63e41d36 100644 --- a/colour/models/rgb/transfer_functions/tests/test_arib_std_b67.py +++ b/colour/models/rgb/transfer_functions/tests/test_arib_std_b67.py @@ -31,7 +31,7 @@ class TestOetf_ARIBSTDB67: oetf_ARIBSTDB67` definition unit tests methods. """ - def test_oetf_ARIBSTDB67(self): + def test_oetf_ARIBSTDB67(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition. @@ -61,7 +61,7 @@ def test_oetf_ARIBSTDB67(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_ARIBSTDB67(self): + def test_n_dimensional_oetf_ARIBSTDB67(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition n-dimensional arrays support. @@ -88,7 +88,7 @@ def test_n_dimensional_oetf_ARIBSTDB67(self): oetf_ARIBSTDB67(E), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_ARIBSTDB67(self): + def test_domain_range_scale_oetf_ARIBSTDB67(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition domain and range scale support. @@ -107,7 +107,7 @@ def test_domain_range_scale_oetf_ARIBSTDB67(self): ) @ignore_numpy_errors - def test_nan_oetf_ARIBSTDB67(self): + def test_nan_oetf_ARIBSTDB67(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_ARIBSTDB67` definition nan support. @@ -122,7 +122,7 @@ class TestOetf_inverse_ARIBSTDB67: oetf_inverse_ARIBSTDB67` definition unit tests methods. """ - def test_oetf_inverse_ARIBSTDB67(self): + def test_oetf_inverse_ARIBSTDB67(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_inverse_ARIBSTDB67` definition. @@ -154,7 +154,7 @@ def test_oetf_inverse_ARIBSTDB67(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_inverse_ARIBSTDB67(self): + def test_n_dimensional_oetf_inverse_ARIBSTDB67(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_inverse_ARIBSTDB67` definition n-dimensional arrays support. @@ -181,7 +181,7 @@ def test_n_dimensional_oetf_inverse_ARIBSTDB67(self): oetf_inverse_ARIBSTDB67(E_p), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_ARIBSTDB67(self): + def test_domain_range_scale_oetf_inverse_ARIBSTDB67(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_inverse_ARIBSTDB67` definition domain and range scale support. @@ -200,7 +200,7 @@ def test_domain_range_scale_oetf_inverse_ARIBSTDB67(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_ARIBSTDB67(self): + def test_nan_oetf_inverse_ARIBSTDB67(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arib_std_b67.\ oetf_inverse_ARIBSTDB67` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_arri.py b/colour/models/rgb/transfer_functions/tests/test_arri.py index bb01441cc..feffb36c3 100644 --- a/colour/models/rgb/transfer_functions/tests/test_arri.py +++ b/colour/models/rgb/transfer_functions/tests/test_arri.py @@ -35,7 +35,7 @@ class TestLogEncoding_ARRILogC3: log_encoding_ARRILogC3` definition unit tests methods. """ - def test_log_encoding_ARRILogC3(self): + def test_log_encoding_ARRILogC3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_encoding_ARRILogC3` definition. @@ -59,7 +59,7 @@ def test_log_encoding_ARRILogC3(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_ARRILogC3(self): + def test_n_dimensional_log_encoding_ARRILogC3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_encoding_ARRILogC3` definition n-dimensional arrays support. @@ -86,7 +86,7 @@ def test_n_dimensional_log_encoding_ARRILogC3(self): log_encoding_ARRILogC3(x), t, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_ARRILogC3(self): + def test_domain_range_scale_log_encoding_ARRILogC3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_encoding_ARRILogC3` definition domain and range scale support. @@ -105,7 +105,7 @@ def test_domain_range_scale_log_encoding_ARRILogC3(self): ) @ignore_numpy_errors - def test_nan_log_encoding_ARRILogC3(self): + def test_nan_log_encoding_ARRILogC3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_encoding_ARRILogC3` definition nan support. @@ -120,7 +120,7 @@ class TestLogDecoding_ARRILogC3: log_decoding_ARRILogC3` definition unit tests methods. """ - def test_log_decoding_ARRILogC3(self): + def test_log_decoding_ARRILogC3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_decoding_ARRILogC3` definition. @@ -144,7 +144,7 @@ def test_log_decoding_ARRILogC3(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_ARRILogC3(self): + def test_n_dimensional_log_decoding_ARRILogC3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_decoding_ARRILogC3` definition n-dimensional arrays support. @@ -171,7 +171,7 @@ def test_n_dimensional_log_decoding_ARRILogC3(self): log_decoding_ARRILogC3(t), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_ARRILogC3(self): + def test_domain_range_scale_log_decoding_ARRILogC3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_decoding_ARRILogC3` definition domain and range scale support. @@ -190,7 +190,7 @@ def test_domain_range_scale_log_decoding_ARRILogC3(self): ) @ignore_numpy_errors - def test_nan_log_decoding_ARRILogC3(self): + def test_nan_log_decoding_ARRILogC3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_decoding_ARRILogC3` definition nan support. @@ -205,7 +205,7 @@ class TestLogEncoding_ARRILogC4: log_encoding_ARRILogC4` definition unit tests methods. """ - def test_log_encoding_ARRILogC4(self): + def test_log_encoding_ARRILogC4(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_encoding_ARRILogC4` definition. @@ -229,7 +229,7 @@ def test_log_encoding_ARRILogC4(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_ARRILogC4(self): + def test_n_dimensional_log_encoding_ARRILogC4(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_encoding_ARRILogC4` definition n-dimensional arrays support. @@ -256,7 +256,7 @@ def test_n_dimensional_log_encoding_ARRILogC4(self): log_encoding_ARRILogC4(x), t, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_ARRILogC4(self): + def test_domain_range_scale_log_encoding_ARRILogC4(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_encoding_ARRILogC4` definition domain and range scale support. @@ -275,7 +275,7 @@ def test_domain_range_scale_log_encoding_ARRILogC4(self): ) @ignore_numpy_errors - def test_nan_log_encoding_ARRILogC4(self): + def test_nan_log_encoding_ARRILogC4(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_encoding_ARRILogC4` definition nan support. @@ -290,7 +290,7 @@ class TestLogDecoding_ARRILogC4: log_decoding_ARRILogC4` definition unit tests methods. """ - def test_log_decoding_ARRILogC4(self): + def test_log_decoding_ARRILogC4(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_decoding_ARRILogC4` definition. @@ -314,7 +314,7 @@ def test_log_decoding_ARRILogC4(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_ARRILogC4(self): + def test_n_dimensional_log_decoding_ARRILogC4(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_decoding_ARRILogC4` definition n-dimensional arrays support. @@ -341,7 +341,7 @@ def test_n_dimensional_log_decoding_ARRILogC4(self): log_decoding_ARRILogC4(t), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_ARRILogC4(self): + def test_domain_range_scale_log_decoding_ARRILogC4(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_decoding_ARRILogC4` definition domain and range scale support. @@ -360,7 +360,7 @@ def test_domain_range_scale_log_decoding_ARRILogC4(self): ) @ignore_numpy_errors - def test_nan_log_decoding_ARRILogC4(self): + def test_nan_log_decoding_ARRILogC4(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.arri.\ log_decoding_ARRILogC4` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_blackmagic_design.py b/colour/models/rgb/transfer_functions/tests/test_blackmagic_design.py index 622575596..84318a28d 100644 --- a/colour/models/rgb/transfer_functions/tests/test_blackmagic_design.py +++ b/colour/models/rgb/transfer_functions/tests/test_blackmagic_design.py @@ -31,7 +31,7 @@ class TestOetf_BlackmagicFilmGeneration5: oetf_BlackmagicFilmGeneration5` definition unit tests methods. """ - def test_oetf_BlackmagicFilmGeneration5(self): + def test_oetf_BlackmagicFilmGeneration5(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ blackmagic_design.oetf_BlackmagicFilmGeneration5` definition. @@ -67,7 +67,7 @@ def test_oetf_BlackmagicFilmGeneration5(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_BlackmagicFilmGeneration5(self): + def test_n_dimensional_oetf_BlackmagicFilmGeneration5(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ blackmagic_design.oetf_BlackmagicFilmGeneration5` definition n-dimensional @@ -95,7 +95,7 @@ def test_n_dimensional_oetf_BlackmagicFilmGeneration5(self): oetf_BlackmagicFilmGeneration5(L), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_BlackmagicFilmGeneration5(self): + def test_domain_range_scale_oetf_BlackmagicFilmGeneration5(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ blackmagic_design.oetf_BlackmagicFilmGeneration5` definition domain and range @@ -115,7 +115,7 @@ def test_domain_range_scale_oetf_BlackmagicFilmGeneration5(self): ) @ignore_numpy_errors - def test_nan_oetf_BlackmagicFilmGeneration5(self): + def test_nan_oetf_BlackmagicFilmGeneration5(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ blackmagic_design.oetf_BlackmagicFilmGeneration5` definition nan support. @@ -133,7 +133,7 @@ class TestOetf_inverse_BlackmagicFilmGeneration5: methods. """ - def test_oetf_inverse_BlackmagicFilmGeneration5(self): + def test_oetf_inverse_BlackmagicFilmGeneration5(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ blackmagic_design.oetf_inverse_BlackmagicFilmGeneration5` definition. @@ -169,7 +169,7 @@ def test_oetf_inverse_BlackmagicFilmGeneration5(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_inverse_BlackmagicFilmGeneration5(self): + def test_n_dimensional_oetf_inverse_BlackmagicFilmGeneration5(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ blackmagic_design.oetf_inverse_BlackmagicFilmGeneration5` definition @@ -203,7 +203,7 @@ def test_n_dimensional_oetf_inverse_BlackmagicFilmGeneration5(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_oetf_inverse_BlackmagicFilmGeneration5(self): + def test_domain_range_scale_oetf_inverse_BlackmagicFilmGeneration5(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ blackmagic_design.oetf_inverse_BlackmagicFilmGeneration5` definition domain and @@ -223,7 +223,7 @@ def test_domain_range_scale_oetf_inverse_BlackmagicFilmGeneration5(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_BlackmagicFilmGeneration5(self): + def test_nan_oetf_inverse_BlackmagicFilmGeneration5(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ blackmagic_design.oetf_inverse_BlackmagicFilmGeneration5` definition nan diff --git a/colour/models/rgb/transfer_functions/tests/test_canon.py b/colour/models/rgb/transfer_functions/tests/test_canon.py index 509d64754..8f44c0f0d 100644 --- a/colour/models/rgb/transfer_functions/tests/test_canon.py +++ b/colour/models/rgb/transfer_functions/tests/test_canon.py @@ -51,7 +51,7 @@ class TestLogEncoding_CanonLog_v1: log_encoding_CanonLog_v1` definition unit tests methods. """ - def test_log_encoding_CanonLog_v1(self): + def test_log_encoding_CanonLog_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog_v1` definition. @@ -99,7 +99,7 @@ def test_log_encoding_CanonLog_v1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_CanonLog_v1(self): + def test_n_dimensional_log_encoding_CanonLog_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog_v1` definition n-dimensional arrays support. @@ -126,7 +126,7 @@ def test_n_dimensional_log_encoding_CanonLog_v1(self): log_encoding_CanonLog_v1(x), clog, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_CanonLog_v1(self): + def test_domain_range_scale_log_encoding_CanonLog_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog_v1` definition domain and range scale support. @@ -145,7 +145,7 @@ def test_domain_range_scale_log_encoding_CanonLog_v1(self): ) @ignore_numpy_errors - def test_nan_log_encoding_CanonLog_v1(self): + def test_nan_log_encoding_CanonLog_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog_v1` definition nan support. @@ -160,7 +160,7 @@ class TestLogDecoding_CanonLog_v1: log_decoding_CanonLog_v1` definition unit tests methods. """ - def test_log_decoding_CanonLog_v1(self): + def test_log_decoding_CanonLog_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog_v1` definition. @@ -208,7 +208,7 @@ def test_log_decoding_CanonLog_v1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_CanonLog_v1(self): + def test_n_dimensional_log_decoding_CanonLog_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog_v1` definition n-dimensional arrays support. @@ -235,7 +235,7 @@ def test_n_dimensional_log_decoding_CanonLog_v1(self): log_decoding_CanonLog_v1(clog), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_CanonLog_v1(self): + def test_domain_range_scale_log_decoding_CanonLog_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog_v1` definition domain and range scale support. @@ -254,7 +254,7 @@ def test_domain_range_scale_log_decoding_CanonLog_v1(self): ) @ignore_numpy_errors - def test_nan_log_decoding_CanonLog_v1(self): + def test_nan_log_decoding_CanonLog_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog_v1` definition nan support. @@ -269,7 +269,7 @@ class TestLogEncoding_CanonLog_v1_2: log_encoding_CanonLog_v1_2` definition unit tests methods. """ - def test_log_encoding_CanonLog_v1_2(self): + def test_log_encoding_CanonLog_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog_v1_2` definition. @@ -342,7 +342,7 @@ def test_log_encoding_CanonLog_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_CanonLog_v1_2(self): + def test_n_dimensional_log_encoding_CanonLog_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog_v1_2` definition n-dimensional arrays support. @@ -369,7 +369,7 @@ def test_n_dimensional_log_encoding_CanonLog_v1_2(self): log_encoding_CanonLog_v1_2(x), clog, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_CanonLog_v1_2(self): + def test_domain_range_scale_log_encoding_CanonLog_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog_v1_2` definition domain and range scale support. @@ -388,7 +388,7 @@ def test_domain_range_scale_log_encoding_CanonLog_v1_2(self): ) @ignore_numpy_errors - def test_nan_log_encoding_CanonLog_v1_2(self): + def test_nan_log_encoding_CanonLog_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog_v1_2` definition nan support. @@ -403,7 +403,7 @@ class TestLogDecoding_CanonLog_v1_2: log_decoding_CanonLog_v1_2` definition unit tests methods. """ - def test_log_decoding_CanonLog_v1_2(self): + def test_log_decoding_CanonLog_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog_v1_2` definition. @@ -476,7 +476,7 @@ def test_log_decoding_CanonLog_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_CanonLog_v1_2(self): + def test_n_dimensional_log_decoding_CanonLog_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog_v1_2` definition n-dimensional arrays support. @@ -503,7 +503,7 @@ def test_n_dimensional_log_decoding_CanonLog_v1_2(self): log_decoding_CanonLog_v1_2(clog), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_CanonLog_v1_2(self): + def test_domain_range_scale_log_decoding_CanonLog_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog_v1_2` definition domain and range scale support. @@ -522,7 +522,7 @@ def test_domain_range_scale_log_decoding_CanonLog_v1_2(self): ) @ignore_numpy_errors - def test_nan_log_decoding_CanonLog_v1_2(self): + def test_nan_log_decoding_CanonLog_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog_v1_2` definition nan support. @@ -537,7 +537,7 @@ class TestLogEncoding_CanonLog2_v1: log_encoding_CanonLog2_v1` definition unit tests methods. """ - def test_log_encoding_CanonLog2_v1(self): + def test_log_encoding_CanonLog2_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog2_v1` definition. @@ -585,7 +585,7 @@ def test_log_encoding_CanonLog2_v1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_CanonLog2_v1(self): + def test_n_dimensional_log_encoding_CanonLog2_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog2_v1` definition n-dimensional arrays support. @@ -612,7 +612,7 @@ def test_n_dimensional_log_encoding_CanonLog2_v1(self): log_encoding_CanonLog2_v1(x), clog2, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_CanonLog2_v1(self): + def test_domain_range_scale_log_encoding_CanonLog2_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog2_v1` definition domain and range scale support. @@ -631,7 +631,7 @@ def test_domain_range_scale_log_encoding_CanonLog2_v1(self): ) @ignore_numpy_errors - def test_nan_log_encoding_CanonLog2_v1(self): + def test_nan_log_encoding_CanonLog2_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog2_v1` definition nan support. @@ -646,7 +646,7 @@ class TestLogDecoding_CanonLog2_v1: log_decoding_CanonLog2_v1` definition unit tests methods. """ - def test_log_decoding_CanonLog2_v1(self): + def test_log_decoding_CanonLog2_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog2_v1` definition. @@ -694,7 +694,7 @@ def test_log_decoding_CanonLog2_v1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_CanonLog2_v1(self): + def test_n_dimensional_log_decoding_CanonLog2_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog2_v1` definition n-dimensional arrays support. @@ -721,7 +721,7 @@ def test_n_dimensional_log_decoding_CanonLog2_v1(self): log_decoding_CanonLog2_v1(clog2), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_CanonLog2_v1(self): + def test_domain_range_scale_log_decoding_CanonLog2_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog2_v1` definition domain and range scale support. @@ -740,7 +740,7 @@ def test_domain_range_scale_log_decoding_CanonLog2_v1(self): ) @ignore_numpy_errors - def test_nan_log_decoding_CanonLog2_v1(self): + def test_nan_log_decoding_CanonLog2_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog2_v1` definition nan support. @@ -755,7 +755,7 @@ class TestLogEncoding_CanonLog2_v1_2: log_encoding_CanonLog2_v1_2` definition unit tests methods. """ - def test_log_encoding_CanonLog2_v1_2(self): + def test_log_encoding_CanonLog2_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog2_v1_2` definition. @@ -828,7 +828,7 @@ def test_log_encoding_CanonLog2_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_CanonLog2_v1_2(self): + def test_n_dimensional_log_encoding_CanonLog2_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog2_v1_2` definition n-dimensional arrays support. @@ -861,7 +861,7 @@ def test_n_dimensional_log_encoding_CanonLog2_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_log_encoding_CanonLog2_v1_2(self): + def test_domain_range_scale_log_encoding_CanonLog2_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog2_v1_2` definition domain and range scale support. @@ -880,7 +880,7 @@ def test_domain_range_scale_log_encoding_CanonLog2_v1_2(self): ) @ignore_numpy_errors - def test_nan_log_encoding_CanonLog2_v1_2(self): + def test_nan_log_encoding_CanonLog2_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog2_v1_2` definition nan support. @@ -895,7 +895,7 @@ class TestLogDecoding_CanonLog2_v1_2: log_decoding_CanonLog2_v1_2` definition unit tests methods. """ - def test_log_decoding_CanonLog2_v1_2(self): + def test_log_decoding_CanonLog2_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog2_v1_2` definition. @@ -968,7 +968,7 @@ def test_log_decoding_CanonLog2_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_CanonLog2_v1_2(self): + def test_n_dimensional_log_decoding_CanonLog2_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog2_v1_2` definition n-dimensional arrays support. @@ -1001,7 +1001,7 @@ def test_n_dimensional_log_decoding_CanonLog2_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_log_decoding_CanonLog2_v1_2(self): + def test_domain_range_scale_log_decoding_CanonLog2_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog2_v1_2` definition domain and range scale support. @@ -1020,7 +1020,7 @@ def test_domain_range_scale_log_decoding_CanonLog2_v1_2(self): ) @ignore_numpy_errors - def test_nan_log_decoding_CanonLog2_v1_2(self): + def test_nan_log_decoding_CanonLog2_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog2_v1_2` definition nan support. @@ -1035,7 +1035,7 @@ class TestLogEncoding_CanonLog3_v1: log_encoding_CanonLog3_v1` definition unit tests methods. """ - def test_log_encoding_CanonLog3_v1(self): + def test_log_encoding_CanonLog3_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog3_v1` definition. @@ -1083,7 +1083,7 @@ def test_log_encoding_CanonLog3_v1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_CanonLog3_v1(self): + def test_n_dimensional_log_encoding_CanonLog3_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog3_v1` definition n-dimensional arrays support. @@ -1110,7 +1110,7 @@ def test_n_dimensional_log_encoding_CanonLog3_v1(self): log_encoding_CanonLog3_v1(x), clog3, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_CanonLog3_v1(self): + def test_domain_range_scale_log_encoding_CanonLog3_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog3_v1` definition domain and range scale support. @@ -1129,7 +1129,7 @@ def test_domain_range_scale_log_encoding_CanonLog3_v1(self): ) @ignore_numpy_errors - def test_nan_log_encoding_CanonLog3_v1(self): + def test_nan_log_encoding_CanonLog3_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog3_v1` definition nan support. @@ -1144,7 +1144,7 @@ class TestLogDecoding_CanonLog3_v1: log_decoding_CanonLog3_v1` definition unit tests methods. """ - def test_log_decoding_CanonLog3_v1(self): + def test_log_decoding_CanonLog3_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog3_v1` definition. @@ -1192,7 +1192,7 @@ def test_log_decoding_CanonLog3_v1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_CanonLog3_v1(self): + def test_n_dimensional_log_decoding_CanonLog3_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog3_v1` definition n-dimensional arrays support. @@ -1219,7 +1219,7 @@ def test_n_dimensional_log_decoding_CanonLog3_v1(self): log_decoding_CanonLog3_v1(clog3), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_CanonLog3_v1(self): + def test_domain_range_scale_log_decoding_CanonLog3_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog3_v1` definition domain and range scale support. @@ -1238,7 +1238,7 @@ def test_domain_range_scale_log_decoding_CanonLog3_v1(self): ) @ignore_numpy_errors - def test_nan_log_decoding_CanonLog3_v1(self): + def test_nan_log_decoding_CanonLog3_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog3_v1` definition nan support. @@ -1253,7 +1253,7 @@ class TestLogEncoding_CanonLog3_v1_2: log_encoding_CanonLog3_v1_2` definition unit tests methods. """ - def test_log_encoding_CanonLog3_v1_2(self): + def test_log_encoding_CanonLog3_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog3_v1_2` definition. @@ -1326,7 +1326,7 @@ def test_log_encoding_CanonLog3_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_CanonLog3_v1_2(self): + def test_n_dimensional_log_encoding_CanonLog3_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog3_v1_2` definition n-dimensional arrays support. @@ -1359,7 +1359,7 @@ def test_n_dimensional_log_encoding_CanonLog3_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_log_encoding_CanonLog3_v1_2(self): + def test_domain_range_scale_log_encoding_CanonLog3_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog3_v1_2` definition domain and range scale support. @@ -1378,7 +1378,7 @@ def test_domain_range_scale_log_encoding_CanonLog3_v1_2(self): ) @ignore_numpy_errors - def test_nan_log_encoding_CanonLog3_v1_2(self): + def test_nan_log_encoding_CanonLog3_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_encoding_CanonLog3_v1_2` definition nan support. @@ -1393,7 +1393,7 @@ class TestLogDecoding_CanonLog3_v1_2: log_decoding_CanonLog3_v1_2` definition unit tests methods. """ - def test_log_decoding_CanonLog3_v1_2(self): + def test_log_decoding_CanonLog3_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog3_v1_2` definition. @@ -1466,7 +1466,7 @@ def test_log_decoding_CanonLog3_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_CanonLog3_v1_2(self): + def test_n_dimensional_log_decoding_CanonLog3_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog3_v1_2` definition n-dimensional arrays support. @@ -1499,7 +1499,7 @@ def test_n_dimensional_log_decoding_CanonLog3_v1_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_log_decoding_CanonLog3_v1_2(self): + def test_domain_range_scale_log_decoding_CanonLog3_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog3_v1_2` definition domain and range scale support. @@ -1518,7 +1518,7 @@ def test_domain_range_scale_log_decoding_CanonLog3_v1_2(self): ) @ignore_numpy_errors - def test_nan_log_decoding_CanonLog3_v1_2(self): + def test_nan_log_decoding_CanonLog3_v1_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.canon.\ log_decoding_CanonLog3_v1_2` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_cineon.py b/colour/models/rgb/transfer_functions/tests/test_cineon.py index 63722ad26..7354dc916 100644 --- a/colour/models/rgb/transfer_functions/tests/test_cineon.py +++ b/colour/models/rgb/transfer_functions/tests/test_cineon.py @@ -31,7 +31,7 @@ class TestLogEncoding_Cineon: log_encoding_Cineon` definition unit tests methods. """ - def test_log_encoding_Cineon(self): + def test_log_encoding_Cineon(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.cineon.\ log_encoding_Cineon` definition. @@ -55,7 +55,7 @@ def test_log_encoding_Cineon(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_Cineon(self): + def test_n_dimensional_log_encoding_Cineon(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.cineon.\ log_encoding_Cineon` definition n-dimensional arrays support. @@ -82,7 +82,7 @@ def test_n_dimensional_log_encoding_Cineon(self): log_encoding_Cineon(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_Cineon(self): + def test_domain_range_scale_log_encoding_Cineon(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.cineon.\ log_encoding_Cineon` definition domain and range scale support. @@ -101,7 +101,7 @@ def test_domain_range_scale_log_encoding_Cineon(self): ) @ignore_numpy_errors - def test_nan_log_encoding_Cineon(self): + def test_nan_log_encoding_Cineon(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.cineon.\ log_encoding_Cineon` definition nan support. @@ -116,7 +116,7 @@ class TestLogDecoding_Cineon: log_decoding_Cineon` definition unit tests methods. """ - def test_log_decoding_Cineon(self): + def test_log_decoding_Cineon(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.cineon.\ log_decoding_Cineon` definition. @@ -140,7 +140,7 @@ def test_log_decoding_Cineon(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_Cineon(self): + def test_n_dimensional_log_decoding_Cineon(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.cineon.\ log_decoding_Cineon` definition n-dimensional arrays support. @@ -167,7 +167,7 @@ def test_n_dimensional_log_decoding_Cineon(self): log_decoding_Cineon(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_Cineon(self): + def test_domain_range_scale_log_decoding_Cineon(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.cineon.\ log_decoding_Cineon` definition domain and range scale support. @@ -186,7 +186,7 @@ def test_domain_range_scale_log_decoding_Cineon(self): ) @ignore_numpy_errors - def test_nan_log_decoding_Cineon(self): + def test_nan_log_decoding_Cineon(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.cineon.\ log_decoding_Cineon` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_common.py b/colour/models/rgb/transfer_functions/tests/test_common.py index 41f9a4ff1..a72b52206 100644 --- a/colour/models/rgb/transfer_functions/tests/test_common.py +++ b/colour/models/rgb/transfer_functions/tests/test_common.py @@ -33,7 +33,7 @@ class TestCV_range: definition unit tests methods. """ - def test_CV_range(self): + def test_CV_range(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.common.CV_range` definition. @@ -70,7 +70,7 @@ class TestLegalToFull: definition unit tests methods. """ - def test_legal_to_full(self): + def test_legal_to_full(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.common.legal_to_full` definition. @@ -92,7 +92,7 @@ def test_legal_to_full(self): np.testing.assert_allclose(legal_to_full(940, in_int=True, out_int=True), 1023) - def test_n_dimensional_legal_to_full(self): + def test_n_dimensional_legal_to_full(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.common.legal_to_full` definition n-dimensional arrays support. @@ -120,7 +120,7 @@ def test_n_dimensional_legal_to_full(self): ) @ignore_numpy_errors - def test_nan_legal_to_full(self): + def test_nan_legal_to_full(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.common.legal_to_full` definition nan support. @@ -135,7 +135,7 @@ class TestFullToLegal: definition unit tests methods. """ - def test_full_to_legal(self): + def test_full_to_legal(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.common.full_to_legal` definition. @@ -157,7 +157,7 @@ def test_full_to_legal(self): np.testing.assert_allclose(full_to_legal(1023, in_int=True, out_int=True), 940) - def test_n_dimensional_full_to_legal(self): + def test_n_dimensional_full_to_legal(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.common.full_to_legal` definition n-dimensional arrays support. @@ -185,7 +185,7 @@ def test_n_dimensional_full_to_legal(self): ) @ignore_numpy_errors - def test_nan_full_to_legal(self): + def test_nan_full_to_legal(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.common.full_to_legal` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_davinci_intermediate.py b/colour/models/rgb/transfer_functions/tests/test_davinci_intermediate.py index 30bbb191c..863f7c87e 100644 --- a/colour/models/rgb/transfer_functions/tests/test_davinci_intermediate.py +++ b/colour/models/rgb/transfer_functions/tests/test_davinci_intermediate.py @@ -31,7 +31,7 @@ class TestOetf_DaVinciIntermediate: oetf_DaVinciIntermediate` definition unit tests methods. """ - def test_oetf_DaVinciIntermediate(self): + def test_oetf_DaVinciIntermediate(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ davinci_intermediate.oetf_DaVinciIntermediate` definition. @@ -65,7 +65,7 @@ def test_oetf_DaVinciIntermediate(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_DaVinciIntermediate(self): + def test_n_dimensional_oetf_DaVinciIntermediate(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ davinci_intermediate.oetf_DaVinciIntermediate` definition n-dimensional arrays @@ -93,7 +93,7 @@ def test_n_dimensional_oetf_DaVinciIntermediate(self): oetf_DaVinciIntermediate(L), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_DaVinciIntermediate(self): + def test_domain_range_scale_oetf_DaVinciIntermediate(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ davinci_intermediate.oetf_DaVinciIntermediate` definition domain and range @@ -113,7 +113,7 @@ def test_domain_range_scale_oetf_DaVinciIntermediate(self): ) @ignore_numpy_errors - def test_nan_oetf_DaVinciIntermediate(self): + def test_nan_oetf_DaVinciIntermediate(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ davinci_intermediate.oetf_DaVinciIntermediate` definition nan support. @@ -129,7 +129,7 @@ class TestOetf_inverse_DaVinciIntermediate: methods. """ - def test_oetf_inverse_DaVinciIntermediate(self): + def test_oetf_inverse_DaVinciIntermediate(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ davinci_intermediate.oetf_inverse_DaVinciIntermediate` definition. @@ -165,7 +165,7 @@ def test_oetf_inverse_DaVinciIntermediate(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_inverse_DaVinciIntermediate(self): + def test_n_dimensional_oetf_inverse_DaVinciIntermediate(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ davinci_intermediate.oetf_inverse_DaVinciIntermediate` definition n-dimensional @@ -199,7 +199,7 @@ def test_n_dimensional_oetf_inverse_DaVinciIntermediate(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_oetf_inverse_DaVinciIntermediate(self): + def test_domain_range_scale_oetf_inverse_DaVinciIntermediate(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ davinci_intermediate.oetf_inverse_DaVinciIntermediate` definition domain and @@ -219,7 +219,7 @@ def test_domain_range_scale_oetf_inverse_DaVinciIntermediate(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_DaVinciIntermediate(self): + def test_nan_oetf_inverse_DaVinciIntermediate(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ davinci_intermediate.oetf_inverse_DaVinciIntermediate` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_dcdm.py b/colour/models/rgb/transfer_functions/tests/test_dcdm.py index 4913ec832..122504d1c 100644 --- a/colour/models/rgb/transfer_functions/tests/test_dcdm.py +++ b/colour/models/rgb/transfer_functions/tests/test_dcdm.py @@ -28,7 +28,7 @@ class TestEotf_inverse_DCDM: definition unit tests methods. """ - def test_eotf_inverse_DCDM(self): + def test_eotf_inverse_DCDM(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ dcdm.eotf_inverse_DCDM` definition. @@ -48,7 +48,7 @@ def test_eotf_inverse_DCDM(self): assert eotf_inverse_DCDM(0.18, out_int=True) == 462 - def test_n_dimensional_eotf_inverse_DCDM(self): + def test_n_dimensional_eotf_inverse_DCDM(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dcdm.\ eotf_inverse_DCDM` definition n-dimensional arrays support. @@ -75,7 +75,7 @@ def test_n_dimensional_eotf_inverse_DCDM(self): eotf_inverse_DCDM(XYZ), XYZ_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_DCDM(self): + def test_domain_range_scale_eotf_inverse_DCDM(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.\ dcdm.eotf_inverse_DCDM` definition domain and range scale support. @@ -94,7 +94,7 @@ def test_domain_range_scale_eotf_inverse_DCDM(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_DCDM(self): + def test_nan_eotf_inverse_DCDM(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dcdm.\ eotf_inverse_DCDM` definition nan support. @@ -109,7 +109,7 @@ class TestEotf_DCDM: definition unit tests methods. """ - def test_eotf_DCDM(self): + def test_eotf_DCDM(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dcdm.eotf_DCDM` definition. @@ -127,7 +127,7 @@ def test_eotf_DCDM(self): np.testing.assert_allclose(eotf_DCDM(462, in_int=True), 0.18, atol=1e-5) - def test_n_dimensional_eotf_DCDM(self): + def test_n_dimensional_eotf_DCDM(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dcdm.eotf_DCDM` definition n-dimensional arrays support. @@ -148,7 +148,7 @@ def test_n_dimensional_eotf_DCDM(self): XYZ = np.reshape(XYZ, (2, 3, 1)) np.testing.assert_allclose(eotf_DCDM(XYZ_p), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_eotf_DCDM(self): + def test_domain_range_scale_eotf_DCDM(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dcdm.eotf_DCDM` definition domain and range scale support. @@ -167,7 +167,7 @@ def test_domain_range_scale_eotf_DCDM(self): ) @ignore_numpy_errors - def test_nan_eotf_DCDM(self): + def test_nan_eotf_DCDM(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dcdm.eotf_DCDM` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_dicom_gsdf.py b/colour/models/rgb/transfer_functions/tests/test_dicom_gsdf.py index 4fe805e1e..854d7865f 100644 --- a/colour/models/rgb/transfer_functions/tests/test_dicom_gsdf.py +++ b/colour/models/rgb/transfer_functions/tests/test_dicom_gsdf.py @@ -31,7 +31,7 @@ class TestEotf_inverse_DICOMGSDF: eotf_inverse_DICOMGSDF` definition unit tests methods. """ - def test_eotf_inverse_DICOMGSDF(self): + def test_eotf_inverse_DICOMGSDF(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ eotf_inverse_DICOMGSDF` definition. @@ -61,7 +61,7 @@ def test_eotf_inverse_DICOMGSDF(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_eotf_inverse_DICOMGSDF(self): + def test_n_dimensional_eotf_inverse_DICOMGSDF(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ eotf_inverse_DICOMGSDF` definition n-dimensional arrays support. @@ -88,7 +88,7 @@ def test_n_dimensional_eotf_inverse_DICOMGSDF(self): eotf_inverse_DICOMGSDF(L), J, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_DICOMGSDF(self): + def test_domain_range_scale_eotf_inverse_DICOMGSDF(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ eotf_inverse_DICOMGSDF` definition domain and range scale support. @@ -107,7 +107,7 @@ def test_domain_range_scale_eotf_inverse_DICOMGSDF(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_DICOMGSDF(self): + def test_nan_eotf_inverse_DICOMGSDF(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ eotf_inverse_DICOMGSDF` definition nan support. @@ -122,7 +122,7 @@ class TestEotf_DICOMGSDF: eotf_DICOMGSDF` definition unit tests methods. """ - def test_eotf_DICOMGSDF(self): + def test_eotf_DICOMGSDF(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ eotf_DICOMGSDF` definition. @@ -152,7 +152,7 @@ def test_eotf_DICOMGSDF(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_eotf_DICOMGSDF(self): + def test_n_dimensional_eotf_DICOMGSDF(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ eotf_DICOMGSDF` definition n-dimensional arrays support. @@ -173,7 +173,7 @@ def test_n_dimensional_eotf_DICOMGSDF(self): L = np.reshape(L, (2, 3, 1)) np.testing.assert_allclose(eotf_DICOMGSDF(J), L, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_eotf_DICOMGSDF(self): + def test_domain_range_scale_eotf_DICOMGSDF(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ eotf_DICOMGSDF` definition domain and range scale support. @@ -192,7 +192,7 @@ def test_domain_range_scale_eotf_DICOMGSDF(self): ) @ignore_numpy_errors - def test_nan_eotf_DICOMGSDF(self): + def test_nan_eotf_DICOMGSDF(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dicom_gsdf.\ eotf_DICOMGSDF` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_dji_d_log.py b/colour/models/rgb/transfer_functions/tests/test_dji_d_log.py index 1685e7bce..dae2a47f4 100644 --- a/colour/models/rgb/transfer_functions/tests/test_dji_d_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_dji_d_log.py @@ -31,7 +31,7 @@ class TestLogEncoding_DJIDLog: log_encoding_DJIDLog` definition unit tests methods. """ - def test_log_encoding_DJIDLog(self): + def test_log_encoding_DJIDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dji_d_log.\ log_encoding_DJIDLog` definition. @@ -51,7 +51,7 @@ def test_log_encoding_DJIDLog(self): log_encoding_DJIDLog(1.0), 0.584555, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_log_encoding_DLog(self): + def test_n_dimensional_log_encoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dji_d_log.\ log_encoding_DJIDLog` definition n-dimensional arrays support. @@ -78,7 +78,7 @@ def test_n_dimensional_log_encoding_DLog(self): log_encoding_DJIDLog(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_DLog(self): + def test_domain_range_scale_log_encoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dji_d_log.\ log_encoding_DJIDLog` definition domain and range scale support. @@ -97,7 +97,7 @@ def test_domain_range_scale_log_encoding_DLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_DLog(self): + def test_nan_log_encoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dji_d_log.\ log_encoding_DJIDLog` definition nan support. @@ -112,7 +112,7 @@ class TestLogDecoding_DJIDLog: log_decoding_DJIDLog` definition unit tests methods. """ - def test_log_decoding_DJIDLog(self): + def test_log_decoding_DJIDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dji_d_log.\ log_decoding_DJIDLog` definition. @@ -128,7 +128,7 @@ def test_log_decoding_DJIDLog(self): np.testing.assert_allclose(log_decoding_DJIDLog(0.584555), 1.0, atol=1e-6) - def test_n_dimensional_log_decoding_DLog(self): + def test_n_dimensional_log_decoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dji_d_log.\ log_decoding_DJIDLog` definition n-dimensional arrays support. @@ -155,7 +155,7 @@ def test_n_dimensional_log_decoding_DLog(self): log_decoding_DJIDLog(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_DLog(self): + def test_domain_range_scale_log_decoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dji_d_log.\ log_decoding_DJIDLog` definition domain and range scale support. @@ -174,7 +174,7 @@ def test_domain_range_scale_log_decoding_DLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_DLog(self): + def test_nan_log_decoding_DLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.dji_d_log.\ log_decoding_DJIDLog` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_exponent.py b/colour/models/rgb/transfer_functions/tests/test_exponent.py index 260a44e5e..476f4c8c4 100644 --- a/colour/models/rgb/transfer_functions/tests/test_exponent.py +++ b/colour/models/rgb/transfer_functions/tests/test_exponent.py @@ -31,7 +31,7 @@ class TestExponentFunctionBasic: exponent_function_basic` definition unit tests methods. """ - def test_exponent_function_basic(self): + def test_exponent_function_basic(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.exponent.\ exponent_function_basic` definition. @@ -111,7 +111,7 @@ def test_exponent_function_basic(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_exponent_function_basic(self): + def test_n_dimensional_exponent_function_basic(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.exponent.\ exponent_function_basic` definition n-dimensional arrays support. @@ -226,7 +226,7 @@ def test_n_dimensional_exponent_function_basic(self): ) @ignore_numpy_errors - def test_nan_exponent_function_basic(self): + def test_nan_exponent_function_basic(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.exponent.\ exponent_function_basic` definition nan support. @@ -243,7 +243,7 @@ class TestExponentFunctionMonitorCurve: exponent_function_monitor_curve` definition unit tests methods. """ - def test_exponent_function_monitor_curve(self): + def test_exponent_function_monitor_curve(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.exponent.\ exponent_function_monitor_curve` definition. @@ -303,7 +303,7 @@ def test_exponent_function_monitor_curve(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_exponent_function_monitor_curve(self): + def test_n_dimensional_exponent_function_monitor_curve(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.exponent.\ exponent_function_monitor_curve` definition n-dimensional arrays support. @@ -394,7 +394,7 @@ def test_n_dimensional_exponent_function_monitor_curve(self): ) @ignore_numpy_errors - def test_nan_exponent_function_monitor_curve(self): + def test_nan_exponent_function_monitor_curve(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.exponent.\ exponent_function_monitor_curve` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_filmic_pro.py b/colour/models/rgb/transfer_functions/tests/test_filmic_pro.py index adf679c91..0fff4fa15 100644 --- a/colour/models/rgb/transfer_functions/tests/test_filmic_pro.py +++ b/colour/models/rgb/transfer_functions/tests/test_filmic_pro.py @@ -31,7 +31,7 @@ class TestLogEncoding_FilmicPro6: log_encoding_FilmicPro6` definition unit tests methods. """ - def test_log_encoding_FilmicPro6(self): + def test_log_encoding_FilmicPro6(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmic_pro.\ log_encoding_FilmicPro6` definition. @@ -55,7 +55,7 @@ def test_log_encoding_FilmicPro6(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_FilmicPro6(self): + def test_n_dimensional_log_encoding_FilmicPro6(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmic_pro.\ log_encoding_FilmicPro6` definition n-dimensional arrays support. @@ -82,7 +82,7 @@ def test_n_dimensional_log_encoding_FilmicPro6(self): log_encoding_FilmicPro6(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_FilmicPro6(self): + def test_domain_range_scale_log_encoding_FilmicPro6(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmic_pro.\ log_encoding_FilmicPro6` definition domain and range scale support. @@ -101,7 +101,7 @@ def test_domain_range_scale_log_encoding_FilmicPro6(self): ) @ignore_numpy_errors - def test_nan_log_encoding_FilmicPro6(self): + def test_nan_log_encoding_FilmicPro6(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmic_pro.\ log_encoding_FilmicPro6` definition nan support. @@ -116,7 +116,7 @@ class TestLogDecoding_FilmicPro6: log_decoding_FilmicPro6` definition unit tests methods. """ - def test_log_decoding_FilmicPro6(self): + def test_log_decoding_FilmicPro6(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmic_pro.\ log_decoding_FilmicPro6` definition. @@ -136,7 +136,7 @@ def test_log_decoding_FilmicPro6(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_FilmicPro6(self): + def test_n_dimensional_log_decoding_FilmicPro6(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmic_pro.\ log_decoding_FilmicPro6` definition n-dimensional arrays support. @@ -163,7 +163,7 @@ def test_n_dimensional_log_decoding_FilmicPro6(self): log_decoding_FilmicPro6(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_FilmicPro6(self): + def test_domain_range_scale_log_decoding_FilmicPro6(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmic_pro.\ log_decoding_FilmicPro6` definition domain and range scale support. @@ -182,7 +182,7 @@ def test_domain_range_scale_log_decoding_FilmicPro6(self): ) @ignore_numpy_errors - def test_nan_log_decoding_FilmicPro6(self): + def test_nan_log_decoding_FilmicPro6(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmic_pro.\ log_decoding_FilmicPro6` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_filmlight_t_log.py b/colour/models/rgb/transfer_functions/tests/test_filmlight_t_log.py index b8545d5e1..4344e9fd4 100644 --- a/colour/models/rgb/transfer_functions/tests/test_filmlight_t_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_filmlight_t_log.py @@ -31,7 +31,7 @@ class TestLogEncoding_FilmLightTLog: log_encoding_FilmLightTLog` definition unit tests methods. """ - def test_log_encoding_FilmLightTLog(self): + def test_log_encoding_FilmLightTLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmlight_t_log.\ log_encoding_FilmLightTLog` definition. @@ -55,7 +55,7 @@ def test_log_encoding_FilmLightTLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_TLog(self): + def test_n_dimensional_log_encoding_TLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmlight_t_log.\ log_encoding_FilmLightTLog` definition n-dimensional arrays support. @@ -82,7 +82,7 @@ def test_n_dimensional_log_encoding_TLog(self): log_encoding_FilmLightTLog(x), t, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_TLog(self): + def test_domain_range_scale_log_encoding_TLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmlight_t_log.\ log_encoding_FilmLightTLog` definition domain and range scale support. @@ -101,7 +101,7 @@ def test_domain_range_scale_log_encoding_TLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_TLog(self): + def test_nan_log_encoding_TLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmlight_t_log.\ log_encoding_FilmLightTLog` definition nan support. @@ -116,7 +116,7 @@ class TestLogDecoding_FilmLightTLog: log_decoding_FilmLightTLog` definition unit tests methods. """ - def test_log_decoding_FilmLightTLog(self): + def test_log_decoding_FilmLightTLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmlight_t_log.\ log_decoding_FilmLightTLog` definition. @@ -140,7 +140,7 @@ def test_log_decoding_FilmLightTLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_TLog(self): + def test_n_dimensional_log_decoding_TLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmlight_t_log.\ log_decoding_FilmLightTLog` definition n-dimensional arrays support. @@ -167,7 +167,7 @@ def test_n_dimensional_log_decoding_TLog(self): log_decoding_FilmLightTLog(t), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_TLog(self): + def test_domain_range_scale_log_decoding_TLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmlight_t_log.\ log_decoding_FilmLightTLog` definition domain and range scale support. @@ -186,7 +186,7 @@ def test_domain_range_scale_log_decoding_TLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_TLog(self): + def test_nan_log_decoding_TLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.filmlight_t_log.\ log_decoding_FilmLightTLog` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_fujifilm_f_log.py b/colour/models/rgb/transfer_functions/tests/test_fujifilm_f_log.py index 995484070..dccbbd35f 100644 --- a/colour/models/rgb/transfer_functions/tests/test_fujifilm_f_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_fujifilm_f_log.py @@ -35,7 +35,7 @@ class TestLogEncoding_FLog: log_encoding_FLog` definition unit tests methods. """ - def test_log_encoding_FLog(self): + def test_log_encoding_FLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_f_log.\ log_encoding_FLog` definition. @@ -77,7 +77,7 @@ def test_log_encoding_FLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_FLog(self): + def test_n_dimensional_log_encoding_FLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_f_log.\ log_encoding_FLog` definition n-dimensional arrays support. @@ -104,7 +104,7 @@ def test_n_dimensional_log_encoding_FLog(self): log_encoding_FLog(L_in), V_out, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_FLog(self): + def test_domain_range_scale_log_encoding_FLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_f_log.\ log_encoding_FLog` definition domain and range scale support. @@ -123,7 +123,7 @@ def test_domain_range_scale_log_encoding_FLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_FLog(self): + def test_nan_log_encoding_FLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_f_log.\ log_encoding_FLog` definition nan support. @@ -138,7 +138,7 @@ class TestLogDecoding_FLog: log_decoding_FLog` definition unit tests methods. """ - def test_log_decoding_FLog(self): + def test_log_decoding_FLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_f_log.\ log_decoding_FLog` definition. @@ -180,7 +180,7 @@ def test_log_decoding_FLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_FLog(self): + def test_n_dimensional_log_decoding_FLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_f_log.\ log_decoding_FLog` definition n-dimensional arrays support. @@ -207,7 +207,7 @@ def test_n_dimensional_log_decoding_FLog(self): log_decoding_FLog(V_out), L_in, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_FLog(self): + def test_domain_range_scale_log_decoding_FLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_f_log.\ log_decoding_FLog` definition domain and range scale support. @@ -226,7 +226,7 @@ def test_domain_range_scale_log_decoding_FLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_FLog(self): + def test_nan_log_decoding_FLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_f_log.\ log_decoding_FLog` definition nan support. @@ -241,7 +241,7 @@ class TestLogEncoding_FLog2: log_encoding_FLog2` definition unit tests methods. """ - def test_log_encoding_FLog2(self): + def test_log_encoding_FLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ log_encoding_FLog2` definition. @@ -283,7 +283,7 @@ def test_log_encoding_FLog2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_FLog2(self): + def test_n_dimensional_log_encoding_FLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ log_encoding_FLog2` definition n-dimensional arrays support. @@ -310,7 +310,7 @@ def test_n_dimensional_log_encoding_FLog2(self): log_encoding_FLog2(L_in), V_out, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_FLog2(self): + def test_domain_range_scale_log_encoding_FLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ log_encoding_FLog2` definition domain and range scale support. @@ -327,7 +327,7 @@ def test_domain_range_scale_log_encoding_FLog2(self): ) @ignore_numpy_errors - def test_nan_log_encoding_FLog2(self): + def test_nan_log_encoding_FLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ log_encoding_FLog2` definition nan support. @@ -342,7 +342,7 @@ class TestLogDecoding_FLog2: log_decoding_FLog2` definition unit tests methods. """ - def test_log_decoding_FLog2(self): + def test_log_decoding_FLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ log_decoding_FLog2` definition. @@ -384,7 +384,7 @@ def test_log_decoding_FLog2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_FLog2(self): + def test_n_dimensional_log_decoding_FLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ log_decoding_FLog2` definition n-dimensional arrays support. @@ -411,7 +411,7 @@ def test_n_dimensional_log_decoding_FLog2(self): log_decoding_FLog2(V_out), L_in, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_FLog2(self): + def test_domain_range_scale_log_decoding_FLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ log_decoding_FLog2` definition domain and range scale support. @@ -429,7 +429,7 @@ def test_domain_range_scale_log_decoding_FLog2(self): ) @ignore_numpy_errors - def test_nan_log_decoding_FLog2(self): + def test_nan_log_decoding_FLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.fujifilm_flog.\ log_decoding_FLog2` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_gamma.py b/colour/models/rgb/transfer_functions/tests/test_gamma.py index d7e83aca2..97faddae6 100644 --- a/colour/models/rgb/transfer_functions/tests/test_gamma.py +++ b/colour/models/rgb/transfer_functions/tests/test_gamma.py @@ -27,7 +27,7 @@ class TestGammaFunction: definition unit tests methods. """ - def test_gamma_function(self): + def test_gamma_function(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gamma.\ gamma_function` definition. @@ -93,7 +93,7 @@ def test_gamma_function(self): gamma_function(0.0, 2.2, "Clamp"), 0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_gamma_function(self): + def test_n_dimensional_gamma_function(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gamma.\ gamma_function` definition n-dimensional arrays support. @@ -209,7 +209,7 @@ def test_n_dimensional_gamma_function(self): ) @ignore_numpy_errors - def test_nan_gamma_function(self): + def test_nan_gamma_function(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gamma.\ gamma_function` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_gopro.py b/colour/models/rgb/transfer_functions/tests/test_gopro.py index 8ea944ca9..6ea2eda7d 100644 --- a/colour/models/rgb/transfer_functions/tests/test_gopro.py +++ b/colour/models/rgb/transfer_functions/tests/test_gopro.py @@ -31,7 +31,7 @@ class TestLogEncoding_Protune: log_encoding_Protune` definition unit tests methods. """ - def test_log_encoding_Protune(self): + def test_log_encoding_Protune(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gopro.\ log_encoding_Protune` definition. @@ -51,7 +51,7 @@ def test_log_encoding_Protune(self): log_encoding_Protune(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_log_encoding_Protune(self): + def test_n_dimensional_log_encoding_Protune(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gopro.\ log_encoding_Protune` definition n-dimensional arrays support. @@ -78,7 +78,7 @@ def test_n_dimensional_log_encoding_Protune(self): log_encoding_Protune(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_Protune(self): + def test_domain_range_scale_log_encoding_Protune(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gopro.\ log_encoding_Protune` definition domain and range scale support. @@ -97,7 +97,7 @@ def test_domain_range_scale_log_encoding_Protune(self): ) @ignore_numpy_errors - def test_nan_log_encoding_Protune(self): + def test_nan_log_encoding_Protune(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gopro.\ log_encoding_Protune` definition nan support. @@ -112,7 +112,7 @@ class TestLogDecoding_Protune: log_decoding_Protune` definition unit tests methods. """ - def test_log_decoding_Protune(self): + def test_log_decoding_Protune(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gopro.\ log_decoding_Protune` definition. @@ -132,7 +132,7 @@ def test_log_decoding_Protune(self): log_decoding_Protune(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_log_decoding_Protune(self): + def test_n_dimensional_log_decoding_Protune(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gopro.\ log_decoding_Protune` definition n-dimensional arrays support. @@ -159,7 +159,7 @@ def test_n_dimensional_log_decoding_Protune(self): log_decoding_Protune(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_Protune(self): + def test_domain_range_scale_log_decoding_Protune(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gopro.\ log_decoding_Protune` definition domain and range scale support. @@ -178,7 +178,7 @@ def test_domain_range_scale_log_decoding_Protune(self): ) @ignore_numpy_errors - def test_nan_log_decoding_Protune(self): + def test_nan_log_decoding_Protune(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.gopro.\ log_decoding_Protune` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_1361.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_1361.py index 5d9e9912e..d378c2e7e 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_1361.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_1361.py @@ -31,7 +31,7 @@ class TestOetf_BT1361: definition unit tests methods. """ - def test_oetf_BT1361(self): + def test_oetf_BT1361(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1361.\ oetf_BT1361` definition. @@ -57,7 +57,7 @@ def test_oetf_BT1361(self): np.testing.assert_allclose(oetf_BT1361(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_n_dimensional_oetf_BT1361(self): + def test_n_dimensional_oetf_BT1361(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1361.\ oetf_BT1361` definition n-dimensional arrays support. @@ -78,7 +78,7 @@ def test_n_dimensional_oetf_BT1361(self): V = np.reshape(V, (2, 3, 1)) np.testing.assert_allclose(oetf_BT1361(L), V, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_oetf_BT1361(self): + def test_domain_range_scale_oetf_BT1361(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1361.\ oetf_BT1361` definition domain and range scale support. @@ -97,7 +97,7 @@ def test_domain_range_scale_oetf_BT1361(self): ) @ignore_numpy_errors - def test_nan_oetf_BT1361(self): + def test_nan_oetf_BT1361(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1361.\ oetf_BT1361` definition nan support. @@ -112,7 +112,7 @@ class TestOetf_inverse_BT1361: oetf_inverse_BT1361` definition unit tests methods. """ - def test_oetf_inverse_BT1361(self): + def test_oetf_inverse_BT1361(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1361.\ oetf_inverse_BT1361` definition. @@ -144,7 +144,7 @@ def test_oetf_inverse_BT1361(self): oetf_inverse_BT1361(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_inverse_BT1361(self): + def test_n_dimensional_oetf_inverse_BT1361(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1361.\ oetf_inverse_BT1361` definition n-dimensional arrays support. @@ -171,7 +171,7 @@ def test_n_dimensional_oetf_inverse_BT1361(self): oetf_inverse_BT1361(V), L, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_BT1361(self): + def test_domain_range_scale_oetf_inverse_BT1361(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1361.\ oetf_inverse_BT1361` definition domain and range scale support. @@ -190,7 +190,7 @@ def test_domain_range_scale_oetf_inverse_BT1361(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_BT1361(self): + def test_nan_oetf_inverse_BT1361(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1361.\ oetf_inverse_BT1361` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_1886.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_1886.py index e0fdba9fd..36d7ddbba 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_1886.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_1886.py @@ -31,7 +31,7 @@ class TestEotf_inverse_BT1886: eotf_inverse_BT1886` definition unit tests methods. """ - def test_eotf_inverse_BT1886(self): + def test_eotf_inverse_BT1886(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ eotf_inverse_BT1886` definition. @@ -51,7 +51,7 @@ def test_eotf_inverse_BT1886(self): eotf_inverse_BT1886(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_eotf_inverse_BT1886(self): + def test_n_dimensional_eotf_inverse_BT1886(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ eotf_inverse_BT1886` definition n-dimensional arrays support. @@ -78,7 +78,7 @@ def test_n_dimensional_eotf_inverse_BT1886(self): eotf_inverse_BT1886(L), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_BT1886(self): + def test_domain_range_scale_eotf_inverse_BT1886(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ eotf_inverse_BT1886` definition domain and range scale support. @@ -97,7 +97,7 @@ def test_domain_range_scale_eotf_inverse_BT1886(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_BT1886(self): + def test_nan_eotf_inverse_BT1886(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ eotf_inverse_BT1886` definition nan support. @@ -112,7 +112,7 @@ class TestEotf_BT1886: eotf_BT1886` definition unit tests methods. """ - def test_eotf_BT1886(self): + def test_eotf_BT1886(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ eotf_BT1886` definition. @@ -126,7 +126,7 @@ def test_eotf_BT1886(self): np.testing.assert_allclose(eotf_BT1886(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_n_dimensional_eotf_BT1886(self): + def test_n_dimensional_eotf_BT1886(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ eotf_BT1886` definition n-dimensional arrays support. @@ -147,7 +147,7 @@ def test_n_dimensional_eotf_BT1886(self): L = np.reshape(L, (2, 3, 1)) np.testing.assert_allclose(eotf_BT1886(V), L, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_eotf_BT1886(self): + def test_domain_range_scale_eotf_BT1886(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ eotf_BT1886` definition domain and range scale support. @@ -166,7 +166,7 @@ def test_domain_range_scale_eotf_BT1886(self): ) @ignore_numpy_errors - def test_nan_eotf_BT1886(self): + def test_nan_eotf_BT1886(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\ eotf_BT1886` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_2020.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_2020.py index 05a74cfdd..62253d167 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_2020.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_2020.py @@ -31,7 +31,7 @@ class TestOetf_BT2020: oetf_BT2020` definition unit tests methods. """ - def test_oetf_BT2020(self): + def test_oetf_BT2020(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2020.\ oetf_BT2020` definition. @@ -45,7 +45,7 @@ def test_oetf_BT2020(self): np.testing.assert_allclose(oetf_BT2020(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_n_dimensional_oetf_BT2020(self): + def test_n_dimensional_oetf_BT2020(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2020.\ oetf_BT2020` definition n-dimensional arrays support. @@ -66,7 +66,7 @@ def test_n_dimensional_oetf_BT2020(self): E_p = np.reshape(E_p, (2, 3, 1)) np.testing.assert_allclose(oetf_BT2020(E), E_p, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_oetf_BT2020(self): + def test_domain_range_scale_oetf_BT2020(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2020.\ oetf_BT2020` definition domain and range scale support. @@ -85,7 +85,7 @@ def test_domain_range_scale_oetf_BT2020(self): ) @ignore_numpy_errors - def test_nan_oetf_BT2020(self): + def test_nan_oetf_BT2020(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2020.\ oetf_BT2020` definition nan support. @@ -100,7 +100,7 @@ class TestOetf_inverse_BT2020: oetf_inverse_BT2020` definition unit tests methods. """ - def test_oetf_inverse_BT2020(self): + def test_oetf_inverse_BT2020(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2020.\ oetf_inverse_BT2020` definition. @@ -120,7 +120,7 @@ def test_oetf_inverse_BT2020(self): oetf_inverse_BT2020(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_inverse_BT2020(self): + def test_n_dimensional_oetf_inverse_BT2020(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2020.\ oetf_inverse_BT2020` definition n-dimensional arrays support. @@ -147,7 +147,7 @@ def test_n_dimensional_oetf_inverse_BT2020(self): oetf_inverse_BT2020(E_p), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_BT2020(self): + def test_domain_range_scale_oetf_inverse_BT2020(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2020.\ oetf_inverse_BT2020` definition domain and range scale support. @@ -166,7 +166,7 @@ def test_domain_range_scale_oetf_inverse_BT2020(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_BT2020(self): + def test_nan_oetf_inverse_BT2020(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2020.\ oetf_inverse_BT2020` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_2100.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_2100.py index e856a0741..376d33e86 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_2100.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_2100.py @@ -63,7 +63,7 @@ class TestOetf_BT2100_PQ: oetf_BT2100_PQ` definition unit tests methods. """ - def test_oetf_BT2100_PQ(self): + def test_oetf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_BT2100_PQ` definition. @@ -87,7 +87,7 @@ def test_oetf_BT2100_PQ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_BT2100_PQ(self): + def test_n_dimensional_oetf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_BT2100_PQ` definition n-dimensional arrays support. @@ -114,7 +114,7 @@ def test_n_dimensional_oetf_BT2100_PQ(self): oetf_BT2100_PQ(E), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_BT2100_PQ(self): + def test_domain_range_scale_oetf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_BT2100_PQ` definition domain and range scale support. @@ -133,7 +133,7 @@ def test_domain_range_scale_oetf_BT2100_PQ(self): ) @ignore_numpy_errors - def test_nan_oetf_BT2100_PQ(self): + def test_nan_oetf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_BT2100_PQ` definition nan support. @@ -148,7 +148,7 @@ class TestOetf_inverse_BT2100_PQ: oetf_inverse_BT2100_PQ` definition unit tests methods. """ - def test_oetf_inverse_BT2100_PQ(self): + def test_oetf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_inverse_BT2100_PQ` definition. @@ -172,7 +172,7 @@ def test_oetf_inverse_BT2100_PQ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_inverse_BT2100_PQ(self): + def test_n_dimensional_oetf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_inverse_BT2100_PQ` definition n-dimensional arrays support. @@ -199,7 +199,7 @@ def test_n_dimensional_oetf_inverse_BT2100_PQ(self): oetf_inverse_BT2100_PQ(E_p), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_BT2100_PQ(self): + def test_domain_range_scale_oetf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_inverse_BT2100_PQ` definition domain and range scale support. @@ -218,7 +218,7 @@ def test_domain_range_scale_oetf_inverse_BT2100_PQ(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_BT2100_PQ(self): + def test_nan_oetf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_inverse_BT2100_PQ` definition nan support. @@ -233,7 +233,7 @@ class TestEotf_BT2100_PQ: eotf_BT2100_PQ` definition unit tests methods. """ - def test_eotf_BT2100_PQ(self): + def test_eotf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_PQ` definition. @@ -253,7 +253,7 @@ def test_eotf_BT2100_PQ(self): eotf_BT2100_PQ(1.0), 10000.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_eotf_BT2100_PQ(self): + def test_n_dimensional_eotf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_PQ` definition n-dimensional arrays support. @@ -280,7 +280,7 @@ def test_n_dimensional_eotf_BT2100_PQ(self): eotf_BT2100_PQ(E_p), F_D, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_BT2100_PQ(self): + def test_domain_range_scale_eotf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_PQ` definition domain and range scale support. @@ -299,7 +299,7 @@ def test_domain_range_scale_eotf_BT2100_PQ(self): ) @ignore_numpy_errors - def test_nan_eotf_BT2100_PQ(self): + def test_nan_eotf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_PQ` definition nan support. @@ -314,7 +314,7 @@ class TestEotf_inverse_BT2100_PQ: eotf_inverse_BT2100_PQ` definition unit tests methods. """ - def test_eotf_inverse_BT2100_PQ(self): + def test_eotf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_PQ` definition. @@ -336,7 +336,7 @@ def test_eotf_inverse_BT2100_PQ(self): eotf_inverse_BT2100_PQ(10000.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_eotf_inverse_BT2100_PQ(self): + def test_n_dimensional_eotf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_PQ` definition n-dimensional arrays support. @@ -363,7 +363,7 @@ def test_n_dimensional_eotf_inverse_BT2100_PQ(self): eotf_inverse_BT2100_PQ(F_D), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_BT2100_PQ(self): + def test_domain_range_scale_eotf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_PQ` definition domain and range scale support. @@ -382,7 +382,7 @@ def test_domain_range_scale_eotf_inverse_BT2100_PQ(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_BT2100_PQ(self): + def test_nan_eotf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_PQ` definition nan support. @@ -397,7 +397,7 @@ class TestOotf_BT2100_PQ: ootf_BT2100_PQ` definition unit tests methods. """ - def test_ootf_BT2100_PQ(self): + def test_ootf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_PQ` definition. @@ -419,7 +419,7 @@ def test_ootf_BT2100_PQ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ootf_BT2100_PQ(self): + def test_n_dimensional_ootf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_PQ` definition n-dimensional arrays support. @@ -446,7 +446,7 @@ def test_n_dimensional_ootf_BT2100_PQ(self): ootf_BT2100_PQ(E), F_D, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ootf_BT2100_PQ(self): + def test_domain_range_scale_ootf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_PQ` definition domain and range scale support. @@ -465,7 +465,7 @@ def test_domain_range_scale_ootf_BT2100_PQ(self): ) @ignore_numpy_errors - def test_nan_ootf_BT2100_PQ(self): + def test_nan_ootf_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_PQ` definition nan support. @@ -480,7 +480,7 @@ class TestOotf_inverse_BT2100_PQ: ootf_inverse_BT2100_PQ` definition unit tests methods. """ - def test_ootf_inverse_BT2100_PQ(self): + def test_ootf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_PQ` definition. @@ -502,7 +502,7 @@ def test_ootf_inverse_BT2100_PQ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ootf_inverse_BT2100_PQ(self): + def test_n_dimensional_ootf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_PQ` definition n-dimensional arrays support. @@ -529,7 +529,7 @@ def test_n_dimensional_ootf_inverse_BT2100_PQ(self): ootf_inverse_BT2100_PQ(F_D), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ootf_inverse_BT2100_PQ(self): + def test_domain_range_scale_ootf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_PQ` definition domain and range scale support. @@ -548,7 +548,7 @@ def test_domain_range_scale_ootf_inverse_BT2100_PQ(self): ) @ignore_numpy_errors - def test_nan_ootf_inverse_BT2100_PQ(self): + def test_nan_ootf_inverse_BT2100_PQ(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_PQ` definition nan support. @@ -563,7 +563,7 @@ class TestGamma_function_BT2100_HLG: gamma_function_BT2100_HLG` definition unit tests methods. """ - def test_gamma_function_BT2100_HLG(self): + def test_gamma_function_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ gamma_function_BT2100_HLG` definition. @@ -600,7 +600,7 @@ class TestOetf_BT2100_HLG: oetf_BT2100_HLG` definition unit tests methods. """ - def test_oetf_BT2100_HLG(self): + def test_oetf_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_BT2100_HLG` definition. @@ -622,7 +622,7 @@ def test_oetf_BT2100_HLG(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_BT2100_HLG(self): + def test_n_dimensional_oetf_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_BT2100_HLG` definition n-dimensional arrays support. @@ -649,7 +649,7 @@ def test_n_dimensional_oetf_BT2100_HLG(self): oetf_BT2100_HLG(E), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_BT2100_HLG(self): + def test_domain_range_scale_oetf_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_BT2100_HLG` definition domain and range scale support. @@ -668,7 +668,7 @@ def test_domain_range_scale_oetf_BT2100_HLG(self): ) @ignore_numpy_errors - def test_nan_oetf_BT2100_HLG(self): + def test_nan_oetf_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_BT2100_HLG` definition nan support. @@ -683,7 +683,7 @@ class TestOetf_inverse_BT2100_HLG: oetf_inverse_BT2100_HLG` definition unit tests methods. """ - def test_oetf_inverse_BT2100_HLG(self): + def test_oetf_inverse_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_inverse_BT2100_HLG` definition. @@ -705,7 +705,7 @@ def test_oetf_inverse_BT2100_HLG(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_inverse_BT2100_HLG(self): + def test_n_dimensional_oetf_inverse_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_inverse_BT2100_HLG` definition n-dimensional arrays support. @@ -732,7 +732,7 @@ def test_n_dimensional_oetf_inverse_BT2100_HLG(self): oetf_inverse_BT2100_HLG(E_p), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_BT2100_HLG(self): + def test_domain_range_scale_oetf_inverse_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_inverse_BT2100_HLG` definition domain and range scale support. @@ -751,7 +751,7 @@ def test_domain_range_scale_oetf_inverse_BT2100_HLG(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_BT2100_HLG(self): + def test_nan_oetf_inverse_BT2100_HLG(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ oetf_inverse_BT2100_HLG` definition nan support. @@ -766,7 +766,7 @@ class TestEotf_BT2100_HLG_1: eotf_BT2100_HLG_1` definition unit tests methods. """ - def test_eotf_BT2100_HLG_1(self): + def test_eotf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_HLG_1` definition. @@ -794,7 +794,7 @@ def test_eotf_BT2100_HLG_1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_eotf_BT2100_HLG_1(self): + def test_n_dimensional_eotf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_HLG_1` definition n-dimensional arrays support. @@ -845,7 +845,7 @@ def test_n_dimensional_eotf_BT2100_HLG_1(self): eotf_BT2100_HLG_1(E_p), F_D, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_BT2100_HLG_1(self): + def test_domain_range_scale_eotf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_HLG_1` definition domain and range scale support. @@ -864,7 +864,7 @@ def test_domain_range_scale_eotf_BT2100_HLG_1(self): ) @ignore_numpy_errors - def test_nan_eotf_BT2100_HLG_1(self): + def test_nan_eotf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_HLG_1` definition nan support. @@ -879,7 +879,7 @@ class TestEotf_BT2100_HLG_2: eotf_BT2100_HLG_2` definition unit tests methods. """ - def test_eotf_BT2100_HLG_2(self): + def test_eotf_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_HLG_2` definition. @@ -907,7 +907,7 @@ def test_eotf_BT2100_HLG_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_eotf_BT2100_HLG_2(self): + def test_n_dimensional_eotf_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_HLG_2` definition n-dimensional arrays support. @@ -958,7 +958,7 @@ def test_n_dimensional_eotf_BT2100_HLG_2(self): eotf_BT2100_HLG_2(E_p), F_D, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_BT2100_HLG_2(self): + def test_domain_range_scale_eotf_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_HLG_2` definition domain and range scale support. @@ -977,7 +977,7 @@ def test_domain_range_scale_eotf_BT2100_HLG_2(self): ) @ignore_numpy_errors - def test_nan_eotf_BT2100_HLG_2(self): + def test_nan_eotf_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_BT2100_HLG_2` definition nan support. @@ -992,7 +992,7 @@ class TestEotf_inverse_BT2100_HLG_1: eotf_inverse_BT2100_HLG_1` definition unit tests methods. """ - def test_eotf_inverse_BT2100_HLG_1(self): + def test_eotf_inverse_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_HLG_1` definition. @@ -1020,7 +1020,7 @@ def test_eotf_inverse_BT2100_HLG_1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_eotf_inverse_BT2100_HLG_1(self): + def test_n_dimensional_eotf_inverse_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_HLG_1` definition n-dimensional arrays support. @@ -1071,7 +1071,7 @@ def test_n_dimensional_eotf_inverse_BT2100_HLG_1(self): eotf_inverse_BT2100_HLG_1(F_D), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_BT2100_HLG_1(self): + def test_domain_range_scale_eotf_inverse_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_HLG_1` definition domain and range scale support. @@ -1090,7 +1090,7 @@ def test_domain_range_scale_eotf_inverse_BT2100_HLG_1(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_BT2100_HLG_1(self): + def test_nan_eotf_inverse_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_HLG_1` definition nan support. @@ -1105,7 +1105,7 @@ class TestEotf_inverse_BT2100_HLG_2: eotf_inverse_BT2100_HLG_2` definition unit tests methods. """ - def test_eotf_inverse_BT2100_HLG_2(self): + def test_eotf_inverse_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_HLG_2` definition. @@ -1133,7 +1133,7 @@ def test_eotf_inverse_BT2100_HLG_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_eotf_inverse_BT2100_HLG_2(self): + def test_n_dimensional_eotf_inverse_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_HLG_2` definition n-dimensional arrays support. @@ -1184,7 +1184,7 @@ def test_n_dimensional_eotf_inverse_BT2100_HLG_2(self): eotf_inverse_BT2100_HLG_2(F_D), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_BT2100_HLG_2(self): + def test_domain_range_scale_eotf_inverse_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_HLG_2` definition domain and range scale support. @@ -1203,7 +1203,7 @@ def test_domain_range_scale_eotf_inverse_BT2100_HLG_2(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_BT2100_HLG_2(self): + def test_nan_eotf_inverse_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ eotf_inverse_BT2100_HLG_2` definition nan support. @@ -1218,7 +1218,7 @@ class TestOotf_BT2100_HLG_1: ootf_BT2100_HLG_1` definition unit tests methods. """ - def test_ootf_BT2100_HLG_1(self): + def test_ootf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_HLG_1` definition. @@ -1271,7 +1271,7 @@ def test_ootf_BT2100_HLG_1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ootf_BT2100_HLG_1(self): + def test_n_dimensional_ootf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_HLG_1` definition n-dimensional arrays support. @@ -1322,7 +1322,7 @@ def test_n_dimensional_ootf_BT2100_HLG_1(self): ootf_BT2100_HLG_1(E), F_D, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ootf_BT2100_HLG_1(self): + def test_domain_range_scale_ootf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_HLG_1` definition domain and range scale support. @@ -1341,7 +1341,7 @@ def test_domain_range_scale_ootf_BT2100_HLG_1(self): ) @ignore_numpy_errors - def test_nan_ootf_BT2100_HLG_1(self): + def test_nan_ootf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_HLG_1` definition nan support. @@ -1356,7 +1356,7 @@ class TestOotf_BT2100_HLG_2: ootf_BT2100_HLG_2` definition unit tests methods. """ - def test_ootf_BT2100_HLG_2(self): + def test_ootf_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_HLG_2` definition. @@ -1409,7 +1409,7 @@ def test_ootf_BT2100_HLG_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ootf_BT2100_HLG_2(self): + def test_n_dimensional_ootf_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_HLG_2` definition n-dimensional arrays support. @@ -1460,7 +1460,7 @@ def test_n_dimensional_ootf_BT2100_HLG_2(self): ootf_BT2100_HLG_2(E), F_D, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ootf_BT2100_HLG_2(self): + def test_domain_range_scale_ootf_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_HLG_2` definition domain and range scale support. @@ -1479,7 +1479,7 @@ def test_domain_range_scale_ootf_BT2100_HLG_2(self): ) @ignore_numpy_errors - def test_nan_ootf_BT2100_HLG_1(self): + def test_nan_ootf_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_BT2100_HLG_1` definition nan support. @@ -1494,7 +1494,7 @@ class TestOotf_inverse_BT2100_HLG_1: ootf_inverse_BT2100_HLG_1` definition unit tests methods. """ - def test_ootf_inverse_BT2100_HLG_1(self): + def test_ootf_inverse_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_HLG_1` definition. @@ -1547,7 +1547,7 @@ def test_ootf_inverse_BT2100_HLG_1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ootf_inverse_BT2100_HLG_1(self): + def test_n_dimensional_ootf_inverse_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_HLG_1` definition n-dimensional arrays support. @@ -1598,7 +1598,7 @@ def test_n_dimensional_ootf_inverse_BT2100_HLG_1(self): ootf_inverse_BT2100_HLG_1(F_D), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ootf_inverse_BT2100_HLG_1(self): + def test_domain_range_scale_ootf_inverse_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_HLG_1` definition domain and range scale support. @@ -1617,7 +1617,7 @@ def test_domain_range_scale_ootf_inverse_BT2100_HLG_1(self): ) @ignore_numpy_errors - def test_nan_ootf_inverse_BT2100_HLG_1(self): + def test_nan_ootf_inverse_BT2100_HLG_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_HLG_1` definition nan support. @@ -1632,7 +1632,7 @@ class TestOotf_inverse_BT2100_HLG_2: ootf_inverse_BT2100_HLG_2` definition unit tests methods. """ - def test_ootf_inverse_BT2100_HLG_2(self): + def test_ootf_inverse_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_HLG_2` definition. @@ -1685,7 +1685,7 @@ def test_ootf_inverse_BT2100_HLG_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ootf_inverse_BT2100_HLG_2(self): + def test_n_dimensional_ootf_inverse_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_HLG_2` definition n-dimensional arrays support. @@ -1736,7 +1736,7 @@ def test_n_dimensional_ootf_inverse_BT2100_HLG_2(self): ootf_inverse_BT2100_HLG_2(F_D), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ootf_inverse_BT2100_HLG_2(self): + def test_domain_range_scale_ootf_inverse_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_HLG_2` definition domain and range scale support. @@ -1755,7 +1755,7 @@ def test_domain_range_scale_ootf_inverse_BT2100_HLG_2(self): ) @ignore_numpy_errors - def test_nan_ootf_inverse_BT2100_HLG_2(self): + def test_nan_ootf_inverse_BT2100_HLG_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_2100.\ ootf_inverse_BT2100_HLG_2` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_601.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_601.py index 5a3651ab4..cff4c5961 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_601.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_601.py @@ -28,7 +28,7 @@ class TestOetf_BT601: definition unit tests methods. """ - def test_oetf_BT601(self): + def test_oetf_BT601(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ oetf_BT601` definition. @@ -46,7 +46,7 @@ def test_oetf_BT601(self): np.testing.assert_allclose(oetf_BT601(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_n_dimensional_oetf_BT601(self): + def test_n_dimensional_oetf_BT601(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ oetf_BT601` definition n-dimensional arrays support. @@ -67,7 +67,7 @@ def test_n_dimensional_oetf_BT601(self): E = np.reshape(E, (2, 3, 1)) np.testing.assert_allclose(oetf_BT601(L), E, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_oetf_BT601(self): + def test_domain_range_scale_oetf_BT601(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ oetf_BT601` definition domain and range scale support. @@ -86,7 +86,7 @@ def test_domain_range_scale_oetf_BT601(self): ) @ignore_numpy_errors - def test_nan_oetf_BT601(self): + def test_nan_oetf_BT601(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ oetf_BT601` definition nan support. @@ -101,7 +101,7 @@ class TestOetf_inverse_BT601: oetf_inverse_BT601` definition unit tests methods. """ - def test_oetf_inverse_BT601(self): + def test_oetf_inverse_BT601(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ oetf_inverse_BT601` definition. @@ -127,7 +127,7 @@ def test_oetf_inverse_BT601(self): oetf_inverse_BT601(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_inverse_BT601(self): + def test_n_dimensional_oetf_inverse_BT601(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ oetf_inverse_BT601` definition n-dimensional arrays support. @@ -154,7 +154,7 @@ def test_n_dimensional_oetf_inverse_BT601(self): oetf_inverse_BT601(E), L, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_BT601(self): + def test_domain_range_scale_oetf_inverse_BT601(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ oetf_inverse_BT601` definition domain and range scale support. @@ -173,7 +173,7 @@ def test_domain_range_scale_oetf_inverse_BT601(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_BT601(self): + def test_nan_oetf_inverse_BT601(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_601.\ oetf_inverse_BT601` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_itur_bt_709.py b/colour/models/rgb/transfer_functions/tests/test_itur_bt_709.py index 4a1213037..12b628682 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itur_bt_709.py +++ b/colour/models/rgb/transfer_functions/tests/test_itur_bt_709.py @@ -28,7 +28,7 @@ class TestOetf_BT709: definition unit tests methods. """ - def test_oetf_BT709(self): + def test_oetf_BT709(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ oetf_BT709` definition. @@ -46,7 +46,7 @@ def test_oetf_BT709(self): np.testing.assert_allclose(oetf_BT709(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_n_dimensional_oetf_BT709(self): + def test_n_dimensional_oetf_BT709(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ oetf_BT709` definition n-dimensional arrays support. @@ -67,7 +67,7 @@ def test_n_dimensional_oetf_BT709(self): V = np.reshape(V, (2, 3, 1)) np.testing.assert_allclose(oetf_BT709(L), V, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_oetf_BT709(self): + def test_domain_range_scale_oetf_BT709(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ oetf_BT709` definition domain and range scale support. @@ -86,7 +86,7 @@ def test_domain_range_scale_oetf_BT709(self): ) @ignore_numpy_errors - def test_nan_oetf_BT709(self): + def test_nan_oetf_BT709(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ oetf_BT709` definition nan support. @@ -101,7 +101,7 @@ class TestOetf_inverse_BT709: oetf_inverse_BT709` definition unit tests methods. """ - def test_oetf_inverse_BT709(self): + def test_oetf_inverse_BT709(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ oetf_inverse_BT709` definition. @@ -127,7 +127,7 @@ def test_oetf_inverse_BT709(self): oetf_inverse_BT709(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_inverse_BT709(self): + def test_n_dimensional_oetf_inverse_BT709(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ oetf_inverse_BT709` definition n-dimensional arrays support. @@ -154,7 +154,7 @@ def test_n_dimensional_oetf_inverse_BT709(self): oetf_inverse_BT709(V), L, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_BT709(self): + def test_domain_range_scale_oetf_inverse_BT709(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ oetf_inverse_BT709` definition domain and range scale support. @@ -173,7 +173,7 @@ def test_domain_range_scale_oetf_inverse_BT709(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_BT709(self): + def test_nan_oetf_inverse_BT709(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itur_bt_709.\ oetf_inverse_BT709` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_itut_h_273.py b/colour/models/rgb/transfer_functions/tests/test_itut_h_273.py index 0ee07ec45..1d825e96c 100644 --- a/colour/models/rgb/transfer_functions/tests/test_itut_h_273.py +++ b/colour/models/rgb/transfer_functions/tests/test_itut_h_273.py @@ -43,7 +43,7 @@ class TestOetf_H273_Log: oetf_H273_Log` definition unit tests methods. """ - def test_oetf_H273_Log(self): + def test_oetf_H273_Log(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_Log` definition. @@ -63,7 +63,7 @@ def test_oetf_H273_Log(self): oetf_H273_Log(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_H273_Log(self): + def test_n_dimensional_oetf_H273_Log(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_Log` definition n-dimensional arrays support. @@ -84,7 +84,7 @@ def test_n_dimensional_oetf_H273_Log(self): E_p = np.reshape(E_p, (2, 3, 1)) np.testing.assert_allclose(oetf_H273_Log(E), E_p, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_oetf_H273_Log(self): + def test_domain_range_scale_oetf_H273_Log(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_Log` definition domain and range scale support. @@ -103,7 +103,7 @@ def test_domain_range_scale_oetf_H273_Log(self): ) @ignore_numpy_errors - def test_nan_oetf_H273_Log(self): + def test_nan_oetf_H273_Log(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_Log` definition nan support. @@ -118,7 +118,7 @@ class TestOetf_inverse_H273_Log: oetf_inverse_H273_Log` definition unit tests methods. """ - def test_oetf_inverse_H273_Log(self): + def test_oetf_inverse_H273_Log(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_Log` definition. @@ -140,7 +140,7 @@ def test_oetf_inverse_H273_Log(self): oetf_inverse_H273_Log(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_inverse_H273_Log(self): + def test_n_dimensional_oetf_inverse_H273_Log(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_Log` definition n-dimensional arrays support. @@ -167,7 +167,7 @@ def test_n_dimensional_oetf_inverse_H273_Log(self): oetf_inverse_H273_Log(E_p), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_H273_Log(self): + def test_domain_range_scale_oetf_inverse_H273_Log(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_Log` definition domain and range scale support. @@ -186,7 +186,7 @@ def test_domain_range_scale_oetf_inverse_H273_Log(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_H273_Log(self): + def test_nan_oetf_inverse_H273_Log(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_Log` definition nan support. @@ -201,7 +201,7 @@ class TestOetf_H273_LogSqrt: oetf_H273_LogSqrt` definition unit tests methods. """ - def test_oetf_H273_LogSqrt(self): + def test_oetf_H273_LogSqrt(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_LogSqrt` definition. @@ -221,7 +221,7 @@ def test_oetf_H273_LogSqrt(self): oetf_H273_LogSqrt(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_H273_LogSqrt(self): + def test_n_dimensional_oetf_H273_LogSqrt(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_LogSqrt` definition n-dimensional arrays support. @@ -248,7 +248,7 @@ def test_n_dimensional_oetf_H273_LogSqrt(self): oetf_H273_LogSqrt(E), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_H273_LogSqrt(self): + def test_domain_range_scale_oetf_H273_LogSqrt(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_LogSqrt` definition domain and range scale support. @@ -267,7 +267,7 @@ def test_domain_range_scale_oetf_H273_LogSqrt(self): ) @ignore_numpy_errors - def test_nan_oetf_H273_LogSqrt(self): + def test_nan_oetf_H273_LogSqrt(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_LogSqrt` definition nan support. @@ -282,7 +282,7 @@ class TestOetf_inverse_H273_LogSqrt: oetf_inverse_H273_LogSqrt` definition unit tests methods. """ - def test_oetf_inverse_H273_LogSqrt(self): + def test_oetf_inverse_H273_LogSqrt(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_LogSqrt` definition. @@ -306,7 +306,7 @@ def test_oetf_inverse_H273_LogSqrt(self): oetf_inverse_H273_LogSqrt(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_inverse_H273_LogSqrt(self): + def test_n_dimensional_oetf_inverse_H273_LogSqrt(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_LogSqrt` definition n-dimensional arrays support. @@ -333,7 +333,7 @@ def test_n_dimensional_oetf_inverse_H273_LogSqrt(self): oetf_inverse_H273_LogSqrt(E_p), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_H273_LogSqrt(self): + def test_domain_range_scale_oetf_inverse_H273_LogSqrt(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_LogSqrt` definition domain and range scale support. @@ -352,7 +352,7 @@ def test_domain_range_scale_oetf_inverse_H273_LogSqrt(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_H273_LogSqrt(self): + def test_nan_oetf_inverse_H273_LogSqrt(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_LogSqrt` definition nan support. @@ -367,7 +367,7 @@ class TestOetf_H273_IEC61966_2: oetf_H273_IEC61966_2` definition unit tests methods. """ - def test_oetf_H273_IEC61966_2(self): + def test_oetf_H273_IEC61966_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_IEC61966_2` definition. @@ -393,7 +393,7 @@ def test_oetf_H273_IEC61966_2(self): oetf_H273_IEC61966_2(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_H273_IEC61966_2(self): + def test_n_dimensional_oetf_H273_IEC61966_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_IEC61966_2` definition n-dimensional arrays support. @@ -420,7 +420,7 @@ def test_n_dimensional_oetf_H273_IEC61966_2(self): oetf_H273_IEC61966_2(E), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_H273_IEC61966_2(self): + def test_domain_range_scale_oetf_H273_IEC61966_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_IEC61966_2` definition domain and range scale support. @@ -439,7 +439,7 @@ def test_domain_range_scale_oetf_H273_IEC61966_2(self): ) @ignore_numpy_errors - def test_nan_oetf_H273_IEC61966_2(self): + def test_nan_oetf_H273_IEC61966_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_H273_IEC61966_2` definition nan support. @@ -454,7 +454,7 @@ class TestOetf_inverse_H273_IEC61966_2: oetf_inverse_H273_IEC61966_2` definition unit tests methods. """ - def test_oetf_inverse_H273_IEC61966_2(self): + def test_oetf_inverse_H273_IEC61966_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_IEC61966_2` definition. @@ -484,7 +484,7 @@ def test_oetf_inverse_H273_IEC61966_2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_oetf_inverse_H273_IEC61966_2(self): + def test_n_dimensional_oetf_inverse_H273_IEC61966_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_IEC61966_2` definition n-dimensional arrays support. @@ -511,7 +511,7 @@ def test_n_dimensional_oetf_inverse_H273_IEC61966_2(self): oetf_inverse_H273_IEC61966_2(E_p), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_inverse_H273_IEC61966_2(self): + def test_domain_range_scale_oetf_inverse_H273_IEC61966_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_IEC61966_2` definition domain and range scale support. @@ -530,7 +530,7 @@ def test_domain_range_scale_oetf_inverse_H273_IEC61966_2(self): ) @ignore_numpy_errors - def test_nan_oetf_inverse_H273_IEC61966_2(self): + def test_nan_oetf_inverse_H273_IEC61966_2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ oetf_inverse_H273_IEC61966_2` definition nan support. @@ -547,7 +547,7 @@ class TestEotf_inverse_H273_ST428_1: eotf_inverse_H273_ST428_1` definition unit tests methods. """ - def test_eotf_inverse_H273_ST428_1(self): + def test_eotf_inverse_H273_ST428_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ eotf_inverse_H273_ST428_1` definition. @@ -569,7 +569,7 @@ def test_eotf_inverse_H273_ST428_1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_eotf_inverse_H273_ST428_1(self): + def test_n_dimensional_eotf_inverse_H273_ST428_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ eotf_inverse_H273_ST428_1` definition n-dimensional arrays support. @@ -596,7 +596,7 @@ def test_n_dimensional_eotf_inverse_H273_ST428_1(self): eotf_inverse_H273_ST428_1(E), E_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_H273_ST428_1(self): + def test_domain_range_scale_eotf_inverse_H273_ST428_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ eotf_inverse_H273_ST428_1` definition domain and range scale support. @@ -615,7 +615,7 @@ def test_domain_range_scale_eotf_inverse_H273_ST428_1(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_H273_ST428_1(self): + def test_nan_eotf_inverse_H273_ST428_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ eotf_inverse_H273_ST428_1` definition nan support. @@ -630,7 +630,7 @@ class TestEotf_H273_ST428_1: eotf_H273_ST428_1` definition unit tests methods. """ - def test_eotf_H273_ST428_1(self): + def test_eotf_H273_ST428_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ eotf_H273_ST428_1` definition. @@ -652,7 +652,7 @@ def test_eotf_H273_ST428_1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_eotf_H273_ST428_1(self): + def test_n_dimensional_eotf_H273_ST428_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ eotf_H273_ST428_1` definition n-dimensional arrays support. @@ -679,7 +679,7 @@ def test_n_dimensional_eotf_H273_ST428_1(self): eotf_H273_ST428_1(E_p), E, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_H273_ST428_1(self): + def test_domain_range_scale_eotf_H273_ST428_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ eotf_H273_ST428_1` definition domain and range scale support. @@ -698,7 +698,7 @@ def test_domain_range_scale_eotf_H273_ST428_1(self): ) @ignore_numpy_errors - def test_nan_eotf_H273_ST428_1(self): + def test_nan_eotf_H273_ST428_1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.itut_h_273.\ eotf_H273_ST428_1` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_leica_l_log.py b/colour/models/rgb/transfer_functions/tests/test_leica_l_log.py index d9f24bd56..46ca315df 100644 --- a/colour/models/rgb/transfer_functions/tests/test_leica_l_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_leica_l_log.py @@ -31,7 +31,7 @@ class TestLogEncoding_LLog: log_encoding_LLog` definition unit tests methods. """ - def test_log_encoding_LLog(self): + def test_log_encoding_LLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.leica_l_log.\ log_encoding_LLog` definition. @@ -73,7 +73,7 @@ def test_log_encoding_LLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_LLog(self): + def test_n_dimensional_log_encoding_LLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.leica_l_log.\ log_encoding_LLog` definition n-dimensional arrays support. @@ -100,7 +100,7 @@ def test_n_dimensional_log_encoding_LLog(self): log_encoding_LLog(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_LLog(self): + def test_domain_range_scale_log_encoding_LLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.leica_l_log.\ log_encoding_LLog` definition domain and range scale support. @@ -119,7 +119,7 @@ def test_domain_range_scale_log_encoding_LLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_LLog(self): + def test_nan_log_encoding_LLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.leica_l_log.\ log_encoding_LLog` definition nan support. @@ -134,7 +134,7 @@ class TestLogDecoding_LLog: log_decoding_LLog` definition unit tests methods. """ - def test_log_decoding_LLog(self): + def test_log_decoding_LLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.leica_l_log.\ log_decoding_LLog` definition. @@ -176,7 +176,7 @@ def test_log_decoding_LLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_LLog(self): + def test_n_dimensional_log_decoding_LLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.leica_l_log.\ log_decoding_LLog` definition n-dimensional arrays support. @@ -203,7 +203,7 @@ def test_n_dimensional_log_decoding_LLog(self): log_decoding_LLog(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_LLog(self): + def test_domain_range_scale_log_decoding_LLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.leica_l_log.\ log_decoding_LLog` definition domain and range scale support. @@ -222,7 +222,7 @@ def test_domain_range_scale_log_decoding_LLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_LLog(self): + def test_nan_log_decoding_LLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.leica_l_log.\ log_decoding_LLog` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_linear.py b/colour/models/rgb/transfer_functions/tests/test_linear.py index d96254cdd..8c828ebe8 100644 --- a/colour/models/rgb/transfer_functions/tests/test_linear.py +++ b/colour/models/rgb/transfer_functions/tests/test_linear.py @@ -27,7 +27,7 @@ class TestLinearFunction: linear_function` definition unit tests methods. """ - def test_linear_function(self): + def test_linear_function(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.linear.\ linear_function` definition. @@ -39,7 +39,7 @@ def test_linear_function(self): assert linear_function(1.0) == 1.0 - def test_n_dimensional_linear_function(self): + def test_n_dimensional_linear_function(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.linear.\ linear_function` definition n-dimensional arrays support. @@ -67,7 +67,7 @@ def test_n_dimensional_linear_function(self): ) @ignore_numpy_errors - def test_nan_linear_function(self): + def test_nan_linear_function(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.linear.\ linear_function` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_log.py b/colour/models/rgb/transfer_functions/tests/test_log.py index e766727bd..bce25b756 100644 --- a/colour/models/rgb/transfer_functions/tests/test_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_log.py @@ -37,7 +37,7 @@ class TestLogarithmFunction_Basic: logarithmic_function_basic` definition unit tests methods. """ - def test_logarithmic_function_basic(self): + def test_logarithmic_function_basic(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_basic` definition. @@ -79,7 +79,7 @@ def test_logarithmic_function_basic(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_logarithmic_function_basic(self): + def test_n_dimensional_logarithmic_function_basic(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_basic` definition n-dimensional arrays support. @@ -116,7 +116,7 @@ def test_n_dimensional_logarithmic_function_basic(self): ) @ignore_numpy_errors - def test_nan_logarithmic_function_basic(self): + def test_nan_logarithmic_function_basic(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_basic` definition nan support. @@ -134,7 +134,7 @@ class TestLogarithmFunction_Quasilog: logarithmic_function_quasilog` definition unit tests methods. """ - def test_logarithmic_function_quasilog(self): + def test_logarithmic_function_quasilog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_quasilog` definition. @@ -220,7 +220,7 @@ def test_logarithmic_function_quasilog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_logarithmic_function_quasilog(self): + def test_n_dimensional_logarithmic_function_quasilog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_quasilog` definition n-dimensional arrays support. @@ -257,7 +257,7 @@ def test_n_dimensional_logarithmic_function_quasilog(self): ) @ignore_numpy_errors - def test_nan_logarithmic_function_quasilog(self): + def test_nan_logarithmic_function_quasilog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_quasilog` definition nan support. @@ -275,7 +275,7 @@ class TestLogarithmFunction_Camera: logarithmic_function_camera` definition unit tests methods. """ - def test_logarithmic_function_camera(self): + def test_logarithmic_function_camera(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_camera` definition. @@ -432,7 +432,7 @@ def test_logarithmic_function_camera(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_logarithmic_function_camera(self): + def test_n_dimensional_logarithmic_function_camera(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_camera` definition n-dimensional arrays support. @@ -469,7 +469,7 @@ def test_n_dimensional_logarithmic_function_camera(self): ) @ignore_numpy_errors - def test_nan_logarithmic_function_camera(self): + def test_nan_logarithmic_function_camera(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ logarithmic_function_camera` definition nan support. @@ -487,7 +487,7 @@ class TestLogEncoding_Log2: log_encoding_Log2` definition unit tests methods. """ - def test_log_encoding_Log2(self): + def test_log_encoding_Log2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ log_encoding_Log2` definition. @@ -525,7 +525,7 @@ def test_log_encoding_Log2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_Log2(self): + def test_n_dimensional_log_encoding_Log2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ log_encoding_Log2` definition n-dimensional arrays support. @@ -552,7 +552,7 @@ def test_n_dimensional_log_encoding_Log2(self): log_encoding_Log2(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_Log2(self): + def test_domain_range_scale_log_encoding_Log2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ log_encoding_Log2` definition domain and range scale support. @@ -571,7 +571,7 @@ def test_domain_range_scale_log_encoding_Log2(self): ) @ignore_numpy_errors - def test_nan_log_encoding_Log2(self): + def test_nan_log_encoding_Log2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ log_encoding_Log2` definition nan support. @@ -586,7 +586,7 @@ class TestLogDecoding_Log2: log_decoding_Log2` definition unit tests methods. """ - def test_log_decoding_Log2(self): + def test_log_decoding_Log2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ log_decoding_Log2` definition. @@ -626,7 +626,7 @@ def test_log_decoding_Log2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_Log2(self): + def test_n_dimensional_log_decoding_Log2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ log_decoding_Log2` definition n-dimensional arrays support. @@ -653,7 +653,7 @@ def test_n_dimensional_log_decoding_Log2(self): log_decoding_Log2(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_Log2(self): + def test_domain_range_scale_log_decoding_Log2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ log_decoding_Log2` definition domain and range scale support. @@ -672,7 +672,7 @@ def test_domain_range_scale_log_decoding_Log2(self): ) @ignore_numpy_errors - def test_nan_log_decoding_Log2(self): + def test_nan_log_decoding_Log2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.log.\ log_decoding_Log2` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_nikon_n_log.py b/colour/models/rgb/transfer_functions/tests/test_nikon_n_log.py index 04e75ea83..64e8f3434 100644 --- a/colour/models/rgb/transfer_functions/tests/test_nikon_n_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_nikon_n_log.py @@ -31,7 +31,7 @@ class TestLogEncoding_NLog: log_encoding_NLog` definition unit tests methods. """ - def test_log_encoding_NLog(self): + def test_log_encoding_NLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.nikon_n_log.\ log_encoding_NLog` definition. @@ -73,7 +73,7 @@ def test_log_encoding_NLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_NLog(self): + def test_n_dimensional_log_encoding_NLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.nikon_n_log.\ log_encoding_NLog` definition n-dimensional arrays support. @@ -100,7 +100,7 @@ def test_n_dimensional_log_encoding_NLog(self): log_encoding_NLog(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_NLog(self): + def test_domain_range_scale_log_encoding_NLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.nikon_n_log.\ log_encoding_NLog` definition domain and range scale support. @@ -119,7 +119,7 @@ def test_domain_range_scale_log_encoding_NLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_NLog(self): + def test_nan_log_encoding_NLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.nikon_n_log.\ log_encoding_NLog` definition nan support. @@ -134,7 +134,7 @@ class TestLogDecoding_NLog: log_decoding_NLog` definition unit tests methods. """ - def test_log_decoding_NLog(self): + def test_log_decoding_NLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.nikon_n_log.\ log_decoding_NLog` definition. @@ -176,7 +176,7 @@ def test_log_decoding_NLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_NLog(self): + def test_n_dimensional_log_decoding_NLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.nikon_n_log.\ log_decoding_NLog` definition n-dimensional arrays support. @@ -203,7 +203,7 @@ def test_n_dimensional_log_decoding_NLog(self): log_decoding_NLog(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_NLog(self): + def test_domain_range_scale_log_decoding_NLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.nikon_n_log.\ log_decoding_NLog` definition domain and range scale support. @@ -222,7 +222,7 @@ def test_domain_range_scale_log_decoding_NLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_NLog(self): + def test_nan_log_decoding_NLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.nikon_n_log.\ log_decoding_NLog` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_panalog.py b/colour/models/rgb/transfer_functions/tests/test_panalog.py index 59ba916dc..837e53c14 100644 --- a/colour/models/rgb/transfer_functions/tests/test_panalog.py +++ b/colour/models/rgb/transfer_functions/tests/test_panalog.py @@ -31,7 +31,7 @@ class TestLogEncoding_Panalog: log_encoding_Panalog` definition unit tests methods. """ - def test_log_encoding_Panalog(self): + def test_log_encoding_Panalog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panalog.\ log_encoding_Panalog` definition. @@ -55,7 +55,7 @@ def test_log_encoding_Panalog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_Panalog(self): + def test_n_dimensional_log_encoding_Panalog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panalog.\ log_encoding_Panalog` definition n-dimensional arrays support. @@ -82,7 +82,7 @@ def test_n_dimensional_log_encoding_Panalog(self): log_encoding_Panalog(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_Panalog(self): + def test_domain_range_scale_log_encoding_Panalog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panalog.\ log_encoding_Panalog` definition domain and range scale support. @@ -101,7 +101,7 @@ def test_domain_range_scale_log_encoding_Panalog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_Panalog(self): + def test_nan_log_encoding_Panalog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panalog.\ log_encoding_Panalog` definition nan support. @@ -116,7 +116,7 @@ class TestLogDecoding_Panalog: log_decoding_Panalog` definition unit tests methods. """ - def test_log_decoding_Panalog(self): + def test_log_decoding_Panalog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panalog.\ log_decoding_Panalog` definition. @@ -140,7 +140,7 @@ def test_log_decoding_Panalog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_Panalog(self): + def test_n_dimensional_log_decoding_Panalog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panalog.\ log_decoding_Panalog` definition n-dimensional arrays support. @@ -167,7 +167,7 @@ def test_n_dimensional_log_decoding_Panalog(self): log_decoding_Panalog(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_Panalog(self): + def test_domain_range_scale_log_decoding_Panalog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panalog.\ log_decoding_Panalog` definition domain and range scale support. @@ -186,7 +186,7 @@ def test_domain_range_scale_log_decoding_Panalog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_Panalog(self): + def test_nan_log_decoding_Panalog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panalog.\ log_decoding_Panalog` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_panasonic_vlog.py b/colour/models/rgb/transfer_functions/tests/test_panasonic_vlog.py index fb6cbac08..7e0e39617 100644 --- a/colour/models/rgb/transfer_functions/tests/test_panasonic_vlog.py +++ b/colour/models/rgb/transfer_functions/tests/test_panasonic_vlog.py @@ -31,7 +31,7 @@ class TestLogEncoding_VLog: log_encoding_VLog` definition unit tests methods. """ - def test_log_encoding_VLog(self): + def test_log_encoding_VLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panasonic_v_log.\ log_encoding_VLog` definition. @@ -71,7 +71,7 @@ def test_log_encoding_VLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_VLog(self): + def test_n_dimensional_log_encoding_VLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panasonic_v_log.\ log_encoding_VLog` definition n-dimensional arrays support. @@ -98,7 +98,7 @@ def test_n_dimensional_log_encoding_VLog(self): log_encoding_VLog(L_in), V_out, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_VLog(self): + def test_domain_range_scale_log_encoding_VLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panasonic_v_log.\ log_encoding_VLog` definition domain and range scale support. @@ -117,7 +117,7 @@ def test_domain_range_scale_log_encoding_VLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_VLog(self): + def test_nan_log_encoding_VLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panasonic_v_log.\ log_encoding_VLog` definition nan support. @@ -132,7 +132,7 @@ class TestLogDecoding_VLog: log_decoding_VLog` definition unit tests methods. """ - def test_log_decoding_VLog(self): + def test_log_decoding_VLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panasonic_v_log.\ log_decoding_VLog` definition. @@ -172,7 +172,7 @@ def test_log_decoding_VLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_VLog(self): + def test_n_dimensional_log_decoding_VLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panasonic_v_log.\ log_decoding_VLog` definition n-dimensional arrays support. @@ -199,7 +199,7 @@ def test_n_dimensional_log_decoding_VLog(self): log_decoding_VLog(V_out), L_in, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_VLog(self): + def test_domain_range_scale_log_decoding_VLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panasonic_v_log.\ log_decoding_VLog` definition domain and range scale support. @@ -218,7 +218,7 @@ def test_domain_range_scale_log_decoding_VLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_VLog(self): + def test_nan_log_decoding_VLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.panasonic_v_log.\ log_decoding_VLog` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_pivoted_log.py b/colour/models/rgb/transfer_functions/tests/test_pivoted_log.py index 3c77826d0..65b605416 100644 --- a/colour/models/rgb/transfer_functions/tests/test_pivoted_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_pivoted_log.py @@ -31,7 +31,7 @@ class TestLogEncoding_PivotedLog: log_encoding_PivotedLog` definition unit tests methods. """ - def test_log_encoding_PivotedLog(self): + def test_log_encoding_PivotedLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition. @@ -55,7 +55,7 @@ def test_log_encoding_PivotedLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_PivotedLog(self): + def test_n_dimensional_log_encoding_PivotedLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition n-dimensional arrays support. @@ -82,7 +82,7 @@ def test_n_dimensional_log_encoding_PivotedLog(self): log_encoding_PivotedLog(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_PivotedLog(self): + def test_domain_range_scale_log_encoding_PivotedLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition domain and range scale support. @@ -101,7 +101,7 @@ def test_domain_range_scale_log_encoding_PivotedLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_PivotedLog(self): + def test_nan_log_encoding_PivotedLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_encoding_PivotedLog` definition nan support. @@ -116,7 +116,7 @@ class TestLogDecoding_PivotedLog: log_decoding_PivotedLog` definition unit tests methods. """ - def test_log_decoding_PivotedLog(self): + def test_log_decoding_PivotedLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_decoding_PivotedLog` definition. @@ -140,7 +140,7 @@ def test_log_decoding_PivotedLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_PivotedLog(self): + def test_n_dimensional_log_decoding_PivotedLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_decoding_PivotedLog` definition n-dimensional arrays support. @@ -167,7 +167,7 @@ def test_n_dimensional_log_decoding_PivotedLog(self): log_decoding_PivotedLog(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_PivotedLog(self): + def test_domain_range_scale_log_decoding_PivotedLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_decoding_PivotedLog` definition domain and range scale support. @@ -186,7 +186,7 @@ def test_domain_range_scale_log_decoding_PivotedLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_PivotedLog(self): + def test_nan_log_decoding_PivotedLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.pivoted_log.\ log_decoding_PivotedLog` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_red.py b/colour/models/rgb/transfer_functions/tests/test_red.py index e6e6cf654..e4f3a39ae 100644 --- a/colour/models/rgb/transfer_functions/tests/test_red.py +++ b/colour/models/rgb/transfer_functions/tests/test_red.py @@ -53,7 +53,7 @@ class TestLogEncoding_REDLog: log_encoding_REDLog` definition unit tests methods. """ - def test_log_encoding_REDLog(self): + def test_log_encoding_REDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_REDLog` definition. @@ -73,7 +73,7 @@ def test_log_encoding_REDLog(self): log_encoding_REDLog(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_log_encoding_REDLog(self): + def test_n_dimensional_log_encoding_REDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_REDLog` definition n-dimensional arrays support. @@ -100,7 +100,7 @@ def test_n_dimensional_log_encoding_REDLog(self): log_encoding_REDLog(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_REDLog(self): + def test_domain_range_scale_log_encoding_REDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_REDLog` definition domain and range scale support. @@ -119,7 +119,7 @@ def test_domain_range_scale_log_encoding_REDLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_REDLog(self): + def test_nan_log_encoding_REDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_REDLog` definition nan support. @@ -134,7 +134,7 @@ class TestLogDecoding_REDLog: log_decoding_REDLog` definition unit tests methods. """ - def test_log_decoding_REDLog(self): + def test_log_decoding_REDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_REDLog` definition. @@ -154,7 +154,7 @@ def test_log_decoding_REDLog(self): log_decoding_REDLog(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_log_decoding_REDLog(self): + def test_n_dimensional_log_decoding_REDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_REDLog` definition n-dimensional arrays support. @@ -181,7 +181,7 @@ def test_n_dimensional_log_decoding_REDLog(self): log_decoding_REDLog(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_REDLog(self): + def test_domain_range_scale_log_decoding_REDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_REDLog` definition domain and range scale support. @@ -200,7 +200,7 @@ def test_domain_range_scale_log_decoding_REDLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_REDLog(self): + def test_nan_log_decoding_REDLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_REDLog` definition nan support. @@ -215,7 +215,7 @@ class TestLogEncoding_REDLogFilm: log_encoding_REDLogFilm` definition unit tests methods. """ - def test_log_encoding_REDLogFilm(self): + def test_log_encoding_REDLogFilm(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_REDLogFilm` definition. @@ -239,7 +239,7 @@ def test_log_encoding_REDLogFilm(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_REDLogFilm(self): + def test_n_dimensional_log_encoding_REDLogFilm(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_REDLogFilm` definition n-dimensional arrays support. @@ -266,7 +266,7 @@ def test_n_dimensional_log_encoding_REDLogFilm(self): log_encoding_REDLogFilm(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_REDLogFilm(self): + def test_domain_range_scale_log_encoding_REDLogFilm(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_REDLogFilm` definition domain and range scale support. @@ -285,7 +285,7 @@ def test_domain_range_scale_log_encoding_REDLogFilm(self): ) @ignore_numpy_errors - def test_nan_log_encoding_REDLogFilm(self): + def test_nan_log_encoding_REDLogFilm(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_REDLogFilm` definition nan support. @@ -300,7 +300,7 @@ class TestLogDecoding_REDLogFilm: log_decoding_REDLogFilm` definition unit tests methods. """ - def test_log_decoding_REDLogFilm(self): + def test_log_decoding_REDLogFilm(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_REDLogFilm` definition. @@ -324,7 +324,7 @@ def test_log_decoding_REDLogFilm(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_REDLogFilm(self): + def test_n_dimensional_log_decoding_REDLogFilm(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_REDLogFilm` definition n-dimensional arrays support. @@ -351,7 +351,7 @@ def test_n_dimensional_log_decoding_REDLogFilm(self): log_decoding_REDLogFilm(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_REDLogFilm(self): + def test_domain_range_scale_log_decoding_REDLogFilm(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_REDLogFilm` definition domain and range scale support. @@ -370,7 +370,7 @@ def test_domain_range_scale_log_decoding_REDLogFilm(self): ) @ignore_numpy_errors - def test_nan_log_decoding_REDLogFilm(self): + def test_nan_log_decoding_REDLogFilm(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_REDLogFilm` definition nan support. @@ -385,7 +385,7 @@ class TestLogEncoding_Log3G10_v1: log_encoding_Log3G10_v1` definition unit tests methods. """ - def test_log_encoding_Log3G10_v1(self): + def test_log_encoding_Log3G10_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v1` definition. @@ -407,7 +407,7 @@ def test_log_encoding_Log3G10_v1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_Log3G10_v1(self): + def test_n_dimensional_log_encoding_Log3G10_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v1` definition n-dimensional arrays support. @@ -434,7 +434,7 @@ def test_n_dimensional_log_encoding_Log3G10_v1(self): log_encoding_Log3G10_v1(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_Log3G10_v1(self): + def test_domain_range_scale_log_encoding_Log3G10_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v1` definition domain and range scale support. @@ -453,7 +453,7 @@ def test_domain_range_scale_log_encoding_Log3G10_v1(self): ) @ignore_numpy_errors - def test_nan_log_encoding_Log3G10_v1(self): + def test_nan_log_encoding_Log3G10_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v1` definition nan support. @@ -468,7 +468,7 @@ class TestLogDecoding_Log3G10_v1: log_decoding_Log3G10_v1` definition unit tests methods. """ - def test_log_decoding_Log3G10_v1(self): + def test_log_decoding_Log3G10_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v1` definition. @@ -490,7 +490,7 @@ def test_log_decoding_Log3G10_v1(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_Log3G10_v1(self): + def test_n_dimensional_log_decoding_Log3G10_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v1` definition n-dimensional arrays support. @@ -517,7 +517,7 @@ def test_n_dimensional_log_decoding_Log3G10_v1(self): log_decoding_Log3G10_v1(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_Log3G10_v1(self): + def test_domain_range_scale_log_decoding_Log3G10_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v1` definition domain and range scale support. @@ -536,7 +536,7 @@ def test_domain_range_scale_log_decoding_Log3G10_v1(self): ) @ignore_numpy_errors - def test_nan_log_decoding_Log3G10_v1(self): + def test_nan_log_decoding_Log3G10_v1(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v1` definition nan support. @@ -551,7 +551,7 @@ class TestLogEncoding_Log3G10_v2: log_encoding_Log3G10_v2` definition unit tests methods. """ - def test_log_encoding_Log3G10_v2(self): + def test_log_encoding_Log3G10_v2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v2` definition. @@ -575,7 +575,7 @@ def test_log_encoding_Log3G10_v2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_Log3G10_v2(self): + def test_n_dimensional_log_encoding_Log3G10_v2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v2` definition n-dimensional arrays support. @@ -602,7 +602,7 @@ def test_n_dimensional_log_encoding_Log3G10_v2(self): log_encoding_Log3G10_v2(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_Log3G10_v2(self): + def test_domain_range_scale_log_encoding_Log3G10_v2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v2` definition domain and range scale support. @@ -621,7 +621,7 @@ def test_domain_range_scale_log_encoding_Log3G10_v2(self): ) @ignore_numpy_errors - def test_nan_log_encoding_Log3G10_v2(self): + def test_nan_log_encoding_Log3G10_v2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v2` definition nan support. @@ -636,7 +636,7 @@ class TestLogDecoding_Log3G10_v2: log_decoding_Log3G10_v2` definition unit tests methods. """ - def test_log_decoding_Log3G10_v2(self): + def test_log_decoding_Log3G10_v2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v2` definition. @@ -660,7 +660,7 @@ def test_log_decoding_Log3G10_v2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_Log3G10_v2(self): + def test_n_dimensional_log_decoding_Log3G10_v2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v2` definition n-dimensional arrays support. @@ -687,7 +687,7 @@ def test_n_dimensional_log_decoding_Log3G10_v2(self): log_decoding_Log3G10_v2(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_Log3G10_v2(self): + def test_domain_range_scale_log_decoding_Log3G10_v2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v2` definition domain and range scale support. @@ -706,7 +706,7 @@ def test_domain_range_scale_log_decoding_Log3G10_v2(self): ) @ignore_numpy_errors - def test_nan_log_decoding_Log3G10_v2(self): + def test_nan_log_decoding_Log3G10_v2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v2` definition nan support. @@ -721,7 +721,7 @@ class TestLogEncoding_Log3G10_v3: log_encoding_Log3G10_v3` definition unit tests methods. """ - def test_log_encoding_Log3G10_v3(self): + def test_log_encoding_Log3G10_v3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v3` definition. @@ -745,7 +745,7 @@ def test_log_encoding_Log3G10_v3(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_Log3G10_v3(self): + def test_n_dimensional_log_encoding_Log3G10_v3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v3` definition n-dimensional arrays support. @@ -772,7 +772,7 @@ def test_n_dimensional_log_encoding_Log3G10_v3(self): log_encoding_Log3G10_v3(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_Log3G10_v3(self): + def test_domain_range_scale_log_encoding_Log3G10_v3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v3` definition domain and range scale support. @@ -791,7 +791,7 @@ def test_domain_range_scale_log_encoding_Log3G10_v3(self): ) @ignore_numpy_errors - def test_nan_log_encoding_Log3G10_v3(self): + def test_nan_log_encoding_Log3G10_v3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G10_v3` definition nan support. @@ -806,7 +806,7 @@ class TestLogDecoding_Log3G10_v3: log_decoding_Log3G10_v3` definition unit tests methods. """ - def test_log_decoding_Log3G10_v3(self): + def test_log_decoding_Log3G10_v3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v3` definition. @@ -830,7 +830,7 @@ def test_log_decoding_Log3G10_v3(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_Log3G10_v3(self): + def test_n_dimensional_log_decoding_Log3G10_v3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v3` definition n-dimensional arrays support. @@ -857,7 +857,7 @@ def test_n_dimensional_log_decoding_Log3G10_v3(self): log_decoding_Log3G10_v3(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_Log3G10_v3(self): + def test_domain_range_scale_log_decoding_Log3G10_v3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v3` definition domain and range scale support. @@ -876,7 +876,7 @@ def test_domain_range_scale_log_decoding_Log3G10_v3(self): ) @ignore_numpy_errors - def test_nan_log_decoding_Log3G10_v3(self): + def test_nan_log_decoding_Log3G10_v3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G10_v3` definition nan support. @@ -891,7 +891,7 @@ class TestLogEncoding_Log3G12: log_encoding_Log3G12` definition unit tests methods. """ - def test_log_encoding_Log3G12(self): + def test_log_encoding_Log3G12(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G12` definition. @@ -919,7 +919,7 @@ def test_log_encoding_Log3G12(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_Log3G12(self): + def test_n_dimensional_log_encoding_Log3G12(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G12` definition n-dimensional arrays support. @@ -946,7 +946,7 @@ def test_n_dimensional_log_encoding_Log3G12(self): log_encoding_Log3G12(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_Log3G12(self): + def test_domain_range_scale_log_encoding_Log3G12(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G12` definition domain and range scale support. @@ -965,7 +965,7 @@ def test_domain_range_scale_log_encoding_Log3G12(self): ) @ignore_numpy_errors - def test_nan_log_encoding_Log3G12(self): + def test_nan_log_encoding_Log3G12(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_encoding_Log3G12` definition nan support. @@ -980,7 +980,7 @@ class TestLogDecoding_Log3G12: log_decoding_Log3G12` definition unit tests methods. """ - def test_log_decoding_Log3G12(self): + def test_log_decoding_Log3G12(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G12` definition. @@ -1008,7 +1008,7 @@ def test_log_decoding_Log3G12(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_Log3G12(self): + def test_n_dimensional_log_decoding_Log3G12(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G12` definition n-dimensional arrays support. @@ -1035,7 +1035,7 @@ def test_n_dimensional_log_decoding_Log3G12(self): log_decoding_Log3G12(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_Log3G12(self): + def test_domain_range_scale_log_decoding_Log3G12(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G12` definition domain and range scale support. @@ -1054,7 +1054,7 @@ def test_domain_range_scale_log_decoding_Log3G12(self): ) @ignore_numpy_errors - def test_nan_log_decoding_Log3G12(self): + def test_nan_log_decoding_Log3G12(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.red.\ log_decoding_Log3G12` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_rimm_romm_rgb.py b/colour/models/rgb/transfer_functions/tests/test_rimm_romm_rgb.py index 727fcc736..dc5ce6f8b 100644 --- a/colour/models/rgb/transfer_functions/tests/test_rimm_romm_rgb.py +++ b/colour/models/rgb/transfer_functions/tests/test_rimm_romm_rgb.py @@ -39,7 +39,7 @@ class TestCctfEncoding_ROMMRGB: cctf_encoding_ROMMRGB` definition unit tests methods. """ - def test_cctf_encoding_ROMMRGB(self): + def test_cctf_encoding_ROMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_encoding_ROMMRGB` definition. @@ -63,7 +63,7 @@ def test_cctf_encoding_ROMMRGB(self): assert cctf_encoding_ROMMRGB(0.18, bit_depth=12, out_int=True) == 1579 - def test_n_dimensional_cctf_encoding_ROMMRGB(self): + def test_n_dimensional_cctf_encoding_ROMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_encoding_ROMMRGB` definition n-dimensional arrays support. @@ -90,7 +90,7 @@ def test_n_dimensional_cctf_encoding_ROMMRGB(self): cctf_encoding_ROMMRGB(X), X_ROMM, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_cctf_encoding_ROMMRGB(self): + def test_domain_range_scale_cctf_encoding_ROMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_encoding_ROMMRGB` definition domain and range scale support. @@ -109,7 +109,7 @@ def test_domain_range_scale_cctf_encoding_ROMMRGB(self): ) @ignore_numpy_errors - def test_nan_cctf_encoding_ROMMRGB(self): + def test_nan_cctf_encoding_ROMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_encoding_ROMMRGB` definition nan support. @@ -124,7 +124,7 @@ class TestCctfDecoding_ROMMRGB: cctf_decoding_ROMMRGB` definition unit tests methods. """ - def test_cctf_decoding_ROMMRGB(self): + def test_cctf_decoding_ROMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_decoding_ROMMRGB` definition. @@ -156,7 +156,7 @@ def test_cctf_decoding_ROMMRGB(self): atol=0.001, ) - def test_n_dimensional_cctf_decoding_ROMMRGB(self): + def test_n_dimensional_cctf_decoding_ROMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_decoding_ROMMRGB` definition n-dimensional arrays support. @@ -183,7 +183,7 @@ def test_n_dimensional_cctf_decoding_ROMMRGB(self): cctf_decoding_ROMMRGB(X_p), X, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_cctf_decoding_ROMMRGB(self): + def test_domain_range_scale_cctf_decoding_ROMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_decoding_ROMMRGB` definition domain and range scale support. @@ -202,7 +202,7 @@ def test_domain_range_scale_cctf_decoding_ROMMRGB(self): ) @ignore_numpy_errors - def test_nan_cctf_decoding_ROMMRGB(self): + def test_nan_cctf_decoding_ROMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_decoding_ROMMRGB` definition nan support. @@ -217,7 +217,7 @@ class TestCctfEncoding_RIMMRGB: cctf_encoding_RIMMRGB` definition unit tests methods. """ - def test_cctf_encoding_RIMMRGB(self): + def test_cctf_encoding_RIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_encoding_RIMMRGB` definition. @@ -243,7 +243,7 @@ def test_cctf_encoding_RIMMRGB(self): assert cctf_encoding_RIMMRGB(0.18, bit_depth=12, out_int=True) == 1194 - def test_n_dimensional_cctf_encoding_RIMMRGB(self): + def test_n_dimensional_cctf_encoding_RIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_encoding_RIMMRGB` definition n-dimensional arrays support. @@ -270,7 +270,7 @@ def test_n_dimensional_cctf_encoding_RIMMRGB(self): cctf_encoding_RIMMRGB(X), X_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_cctf_encoding_RIMMRGB(self): + def test_domain_range_scale_cctf_encoding_RIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_encoding_RIMMRGB` definition domain and range scale support. @@ -289,7 +289,7 @@ def test_domain_range_scale_cctf_encoding_RIMMRGB(self): ) @ignore_numpy_errors - def test_nan_cctf_encoding_RIMMRGB(self): + def test_nan_cctf_encoding_RIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_encoding_RIMMRGB` definition nan support. @@ -304,7 +304,7 @@ class TestCctfDecoding_RIMMRGB: cctf_decoding_RIMMRGB` definition unit tests methods. """ - def test_cctf_decoding_RIMMRGB(self): + def test_cctf_decoding_RIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_decoding_RIMMRGB` definition. @@ -338,7 +338,7 @@ def test_cctf_decoding_RIMMRGB(self): atol=0.005, ) - def test_n_dimensional_cctf_decoding_RIMMRGB(self): + def test_n_dimensional_cctf_decoding_RIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_decoding_RIMMRGB` definition n-dimensional arrays support. @@ -365,7 +365,7 @@ def test_n_dimensional_cctf_decoding_RIMMRGB(self): cctf_decoding_RIMMRGB(X_p), X, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_cctf_decoding_RIMMRGB(self): + def test_domain_range_scale_cctf_decoding_RIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_decoding_RIMMRGB` definition domain and range scale support. @@ -384,7 +384,7 @@ def test_domain_range_scale_cctf_decoding_RIMMRGB(self): ) @ignore_numpy_errors - def test_nan_cctf_decoding_RIMMRGB(self): + def test_nan_cctf_decoding_RIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ cctf_decoding_RIMMRGB` definition nan support. @@ -399,7 +399,7 @@ class TestLog_encoding_ERIMMRGB: log_encoding_ERIMMRGB` definition unit tests methods. """ - def test_log_encoding_ERIMMRGB(self): + def test_log_encoding_ERIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ log_encoding_ERIMMRGB` definition. @@ -425,7 +425,7 @@ def test_log_encoding_ERIMMRGB(self): assert log_encoding_ERIMMRGB(0.18, bit_depth=12, out_int=True) == 1679 - def test_n_dimensional_log_encoding_ERIMMRGB(self): + def test_n_dimensional_log_encoding_ERIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ log_encoding_ERIMMRGB` definition n-dimensional arrays support. @@ -452,7 +452,7 @@ def test_n_dimensional_log_encoding_ERIMMRGB(self): log_encoding_ERIMMRGB(X), X_p, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_ERIMMRGB(self): + def test_domain_range_scale_log_encoding_ERIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ log_encoding_ERIMMRGB` definition domain and range scale support. @@ -471,7 +471,7 @@ def test_domain_range_scale_log_encoding_ERIMMRGB(self): ) @ignore_numpy_errors - def test_nan_log_encoding_ERIMMRGB(self): + def test_nan_log_encoding_ERIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ log_encoding_ERIMMRGB` definition nan support. @@ -486,7 +486,7 @@ class TestLog_decoding_ERIMMRGB: log_decoding_ERIMMRGB` definition unit tests methods. """ - def test_log_decoding_ERIMMRGB(self): + def test_log_decoding_ERIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ log_decoding_ERIMMRGB` definition. @@ -520,7 +520,7 @@ def test_log_decoding_ERIMMRGB(self): atol=0.005, ) - def test_n_dimensional_log_decoding_ERIMMRGB(self): + def test_n_dimensional_log_decoding_ERIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ log_decoding_ERIMMRGB` definition n-dimensional arrays support. @@ -547,7 +547,7 @@ def test_n_dimensional_log_decoding_ERIMMRGB(self): log_decoding_ERIMMRGB(X_p), X, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_ERIMMRGB(self): + def test_domain_range_scale_log_decoding_ERIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ log_decoding_ERIMMRGB` definition domain and range scale support. @@ -566,7 +566,7 @@ def test_domain_range_scale_log_decoding_ERIMMRGB(self): ) @ignore_numpy_errors - def test_nan_log_decoding_ERIMMRGB(self): + def test_nan_log_decoding_ERIMMRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.rimm_romm_rgb.\ log_decoding_ERIMMRGB` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_smpte_240m.py b/colour/models/rgb/transfer_functions/tests/test_smpte_240m.py index e60b9b16b..0d49b5fe4 100644 --- a/colour/models/rgb/transfer_functions/tests/test_smpte_240m.py +++ b/colour/models/rgb/transfer_functions/tests/test_smpte_240m.py @@ -28,7 +28,7 @@ class TestOetf_SMPTE240M: oetf_SMPTE240M` definition unit tests methods. """ - def test_oetf_SMPTE240M(self): + def test_oetf_SMPTE240M(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.smpte_240m.\ oetf_SMPTE240M` definition. @@ -54,7 +54,7 @@ def test_oetf_SMPTE240M(self): oetf_SMPTE240M(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_oetf_SMPTE240M(self): + def test_n_dimensional_oetf_SMPTE240M(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.smpte_240m.\ oetf_SMPTE240M` definition n-dimensional arrays support. @@ -81,7 +81,7 @@ def test_n_dimensional_oetf_SMPTE240M(self): oetf_SMPTE240M(L_c), V_c, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_oetf_SMPTE240M(self): + def test_domain_range_scale_oetf_SMPTE240M(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.smpte_240m.\ oetf_SMPTE240M` definition domain and range scale support. @@ -100,7 +100,7 @@ def test_domain_range_scale_oetf_SMPTE240M(self): ) @ignore_numpy_errors - def test_nan_oetf_SMPTE240M(self): + def test_nan_oetf_SMPTE240M(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.smpte_240m.\ oetf_SMPTE240M` definition nan support. @@ -115,7 +115,7 @@ class TestEotf_SMPTE240M: eotf_SMPTE240M` definition unit tests methods. """ - def test_eotf_SMPTE240M(self): + def test_eotf_SMPTE240M(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.smpte_240m.\ eotf_SMPTE240M` definition. @@ -141,7 +141,7 @@ def test_eotf_SMPTE240M(self): eotf_SMPTE240M(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_eotf_SMPTE240M(self): + def test_n_dimensional_eotf_SMPTE240M(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.smpte_240m.\ eotf_SMPTE240M` definition n-dimensional arrays support. @@ -168,7 +168,7 @@ def test_n_dimensional_eotf_SMPTE240M(self): eotf_SMPTE240M(V_r), L_r, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_SMPTE240M(self): + def test_domain_range_scale_eotf_SMPTE240M(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.smpte_240m.\ eotf_SMPTE240M` definition domain and range scale support. @@ -187,7 +187,7 @@ def test_domain_range_scale_eotf_SMPTE240M(self): ) @ignore_numpy_errors - def test_nan_eotf_SMPTE240M(self): + def test_nan_eotf_SMPTE240M(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.smpte_240m.\ eotf_SMPTE240M` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_sony.py b/colour/models/rgb/transfer_functions/tests/test_sony.py index c4283a9d3..f82e69ce9 100644 --- a/colour/models/rgb/transfer_functions/tests/test_sony.py +++ b/colour/models/rgb/transfer_functions/tests/test_sony.py @@ -39,7 +39,7 @@ class TestLogEncoding_SLog: log_encoding_SLog` definition unit tests methods. """ - def test_log_encoding_SLog(self): + def test_log_encoding_SLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog` definition. @@ -81,7 +81,7 @@ def test_log_encoding_SLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_SLog(self): + def test_n_dimensional_log_encoding_SLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog` definition n-dimensional arrays support. @@ -108,7 +108,7 @@ def test_n_dimensional_log_encoding_SLog(self): log_encoding_SLog(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_SLog(self): + def test_domain_range_scale_log_encoding_SLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog` definition domain and range scale support. @@ -127,7 +127,7 @@ def test_domain_range_scale_log_encoding_SLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_SLog(self): + def test_nan_log_encoding_SLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog` definition nan support. @@ -142,7 +142,7 @@ class TestLogDecoding_SLog: log_decoding_SLog` definition unit tests methods. """ - def test_log_decoding_SLog(self): + def test_log_decoding_SLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog` definition. @@ -184,7 +184,7 @@ def test_log_decoding_SLog(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_SLog(self): + def test_n_dimensional_log_decoding_SLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog` definition n-dimensional arrays support. @@ -211,7 +211,7 @@ def test_n_dimensional_log_decoding_SLog(self): log_decoding_SLog(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_SLog(self): + def test_domain_range_scale_log_decoding_SLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog` definition domain and range scale support. @@ -230,7 +230,7 @@ def test_domain_range_scale_log_decoding_SLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_SLog(self): + def test_nan_log_decoding_SLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog` definition nan support. @@ -245,7 +245,7 @@ class TestLogEncoding_SLog2: log_encoding_SLog2` definition unit tests methods. """ - def test_log_encoding_SLog2(self): + def test_log_encoding_SLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog2` definition. @@ -287,7 +287,7 @@ def test_log_encoding_SLog2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_SLog2(self): + def test_n_dimensional_log_encoding_SLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog2` definition n-dimensional arrays support. @@ -314,7 +314,7 @@ def test_n_dimensional_log_encoding_SLog2(self): log_encoding_SLog2(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_SLog2(self): + def test_domain_range_scale_log_encoding_SLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog2` definition domain and range scale support. @@ -333,7 +333,7 @@ def test_domain_range_scale_log_encoding_SLog2(self): ) @ignore_numpy_errors - def test_nan_log_encoding_SLog2(self): + def test_nan_log_encoding_SLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog2` definition nan support. @@ -348,7 +348,7 @@ class TestLogDecoding_SLog2: log_decoding_SLog2` definition unit tests methods. """ - def test_log_decoding_SLog2(self): + def test_log_decoding_SLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog2` definition. @@ -390,7 +390,7 @@ def test_log_decoding_SLog2(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_SLog2(self): + def test_n_dimensional_log_decoding_SLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog2` definition n-dimensional arrays support. @@ -417,7 +417,7 @@ def test_n_dimensional_log_decoding_SLog2(self): log_decoding_SLog2(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_SLog2(self): + def test_domain_range_scale_log_decoding_SLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog2` definition domain and range scale support. @@ -436,7 +436,7 @@ def test_domain_range_scale_log_decoding_SLog2(self): ) @ignore_numpy_errors - def test_nan_log_decoding_SLog2(self): + def test_nan_log_decoding_SLog2(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog2` definition nan support. @@ -451,7 +451,7 @@ class TestLogEncoding_SLog3: log_encoding_SLog3` definition unit tests methods. """ - def test_log_encoding_SLog3(self): + def test_log_encoding_SLog3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog3` definition. @@ -493,7 +493,7 @@ def test_log_encoding_SLog3(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_encoding_SLog3(self): + def test_n_dimensional_log_encoding_SLog3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog3` definition n-dimensional arrays support. @@ -520,7 +520,7 @@ def test_n_dimensional_log_encoding_SLog3(self): log_encoding_SLog3(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_SLog3(self): + def test_domain_range_scale_log_encoding_SLog3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog3` definition domain and range scale support. @@ -539,7 +539,7 @@ def test_domain_range_scale_log_encoding_SLog3(self): ) @ignore_numpy_errors - def test_nan_log_encoding_SLog3(self): + def test_nan_log_encoding_SLog3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_encoding_SLog3` definition nan support. @@ -554,7 +554,7 @@ class TestLogDecoding_SLog3: log_decoding_SLog3` definition unit tests methods. """ - def test_log_decoding_SLog3(self): + def test_log_decoding_SLog3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog3` definition. @@ -596,7 +596,7 @@ def test_log_decoding_SLog3(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_log_decoding_SLog3(self): + def test_n_dimensional_log_decoding_SLog3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog3` definition n-dimensional arrays support. @@ -623,7 +623,7 @@ def test_n_dimensional_log_decoding_SLog3(self): log_decoding_SLog3(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_SLog3(self): + def test_domain_range_scale_log_decoding_SLog3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog3` definition domain and range scale support. @@ -642,7 +642,7 @@ def test_domain_range_scale_log_decoding_SLog3(self): ) @ignore_numpy_errors - def test_nan_log_decoding_SLog3(self): + def test_nan_log_decoding_SLog3(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sony.\ log_decoding_SLog3` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_srgb.py b/colour/models/rgb/transfer_functions/tests/test_srgb.py index 9808d4827..99a38393d 100644 --- a/colour/models/rgb/transfer_functions/tests/test_srgb.py +++ b/colour/models/rgb/transfer_functions/tests/test_srgb.py @@ -28,7 +28,7 @@ class TestEotf_inverse_sRGB: definition unit tests methods. """ - def test_eotf_inverse_sRGB(self): + def test_eotf_inverse_sRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sRGB.\ eotf_inverse_sRGB` definition. @@ -48,7 +48,7 @@ def test_eotf_inverse_sRGB(self): eotf_inverse_sRGB(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_eotf_inverse_sRGB(self): + def test_n_dimensional_eotf_inverse_sRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sRGB.\ eotf_inverse_sRGB` definition n-dimensional arrays support. @@ -75,7 +75,7 @@ def test_n_dimensional_eotf_inverse_sRGB(self): eotf_inverse_sRGB(L), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_sRGB(self): + def test_domain_range_scale_eotf_inverse_sRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sRGB.\ eotf_inverse_sRGB` definition domain and range scale support. @@ -94,7 +94,7 @@ def test_domain_range_scale_eotf_inverse_sRGB(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_sRGB(self): + def test_nan_eotf_inverse_sRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sRGB.\ eotf_inverse_sRGB` definition nan support. @@ -109,7 +109,7 @@ class TestEotf_sRGB: definition unit tests methods. """ - def test_eotf_sRGB(self): + def test_eotf_sRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sRGB.\ eotf_sRGB` definition. @@ -123,7 +123,7 @@ def test_eotf_sRGB(self): np.testing.assert_allclose(eotf_sRGB(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_n_dimensional_eotf_sRGB(self): + def test_n_dimensional_eotf_sRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sRGB.\ eotf_sRGB` definition n-dimensional arrays support. @@ -144,7 +144,7 @@ def test_n_dimensional_eotf_sRGB(self): L = np.reshape(L, (2, 3, 1)) np.testing.assert_allclose(eotf_sRGB(V), L, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_eotf_sRGB(self): + def test_domain_range_scale_eotf_sRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sRGB.\ eotf_sRGB` definition domain and range scale support. @@ -163,7 +163,7 @@ def test_domain_range_scale_eotf_sRGB(self): ) @ignore_numpy_errors - def test_nan_eotf_sRGB(self): + def test_nan_eotf_sRGB(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.sRGB.\ eotf_sRGB` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_st_2084.py b/colour/models/rgb/transfer_functions/tests/test_st_2084.py index d12b1cf81..4c052cb65 100644 --- a/colour/models/rgb/transfer_functions/tests/test_st_2084.py +++ b/colour/models/rgb/transfer_functions/tests/test_st_2084.py @@ -31,7 +31,7 @@ class TestEotf_inverse_ST2084: eotf_inverse_ST2084` definition unit tests methods. """ - def test_eotf_inverse_ST2084(self): + def test_eotf_inverse_ST2084(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.st_2084.\ eotf_inverse_ST2084` definition. @@ -59,7 +59,7 @@ def test_eotf_inverse_ST2084(self): eotf_inverse_ST2084(5000, 5000), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_eotf_inverse_ST2084(self): + def test_n_dimensional_eotf_inverse_ST2084(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.st_2084.\ eotf_inverse_ST2084` definition n-dimensional arrays support. @@ -86,7 +86,7 @@ def test_n_dimensional_eotf_inverse_ST2084(self): eotf_inverse_ST2084(C), N, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_eotf_inverse_ST2084(self): + def test_domain_range_scale_eotf_inverse_ST2084(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.st_2084.\ eotf_inverse_ST2084` definition domain and range scale support. @@ -105,7 +105,7 @@ def test_domain_range_scale_eotf_inverse_ST2084(self): ) @ignore_numpy_errors - def test_nan_eotf_inverse_ST2084(self): + def test_nan_eotf_inverse_ST2084(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.st_2084.\ eotf_inverse_ST2084` definition nan support. @@ -120,7 +120,7 @@ class TestEotf_ST2084: definition unit tests methods. """ - def test_eotf_ST2084(self): + def test_eotf_ST2084(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.st_2084.\ eotf_ST2084` definition. @@ -140,7 +140,7 @@ def test_eotf_ST2084(self): eotf_ST2084(1.0, 5000), 5000.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_eotf_ST2084(self): + def test_n_dimensional_eotf_ST2084(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.st_2084.\ eotf_ST2084` definition n-dimensional arrays support. @@ -161,7 +161,7 @@ def test_n_dimensional_eotf_ST2084(self): C = np.reshape(C, (2, 3, 1)) np.testing.assert_allclose(eotf_ST2084(N), C, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_eotf_ST2084(self): + def test_domain_range_scale_eotf_ST2084(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.st_2084.\ eotf_ST2084` definition domain and range scale support. @@ -180,7 +180,7 @@ def test_domain_range_scale_eotf_ST2084(self): ) @ignore_numpy_errors - def test_nan_eotf_ST2084(self): + def test_nan_eotf_ST2084(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.st_2084.\ eotf_ST2084` definition nan support. diff --git a/colour/models/rgb/transfer_functions/tests/test_viper_log.py b/colour/models/rgb/transfer_functions/tests/test_viper_log.py index 3f235ff00..394a55d53 100644 --- a/colour/models/rgb/transfer_functions/tests/test_viper_log.py +++ b/colour/models/rgb/transfer_functions/tests/test_viper_log.py @@ -31,7 +31,7 @@ class TestLogEncoding_ViperLog: log_encoding_ViperLog` definition unit tests methods. """ - def test_log_encoding_ViperLog(self): + def test_log_encoding_ViperLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.viper_log.\ log_encoding_ViperLog` definition. @@ -51,7 +51,7 @@ def test_log_encoding_ViperLog(self): log_encoding_ViperLog(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_log_encoding_ViperLog(self): + def test_n_dimensional_log_encoding_ViperLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.viper_log.\ log_encoding_ViperLog` definition n-dimensional arrays support. @@ -78,7 +78,7 @@ def test_n_dimensional_log_encoding_ViperLog(self): log_encoding_ViperLog(x), y, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_encoding_ViperLog(self): + def test_domain_range_scale_log_encoding_ViperLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.viper_log.\ log_encoding_ViperLog` definition domain and range scale support. @@ -97,7 +97,7 @@ def test_domain_range_scale_log_encoding_ViperLog(self): ) @ignore_numpy_errors - def test_nan_log_encoding_ViperLog(self): + def test_nan_log_encoding_ViperLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.viper_log.\ log_encoding_ViperLog` definition nan support. @@ -112,7 +112,7 @@ class TestLogDecoding_ViperLog: log_decoding_ViperLog` definition unit tests methods. """ - def test_log_decoding_ViperLog(self): + def test_log_decoding_ViperLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.viper_log.\ log_decoding_ViperLog` definition. @@ -132,7 +132,7 @@ def test_log_decoding_ViperLog(self): log_decoding_ViperLog(1.0), 1.0, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_n_dimensional_log_decoding_ViperLog(self): + def test_n_dimensional_log_decoding_ViperLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.viper_log.\ log_decoding_ViperLog` definition n-dimensional arrays support. @@ -159,7 +159,7 @@ def test_n_dimensional_log_decoding_ViperLog(self): log_decoding_ViperLog(y), x, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_log_decoding_ViperLog(self): + def test_domain_range_scale_log_decoding_ViperLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.viper_log.\ log_decoding_ViperLog` definition domain and range scale support. @@ -178,7 +178,7 @@ def test_domain_range_scale_log_decoding_ViperLog(self): ) @ignore_numpy_errors - def test_nan_log_decoding_ViperLog(self): + def test_nan_log_decoding_ViperLog(self) -> None: """ Test :func:`colour.models.rgb.transfer_functions.viper_log.\ log_decoding_ViperLog` definition nan support. diff --git a/colour/models/tests/test_cam02_ucs.py b/colour/models/tests/test_cam02_ucs.py index a34c09eaa..764d54424 100644 --- a/colour/models/tests/test_cam02_ucs.py +++ b/colour/models/tests/test_cam02_ucs.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.cam02_ucs` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -54,7 +56,7 @@ class TestJMh_CIECAM02_to_UCS_Luo2006: definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" XYZ = np.array([19.01, 20.00, 21.78]) @@ -66,7 +68,7 @@ def setup_method(self): self._JMh = np.array([specification.J, specification.M, specification.h]) - def test_JMh_CIECAM02_to_UCS_Luo2006(self): + def test_JMh_CIECAM02_to_UCS_Luo2006(self) -> None: """ Test :func:`colour.models.cam02_ucs.JMh_CIECAM02_to_UCS_Luo2006` definition. @@ -120,7 +122,7 @@ def test_JMh_CIECAM02_to_UCS_Luo2006(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_JMh_CIECAM02_to_UCS_Luo2006(self): + def test_n_dimensional_JMh_CIECAM02_to_UCS_Luo2006(self) -> None: """ Test :func:`colour.models.cam02_ucs.JMh_CIECAM02_to_UCS_Luo2006` definition n-dimensional support. @@ -145,7 +147,7 @@ def test_n_dimensional_JMh_CIECAM02_to_UCS_Luo2006(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_JMh_CIECAM02_to_UCS_Luo2006(self): + def test_domain_range_scale_JMh_CIECAM02_to_UCS_Luo2006(self) -> None: """ Test :func:`colour.models.cam02_ucs.JMh_CIECAM02_to_UCS_Luo2006` definition domain and range scale support. @@ -170,7 +172,7 @@ def test_domain_range_scale_JMh_CIECAM02_to_UCS_Luo2006(self): ) @ignore_numpy_errors - def test_nan_JMh_CIECAM02_to_UCS_Luo2006(self): + def test_nan_JMh_CIECAM02_to_UCS_Luo2006(self) -> None: """ Test :func:`colour.models.cam02_ucs.JMh_CIECAM02_to_UCS_Luo2006` definition nan support. @@ -187,7 +189,7 @@ class TestUCS_Luo2006_to_JMh_CIECAM02: definition unit tests methods. """ - def test_UCS_Luo2006_to_JMh_CIECAM02(self): + def test_UCS_Luo2006_to_JMh_CIECAM02(self) -> None: """ Test :func:`colour.models.cam02_ucs.UCS_Luo2006_to_JMh_CIECAM02` definition. @@ -247,7 +249,7 @@ def test_UCS_Luo2006_to_JMh_CIECAM02(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_UCS_Luo2006_to_JMh_CIECAM02(self): + def test_n_dimensional_UCS_Luo2006_to_JMh_CIECAM02(self) -> None: """ Test :func:`colour.models.cam02_ucs.UCS_Luo2006_to_JMh_CIECAM02` definition n-dimensional support. @@ -272,7 +274,7 @@ def test_n_dimensional_UCS_Luo2006_to_JMh_CIECAM02(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_UCS_Luo2006_to_JMh_CIECAM02(self): + def test_domain_range_scale_UCS_Luo2006_to_JMh_CIECAM02(self) -> None: """ Test :func:`colour.models.cam02_ucs.UCS_Luo2006_to_JMh_CIECAM02` definition domain and range scale support. @@ -298,7 +300,7 @@ def test_domain_range_scale_UCS_Luo2006_to_JMh_CIECAM02(self): ) @ignore_numpy_errors - def test_nan_UCS_Luo2006_to_JMh_CIECAM02(self): + def test_nan_UCS_Luo2006_to_JMh_CIECAM02(self) -> None: """ Test :func:`colour.models.cam02_ucs.UCS_Luo2006_to_JMh_CIECAM02` definition nan support. @@ -315,7 +317,7 @@ class TestXYZ_to_UCS_Luo2006: unit tests methods. """ - def test_XYZ_to_UCS_Luo2006(self): + def test_XYZ_to_UCS_Luo2006(self) -> None: """Test :func:`colour.models.cam02_ucs.XYZ_to_UCS_Luo2006` definition.""" np.testing.assert_allclose( @@ -372,7 +374,7 @@ def test_XYZ_to_UCS_Luo2006(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_UCS_Luo2006(self): + def test_n_dimensional_XYZ_to_UCS_Luo2006(self) -> None: """ Test :func:`colour.models.cam02_ucs.XYZ_to_UCS_Luo2006` definition n-dimensional support. @@ -397,7 +399,7 @@ def test_n_dimensional_XYZ_to_UCS_Luo2006(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_UCS_Luo2006(self): + def test_domain_range_scale_XYZ_to_UCS_Luo2006(self) -> None: """ Test :func:`colour.models.cam02_ucs.XYZ_to_UCS_Luo2006` definition domain and range scale support. @@ -421,7 +423,7 @@ def test_domain_range_scale_XYZ_to_UCS_Luo2006(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_UCS_Luo2006(self): + def test_nan_XYZ_to_UCS_Luo2006(self) -> None: """ Test :func:`colour.models.cam02_ucs.XYZ_to_UCS_Luo2006` definition nan support. @@ -438,7 +440,7 @@ class TestUCS_Luo2006_to_XYZ: unit tests methods. """ - def test_UCS_Luo2006_to_XYZ(self): + def test_UCS_Luo2006_to_XYZ(self) -> None: """Test :func:`colour.models.cam02_ucs.UCS_Luo2006_to_XYZ` definition.""" np.testing.assert_allclose( @@ -495,7 +497,7 @@ def test_UCS_Luo2006_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_UCS_Luo2006_to_XYZ(self): + def test_n_dimensional_UCS_Luo2006_to_XYZ(self) -> None: """ Test :func:`colour.models.cam02_ucs.UCS_Luo2006_to_XYZ` definition n-dimensional support. @@ -520,7 +522,7 @@ def test_n_dimensional_UCS_Luo2006_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_UCS_Luo2006_to_XYZ(self): + def test_domain_range_scale_UCS_Luo2006_to_XYZ(self) -> None: """ Test :func:`colour.models.cam02_ucs.UCS_Luo2006_to_XYZ` definition domain and range scale support. @@ -544,7 +546,7 @@ def test_domain_range_scale_UCS_Luo2006_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_UCS_Luo2006_to_XYZ(self): + def test_nan_UCS_Luo2006_to_XYZ(self) -> None: """ Test :func:`colour.models.cam02_ucs.UCS_Luo2006_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_cam16_ucs.py b/colour/models/tests/test_cam16_ucs.py index 9c776ae2a..b58d16b87 100644 --- a/colour/models/tests/test_cam16_ucs.py +++ b/colour/models/tests/test_cam16_ucs.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.cam16_ucs` module.""" +from __future__ import annotations + from colour.models.tests.test_cam02_ucs import ( TestJMh_CIECAM02_to_UCS_Luo2006, TestUCS_Luo2006_to_JMh_CIECAM02, diff --git a/colour/models/tests/test_cie_lab.py b/colour/models/tests/test_cie_lab.py index 82c5c02bc..2a3e056a7 100644 --- a/colour/models/tests/test_cie_lab.py +++ b/colour/models/tests/test_cie_lab.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.cie_lab` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXYZ_to_Lab: methods. """ - def test_XYZ_to_Lab(self): + def test_XYZ_to_Lab(self) -> None: """Test :func:`colour.models.cie_lab.XYZ_to_Lab` definition.""" np.testing.assert_allclose( @@ -75,7 +77,7 @@ def test_XYZ_to_Lab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Lab(self): + def test_n_dimensional_XYZ_to_Lab(self) -> None: """ Test :func:`colour.models.cie_lab.XYZ_to_Lab` definition n-dimensional support. @@ -103,7 +105,7 @@ def test_n_dimensional_XYZ_to_Lab(self): XYZ_to_Lab(XYZ, illuminant), Lab, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_Lab(self): + def test_domain_range_scale_XYZ_to_Lab(self) -> None: """ Test :func:`colour.models.cie_lab.XYZ_to_Lab` definition domain and range scale support. @@ -123,7 +125,7 @@ def test_domain_range_scale_XYZ_to_Lab(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Lab(self): + def test_nan_XYZ_to_Lab(self) -> None: """Test :func:`colour.models.cie_lab.XYZ_to_Lab` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -137,7 +139,7 @@ class TestLab_to_XYZ: methods. """ - def test_Lab_to_XYZ(self): + def test_Lab_to_XYZ(self) -> None: """Test :func:`colour.models.cie_lab.Lab_to_XYZ` definition.""" np.testing.assert_allclose( @@ -185,7 +187,7 @@ def test_Lab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Lab_to_XYZ(self): + def test_n_dimensional_Lab_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_lab.Lab_to_XYZ` definition n-dimensional support. @@ -213,7 +215,7 @@ def test_n_dimensional_Lab_to_XYZ(self): Lab_to_XYZ(Lab, illuminant), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Lab_to_XYZ(self): + def test_domain_range_scale_Lab_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_lab.Lab_to_XYZ` definition domain and range scale support. @@ -233,7 +235,7 @@ def test_domain_range_scale_Lab_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Lab_to_XYZ(self): + def test_nan_Lab_to_XYZ(self) -> None: """Test :func:`colour.models.cie_lab.Lab_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/models/tests/test_cie_luv.py b/colour/models/tests/test_cie_luv.py index 47acc2dcc..7d6c6ada5 100644 --- a/colour/models/tests/test_cie_luv.py +++ b/colour/models/tests/test_cie_luv.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.cie_luv` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -42,7 +44,7 @@ class TestXYZ_to_Luv: methods. """ - def test_XYZ_to_Luv(self): + def test_XYZ_to_Luv(self) -> None: """Test :func:`colour.models.cie_luv.XYZ_to_Luv` definition.""" np.testing.assert_allclose( @@ -90,7 +92,7 @@ def test_XYZ_to_Luv(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Luv(self): + def test_n_dimensional_XYZ_to_Luv(self) -> None: """ Test :func:`colour.models.cie_luv.XYZ_to_Luv` definition n-dimensional support. @@ -118,7 +120,7 @@ def test_n_dimensional_XYZ_to_Luv(self): XYZ_to_Luv(XYZ, illuminant), Luv, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_Luv(self): + def test_domain_range_scale_XYZ_to_Luv(self) -> None: """ Test :func:`colour.models.cie_luv.XYZ_to_Luv` definition domain and range scale support. @@ -138,7 +140,7 @@ def test_domain_range_scale_XYZ_to_Luv(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Luv(self): + def test_nan_XYZ_to_Luv(self) -> None: """Test :func:`colour.models.cie_luv.XYZ_to_Luv` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -152,7 +154,7 @@ class TestLuv_to_XYZ: methods. """ - def test_Luv_to_XYZ(self): + def test_Luv_to_XYZ(self) -> None: """Test :func:`colour.models.cie_luv.Luv_to_XYZ` definition.""" np.testing.assert_allclose( @@ -200,7 +202,7 @@ def test_Luv_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Luv_to_XYZ(self): + def test_n_dimensional_Luv_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_luv.Luv_to_XYZ` definition n-dimensional support. @@ -228,7 +230,7 @@ def test_n_dimensional_Luv_to_XYZ(self): Luv_to_XYZ(Luv, illuminant), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Luv_to_XYZ(self): + def test_domain_range_scale_Luv_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_luv.Luv_to_XYZ` definition domain and range scale support. @@ -248,7 +250,7 @@ def test_domain_range_scale_Luv_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Luv_to_XYZ(self): + def test_nan_Luv_to_XYZ(self) -> None: """Test :func:`colour.models.cie_luv.Luv_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -262,7 +264,7 @@ class TestLuv_to_uv: methods. """ - def test_Luv_to_uv(self): + def test_Luv_to_uv(self) -> None: """Test :func:`colour.models.cie_luv.Luv_to_uv` definition.""" np.testing.assert_allclose( @@ -310,7 +312,7 @@ def test_Luv_to_uv(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Luv_to_uv(self): + def test_n_dimensional_Luv_to_uv(self) -> None: """ Test :func:`colour.models.cie_luv.Luv_to_uv` definition n-dimensional support. @@ -338,7 +340,7 @@ def test_n_dimensional_Luv_to_uv(self): Luv_to_uv(Luv, illuminant), uv, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Luv_to_uv(self): + def test_domain_range_scale_Luv_to_uv(self) -> None: """ Test :func:`colour.models.cie_luv.Luv_to_uv` definition domain and range scale support. @@ -358,7 +360,7 @@ def test_domain_range_scale_Luv_to_uv(self): ) @ignore_numpy_errors - def test_nan_Luv_to_uv(self): + def test_nan_Luv_to_uv(self) -> None: """Test :func:`colour.models.cie_luv.Luv_to_uv` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -372,7 +374,7 @@ class Testuv_to_Luv: methods. """ - def test_uv_to_Luv(self): + def test_uv_to_Luv(self) -> None: """Test :func:`colour.models.cie_luv.uv_to_Luv` definition.""" np.testing.assert_allclose( @@ -426,7 +428,7 @@ def test_uv_to_Luv(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_uv_to_Luv(self): + def test_n_dimensional_uv_to_Luv(self) -> None: """ Test :func:`colour.models.cie_luv.uv_to_Luv` definition n-dimensional support. @@ -454,7 +456,7 @@ def test_n_dimensional_uv_to_Luv(self): uv_to_Luv(uv, illuminant), Luv, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_uv_to_Luv(self): + def test_domain_range_scale_uv_to_Luv(self) -> None: """ Test :func:`colour.models.cie_luv.uv_to_Luv` definition domain and range scale support. @@ -475,7 +477,7 @@ def test_domain_range_scale_uv_to_Luv(self): ) @ignore_numpy_errors - def test_nan_uv_to_Luv(self): + def test_nan_uv_to_Luv(self) -> None: """Test :func:`colour.models.cie_luv.uv_to_Luv` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -489,7 +491,7 @@ class TestLuv_uv_to_xy: methods. """ - def test_Luv_uv_to_xy(self): + def test_Luv_uv_to_xy(self) -> None: """Test :func:`colour.models.cie_luv.Luv_uv_to_xy` definition.""" np.testing.assert_allclose( @@ -510,7 +512,7 @@ def test_Luv_uv_to_xy(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Luv_uv_to_xy(self): + def test_n_dimensional_Luv_uv_to_xy(self) -> None: """ Test :func:`colour.models.cie_luv.Luv_uv_to_xy` definition n-dimensional arrays support. @@ -528,7 +530,7 @@ def test_n_dimensional_Luv_uv_to_xy(self): np.testing.assert_allclose(Luv_uv_to_xy(uv), xy, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_Luv_uv_to_xy(self): + def test_nan_Luv_uv_to_xy(self) -> None: """ Test :func:`colour.models.cie_luv.Luv_uv_to_xy` definition nan support. @@ -545,7 +547,7 @@ class TestXy_to_Luv_uv: methods. """ - def test_xy_to_Luv_uv(self): + def test_xy_to_Luv_uv(self) -> None: """Test :func:`colour.models.cie_luv.xy_to_Luv_uv` definition.""" np.testing.assert_allclose( @@ -566,7 +568,7 @@ def test_xy_to_Luv_uv(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_Luv_uv(self): + def test_n_dimensional_xy_to_Luv_uv(self) -> None: """ Test :func:`colour.models.cie_luv.xy_to_Luv_uv` definition n-dimensional arrays support. @@ -584,7 +586,7 @@ def test_n_dimensional_xy_to_Luv_uv(self): np.testing.assert_allclose(xy_to_Luv_uv(xy), uv, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_xy_to_Luv_uv(self): + def test_nan_xy_to_Luv_uv(self) -> None: """ Test :func:`colour.models.cie_luv.xy_to_Luv_uv` definition nan support. @@ -601,7 +603,7 @@ class TestXYZ_to_CIE1976UCS: methods. """ - def test_XYZ_to_CIE1976UCS(self): + def test_XYZ_to_CIE1976UCS(self) -> None: """Test :func:`colour.models.cie_luv.XYZ_to_CIE1976UCS` definition.""" np.testing.assert_allclose( @@ -649,7 +651,7 @@ def test_XYZ_to_CIE1976UCS(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_CIE1976UCS(self): + def test_n_dimensional_XYZ_to_CIE1976UCS(self) -> None: """ Test :func:`colour.models.cie_luv.XYZ_to_CIE1976UCS` definition n-dimensional support. @@ -677,7 +679,7 @@ def test_n_dimensional_XYZ_to_CIE1976UCS(self): XYZ_to_CIE1976UCS(XYZ, illuminant), Luv, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_CIE1976UCS(self): + def test_domain_range_scale_XYZ_to_CIE1976UCS(self) -> None: """ Test :func:`colour.models.cie_luv.XYZ_to_CIE1976UCS` definition domain and range scale support. @@ -697,7 +699,7 @@ def test_domain_range_scale_XYZ_to_CIE1976UCS(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_CIE1976UCS(self): + def test_nan_XYZ_to_CIE1976UCS(self) -> None: """ Test :func:`colour.models.cie_luv.XYZ_to_CIE1976UCS` definition nan support. @@ -714,7 +716,7 @@ class TestCIE1976UCS_to_XYZ: methods. """ - def test_CIE1976UCS_to_XYZ(self): + def test_CIE1976UCS_to_XYZ(self) -> None: """Test :func:`colour.models.cie_luv.CIE1976UCS_to_XYZ` definition.""" np.testing.assert_allclose( @@ -762,7 +764,7 @@ def test_CIE1976UCS_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CIE1976UCS_to_XYZ(self): + def test_n_dimensional_CIE1976UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_luv.CIE1976UCS_to_XYZ` definition n-dimensional support. @@ -790,7 +792,7 @@ def test_n_dimensional_CIE1976UCS_to_XYZ(self): CIE1976UCS_to_XYZ(Luv, illuminant), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_CIE1976UCS_to_XYZ(self): + def test_domain_range_scale_CIE1976UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_luv.CIE1976UCS_to_XYZ` definition domain and range scale support. @@ -810,7 +812,7 @@ def test_domain_range_scale_CIE1976UCS_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_CIE1976UCS_to_XYZ(self): + def test_nan_CIE1976UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_luv.CIE1976UCS_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_cie_ucs.py b/colour/models/tests/test_cie_ucs.py index 969a14195..463b55a5f 100644 --- a/colour/models/tests/test_cie_ucs.py +++ b/colour/models/tests/test_cie_ucs.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.cie_ucs` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -42,7 +44,7 @@ class TestXYZ_to_UCS: methods. """ - def test_XYZ_to_UCS(self): + def test_XYZ_to_UCS(self) -> None: """Test :func:`colour.models.cie_ucs.XYZ_to_UCS` definition.""" np.testing.assert_allclose( @@ -63,7 +65,7 @@ def test_XYZ_to_UCS(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_UCS(self): + def test_n_dimensional_XYZ_to_UCS(self) -> None: """ Test :func:`colour.models.cie_ucs.XYZ_to_UCS` definition n-dimensional support. @@ -80,7 +82,7 @@ def test_n_dimensional_XYZ_to_UCS(self): XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_allclose(XYZ_to_UCS(XYZ), UCS, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_XYZ_to_UCS(self): + def test_domain_range_scale_XYZ_to_UCS(self) -> None: """ Test :func:`colour.models.cie_ucs.XYZ_to_UCS` definition domain and range scale support. @@ -99,7 +101,7 @@ def test_domain_range_scale_XYZ_to_UCS(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_UCS(self): + def test_nan_XYZ_to_UCS(self) -> None: """Test :func:`colour.models.cie_ucs.XYZ_to_UCS` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -113,7 +115,7 @@ class TestUCS_to_XYZ: methods. """ - def test_UCS_to_XYZ(self): + def test_UCS_to_XYZ(self) -> None: """Test :func:`colour.models.cie_ucs.UCS_to_XYZ` definition.""" np.testing.assert_allclose( @@ -134,7 +136,7 @@ def test_UCS_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_UCS_to_XYZ(self): + def test_n_dimensional_UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_ucs.UCS_to_XYZ` definition n-dimensional support. @@ -151,7 +153,7 @@ def test_n_dimensional_UCS_to_XYZ(self): XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_allclose(UCS_to_XYZ(UCS), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_UCS_to_XYZ(self): + def test_domain_range_scale_UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_ucs.UCS_to_XYZ` definition domain and range scale support. @@ -170,7 +172,7 @@ def test_domain_range_scale_UCS_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_UCS_to_XYZ(self): + def test_nan_UCS_to_XYZ(self) -> None: """Test :func:`colour.models.cie_ucs.UCS_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -184,7 +186,7 @@ class TestUCS_to_uv: methods. """ - def test_UCS_to_uv(self): + def test_UCS_to_uv(self) -> None: """Test :func:`colour.models.cie_ucs.UCS_to_uv` definition.""" np.testing.assert_allclose( @@ -205,7 +207,7 @@ def test_UCS_to_uv(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_UCS_to_uv(self): + def test_n_dimensional_UCS_to_uv(self) -> None: """ Test :func:`colour.models.cie_ucs.UCS_to_uv` definition n-dimensional support. @@ -222,7 +224,7 @@ def test_n_dimensional_UCS_to_uv(self): uv = np.reshape(uv, (2, 3, 2)) np.testing.assert_allclose(UCS_to_uv(UCS), uv, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_UCS_to_uv(self): + def test_domain_range_scale_UCS_to_uv(self) -> None: """ Test :func:`colour.models.cie_ucs.UCS_to_uv` definition domain and range scale support. @@ -239,7 +241,7 @@ def test_domain_range_scale_UCS_to_uv(self): ) @ignore_numpy_errors - def test_nan_UCS_to_uv(self): + def test_nan_UCS_to_uv(self) -> None: """Test :func:`colour.models.cie_ucs.UCS_to_uv` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -253,7 +255,7 @@ class Testuv_to_UCS: methods. """ - def test_uv_to_UCS(self): + def test_uv_to_UCS(self) -> None: """Test :func:`colour.models.cie_ucs.uv_to_UCS` definition.""" np.testing.assert_allclose( @@ -280,7 +282,7 @@ def test_uv_to_UCS(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_uv_to_UCS(self): + def test_n_dimensional_uv_to_UCS(self) -> None: """ Test :func:`colour.models.cie_ucs.uv_to_UCS` definition n-dimensional support. @@ -297,7 +299,7 @@ def test_n_dimensional_uv_to_UCS(self): UCS = np.reshape(UCS, (2, 3, 3)) np.testing.assert_allclose(uv_to_UCS(uv), UCS, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_uv_to_UCS(self): + def test_domain_range_scale_uv_to_UCS(self) -> None: """ Test :func:`colour.models.cie_ucs.uv_to_UCS` definition domain and range scale support. @@ -317,7 +319,7 @@ def test_domain_range_scale_uv_to_UCS(self): ) @ignore_numpy_errors - def test_nan_uv_to_UCS(self): + def test_nan_uv_to_UCS(self) -> None: """Test :func:`colour.models.cie_ucs.uv_to_UCS` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -331,7 +333,7 @@ class TestUCS_uv_to_xy: methods. """ - def test_UCS_uv_to_xy(self): + def test_UCS_uv_to_xy(self) -> None: """Test :func:`colour.models.cie_ucs.UCS_uv_to_xy` definition.""" np.testing.assert_allclose( @@ -352,7 +354,7 @@ def test_UCS_uv_to_xy(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_UCS_uv_to_xy(self): + def test_n_dimensional_UCS_uv_to_xy(self) -> None: """ Test :func:`colour.models.cie_ucs.UCS_uv_to_xy` definition n-dimensional arrays support. @@ -370,7 +372,7 @@ def test_n_dimensional_UCS_uv_to_xy(self): np.testing.assert_allclose(UCS_uv_to_xy(uv), xy, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_UCS_uv_to_xy(self): + def test_nan_UCS_uv_to_xy(self) -> None: """ Test :func:`colour.models.cie_ucs.UCS_uv_to_xy` definition nan support. @@ -387,7 +389,7 @@ class TestXy_to_UCS_uv: methods. """ - def test_xy_to_UCS_uv(self): + def test_xy_to_UCS_uv(self) -> None: """Test :func:`colour.models.cie_ucs.xy_to_UCS_uv` definition.""" np.testing.assert_allclose( @@ -408,7 +410,7 @@ def test_xy_to_UCS_uv(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_UCS_uv(self): + def test_n_dimensional_xy_to_UCS_uv(self) -> None: """ Test :func:`colour.models.cie_ucs.xy_to_UCS_uv` definition n-dimensional arrays support. @@ -426,7 +428,7 @@ def test_n_dimensional_xy_to_UCS_uv(self): np.testing.assert_allclose(xy_to_UCS_uv(xy), uv, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_xy_to_UCS_uv(self): + def test_nan_xy_to_UCS_uv(self) -> None: """ Test :func:`colour.models.cie_ucs.xy_to_UCS_uv` definition nan support. @@ -443,7 +445,7 @@ class TestXYZ_to_CIE1960UCS: methods. """ - def test_XYZ_to_CIE1960UCS(self): + def test_XYZ_to_CIE1960UCS(self) -> None: """Test :func:`colour.models.cie_ucs.XYZ_to_CIE1960UCS` definition.""" np.testing.assert_allclose( @@ -464,7 +466,7 @@ def test_XYZ_to_CIE1960UCS(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_CIE1960UCS(self): + def test_n_dimensional_XYZ_to_CIE1960UCS(self) -> None: """ Test :func:`colour.models.cie_ucs.XYZ_to_CIE1960UCS` definition n-dimensional support. @@ -485,7 +487,7 @@ def test_n_dimensional_XYZ_to_CIE1960UCS(self): XYZ_to_CIE1960UCS(XYZ), uvV, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_CIE1960UCS(self): + def test_domain_range_scale_XYZ_to_CIE1960UCS(self) -> None: """ Test :func:`colour.models.cie_ucs.XYZ_to_CIE1960UCS` definition domain and range scale support. @@ -504,7 +506,7 @@ def test_domain_range_scale_XYZ_to_CIE1960UCS(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_CIE1960UCS(self): + def test_nan_XYZ_to_CIE1960UCS(self) -> None: """ Test :func:`colour.models.cie_ucs.XYZ_to_CIE1960UCS` definition nan support. @@ -521,7 +523,7 @@ class TestCIE1960UCS_to_XYZ: methods. """ - def test_CIE1960UCS_to_XYZ(self): + def test_CIE1960UCS_to_XYZ(self) -> None: """Test :func:`colour.models.cie_ucs.CIE1960UCS_to_XYZ` definition.""" np.testing.assert_allclose( @@ -542,7 +544,7 @@ def test_CIE1960UCS_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CIE1960UCS_to_XYZ(self): + def test_n_dimensional_CIE1960UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_ucs.CIE1960UCS_to_XYZ` definition n-dimensional support. @@ -563,7 +565,7 @@ def test_n_dimensional_CIE1960UCS_to_XYZ(self): CIE1960UCS_to_XYZ(uvV), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_CIE1960UCS_to_XYZ(self): + def test_domain_range_scale_CIE1960UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_ucs.CIE1960UCS_to_XYZ` definition domain and range scale support. @@ -582,7 +584,7 @@ def test_domain_range_scale_CIE1960UCS_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_CIE1960UCS_to_XYZ(self): + def test_nan_CIE1960UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_ucs.CIE1960UCS_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_cie_uvw.py b/colour/models/tests/test_cie_uvw.py index 1b7331862..49048f635 100644 --- a/colour/models/tests/test_cie_uvw.py +++ b/colour/models/tests/test_cie_uvw.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.cie_uvw` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXYZ_to_UVW: methods. """ - def test_XYZ_to_UVW(self): + def test_XYZ_to_UVW(self) -> None: """Test :func:`colour.models.cie_uvw.XYZ_to_UVW` definition.""" np.testing.assert_allclose( @@ -75,7 +77,7 @@ def test_XYZ_to_UVW(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_UVW(self): + def test_n_dimensional_XYZ_to_UVW(self) -> None: """ Test :func:`colour.models.cie_uvw.XYZ_to_UVW` definition n-dimensional support. @@ -103,7 +105,7 @@ def test_n_dimensional_XYZ_to_UVW(self): XYZ_to_UVW(XYZ, illuminant), UVW, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_UVW(self): + def test_domain_range_scale_XYZ_to_UVW(self) -> None: """ Test :func:`colour.models.cie_uvw.XYZ_to_UVW` definition domain and range scale support. @@ -123,7 +125,7 @@ def test_domain_range_scale_XYZ_to_UVW(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_UVW(self): + def test_nan_XYZ_to_UVW(self) -> None: """Test :func:`colour.models.cie_uvw.XYZ_to_UVW` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -137,7 +139,7 @@ class TestUVW_to_XYZ: methods. """ - def test_UVW_to_XYZ(self): + def test_UVW_to_XYZ(self) -> None: """Test :func:`colour.models.cie_uvw.UVW_to_XYZ` definition.""" np.testing.assert_allclose( @@ -185,7 +187,7 @@ def test_UVW_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_UVW_to_XYZ(self): + def test_n_dimensional_UVW_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_uvw.UVW_to_XYZ` definition n-dimensional support. @@ -213,7 +215,7 @@ def test_n_dimensional_UVW_to_XYZ(self): UVW_to_XYZ(UVW, illuminant), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_UVW_to_XYZ(self): + def test_domain_range_scale_UVW_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_uvw.UVW_to_XYZ` definition domain and range scale support. @@ -233,7 +235,7 @@ def test_domain_range_scale_UVW_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_UVW_to_XYZ(self): + def test_nan_UVW_to_XYZ(self) -> None: """Test :func:`colour.models.cie_uvw.UVW_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/models/tests/test_cie_xyy.py b/colour/models/tests/test_cie_xyy.py index d9f5ffc19..809d610ae 100644 --- a/colour/models/tests/test_cie_xyy.py +++ b/colour/models/tests/test_cie_xyy.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.cie_xyy` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -38,7 +40,7 @@ class TestXYZ_to_xyY: methods. """ - def test_XYZ_to_xyY(self): + def test_XYZ_to_xyY(self) -> None: """Test :func:`colour.models.cie_xyy.XYZ_to_xyY` definition.""" np.testing.assert_allclose( @@ -85,7 +87,7 @@ def test_XYZ_to_xyY(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_xyY(self): + def test_n_dimensional_XYZ_to_xyY(self) -> None: """ Test :func:`colour.models.cie_xyy.XYZ_to_xyY` definition n-dimensional support. @@ -102,7 +104,7 @@ def test_n_dimensional_XYZ_to_xyY(self): xyY = np.reshape(xyY, (2, 3, 3)) np.testing.assert_allclose(XYZ_to_xyY(XYZ), xyY, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_XYZ_to_xyY(self): + def test_domain_range_scale_XYZ_to_xyY(self) -> None: """ Test :func:`colour.models.cie_xyy.XYZ_to_xyY` definition domain and range scale support. @@ -127,7 +129,7 @@ def test_domain_range_scale_XYZ_to_xyY(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_xyY(self): + def test_nan_XYZ_to_xyY(self) -> None: """Test :func:`colour.models.cie_xyy.XYZ_to_xyY` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -141,7 +143,7 @@ class TestxyY_to_XYZ: methods. """ - def test_xyY_to_XYZ(self): + def test_xyY_to_XYZ(self) -> None: """Test :func:`colour.models.cie_xyy.xyY_to_XYZ` definition.""" np.testing.assert_allclose( @@ -188,7 +190,7 @@ def test_xyY_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xyY_to_XYZ(self): + def test_n_dimensional_xyY_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_xyy.xyY_to_XYZ` definition n-dimensional support. @@ -205,7 +207,7 @@ def test_n_dimensional_xyY_to_XYZ(self): XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_allclose(xyY_to_XYZ(xyY), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_xyY_to_XYZ(self): + def test_domain_range_scale_xyY_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_xyy.xyY_to_XYZ` definition domain and range scale support. @@ -230,7 +232,7 @@ def test_domain_range_scale_xyY_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_xyY_to_XYZ(self): + def test_nan_xyY_to_XYZ(self) -> None: """Test :func:`colour.models.cie_xyy.xyY_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -244,7 +246,7 @@ class TestxyY_to_xy: methods. """ - def test_xyY_to_xy(self): + def test_xyY_to_xy(self) -> None: """Test :func:`colour.models.cie_xyy.xyY_to_xy` definition.""" np.testing.assert_allclose( @@ -271,7 +273,7 @@ def test_xyY_to_xy(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xyY_to_xy(self): + def test_n_dimensional_xyY_to_xy(self) -> None: """ Test :func:`colour.models.cie_xyy.xyY_to_xy` definition n-dimensional support. @@ -288,7 +290,7 @@ def test_n_dimensional_xyY_to_xy(self): xy = np.reshape(xy, (2, 3, 2)) np.testing.assert_allclose(xyY_to_xy(xyY), xy, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_xyY_to_xy(self): + def test_domain_range_scale_xyY_to_xy(self) -> None: """ Test :func:`colour.models.cie_xyy.xyY_to_xy` definition domain and range scale support. @@ -313,7 +315,7 @@ def test_domain_range_scale_xyY_to_xy(self): ) @ignore_numpy_errors - def test_nan_xyY_to_xy(self): + def test_nan_xyY_to_xy(self) -> None: """Test :func:`colour.models.cie_xyy.xyY_to_xy` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -327,7 +329,7 @@ class Testxy_to_xyY: methods. """ - def test_xy_to_xyY(self): + def test_xy_to_xyY(self) -> None: """Test :func:`colour.models.cie_xyy.xy_to_xyY` definition.""" np.testing.assert_allclose( @@ -360,7 +362,7 @@ def test_xy_to_xyY(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_xyY(self): + def test_n_dimensional_xy_to_xyY(self) -> None: """ Test :func:`colour.models.cie_xyy.xy_to_xyY` definition n-dimensional support. @@ -377,7 +379,7 @@ def test_n_dimensional_xy_to_xyY(self): xyY = np.reshape(xyY, (2, 3, 3)) np.testing.assert_allclose(xy_to_xyY(xy), xyY, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_xy_to_xyY(self): + def test_domain_range_scale_xy_to_xyY(self) -> None: """ Test :func:`colour.models.cie_xyy.xy_to_xyY` definition domain and range scale support. @@ -390,9 +392,9 @@ def test_domain_range_scale_xy_to_xyY(self): d_r = ( ("reference", 1, 1), - (1, 1, 1), + ("1", 1, 1), ( - 100, + "100", np.array([1, 1, 100]), np.array([1, 1, 100]), ), @@ -406,7 +408,7 @@ def test_domain_range_scale_xy_to_xyY(self): ) @ignore_numpy_errors - def test_nan_xy_to_xyY(self): + def test_nan_xy_to_xyY(self) -> None: """Test :func:`colour.models.cie_xyy.xy_to_xyY` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -420,7 +422,7 @@ class TestXYZ_to_xy: methods. """ - def test_XYZ_to_xy(self): + def test_XYZ_to_xy(self) -> None: """Test :func:`colour.models.cie_xyy.XYZ_to_xy` definition.""" np.testing.assert_allclose( @@ -447,7 +449,7 @@ def test_XYZ_to_xy(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_xy(self): + def test_n_dimensional_XYZ_to_xy(self) -> None: """ Test :func:`colour.models.cie_xyy.XYZ_to_xy` definition n-dimensional support. @@ -464,7 +466,7 @@ def test_n_dimensional_XYZ_to_xy(self): xy = np.reshape(xy, (2, 3, 2)) np.testing.assert_allclose(XYZ_to_xy(XYZ), xy, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_XYZ_to_xy(self): + def test_domain_range_scale_XYZ_to_xy(self) -> None: """ Test :func:`colour.models.cie_xyy.XYZ_to_xy` definition domain and range scale support. @@ -483,7 +485,7 @@ def test_domain_range_scale_XYZ_to_xy(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_xy(self): + def test_nan_XYZ_to_xy(self) -> None: """Test :func:`colour.models.cie_xyy.XYZ_to_xy` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -497,7 +499,7 @@ class Testxy_to_XYZ: methods. """ - def test_xy_to_XYZ(self): + def test_xy_to_XYZ(self) -> None: """Test :func:`colour.models.cie_xyy.xy_to_XYZ` definition.""" np.testing.assert_allclose( @@ -524,7 +526,7 @@ def test_xy_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_XYZ(self): + def test_n_dimensional_xy_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_xyy.xy_to_XYZ` definition n-dimensional support. @@ -541,7 +543,7 @@ def test_n_dimensional_xy_to_XYZ(self): XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_allclose(xy_to_XYZ(xy), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_xy_to_XYZ(self): + def test_domain_range_scale_xy_to_XYZ(self) -> None: """ Test :func:`colour.models.cie_xyy.xy_to_XYZ` definition domain and range scale support. @@ -566,7 +568,7 @@ def test_domain_range_scale_xy_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_xy_to_XYZ(self): + def test_nan_xy_to_XYZ(self) -> None: """Test :func:`colour.models.cie_xyy.xy_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/models/tests/test_common.py b/colour/models/tests/test_common.py index d3ced869c..c874bf85e 100644 --- a/colour/models/tests/test_common.py +++ b/colour/models/tests/test_common.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.common` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -29,7 +31,7 @@ class TestJab_to_JCh: methods. """ - def test_Jab_to_JCh(self): + def test_Jab_to_JCh(self) -> None: """Test :func:`colour.models.common.Jab_to_JCh` definition.""" np.testing.assert_allclose( @@ -50,7 +52,7 @@ def test_Jab_to_JCh(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Jab_to_JCh(self): + def test_n_dimensional_Jab_to_JCh(self) -> None: """ Test :func:`colour.models.common.Jab_to_JCh` definition n-dimensional arrays support. @@ -71,7 +73,7 @@ def test_n_dimensional_Jab_to_JCh(self): Jab_to_JCh(Lab), LCHab, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Jab_to_JCh(self): + def test_domain_range_scale_Jab_to_JCh(self) -> None: """ Test :func:`colour.models.common.Jab_to_JCh` definition domain and range scale support. @@ -94,7 +96,7 @@ def test_domain_range_scale_Jab_to_JCh(self): ) @ignore_numpy_errors - def test_nan_Jab_to_JCh(self): + def test_nan_Jab_to_JCh(self) -> None: """Test :func:`colour.models.common.Jab_to_JCh` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -108,7 +110,7 @@ class TestJCh_to_Jab: methods. """ - def test_JCh_to_Jab(self): + def test_JCh_to_Jab(self) -> None: """Test :func:`colour.models.common.JCh_to_Jab` definition.""" np.testing.assert_allclose( @@ -129,7 +131,7 @@ def test_JCh_to_Jab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_JCh_to_Jab(self): + def test_n_dimensional_JCh_to_Jab(self) -> None: """ Test :func:`colour.models.common.JCh_to_Jab` definition n-dimensional arrays support. @@ -150,7 +152,7 @@ def test_n_dimensional_JCh_to_Jab(self): JCh_to_Jab(LCHab), Lab, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_JCh_to_Jab(self): + def test_domain_range_scale_JCh_to_Jab(self) -> None: """ Test :func:`colour.models.common.JCh_to_Jab` definition domain and range scale support. @@ -173,7 +175,7 @@ def test_domain_range_scale_JCh_to_Jab(self): ) @ignore_numpy_errors - def test_nan_JCh_to_Jab(self): + def test_nan_JCh_to_Jab(self) -> None: """Test :func:`colour.models.common.JCh_to_Jab` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -184,7 +186,7 @@ def test_nan_JCh_to_Jab(self): class TestXYZ_to_Iab: """Define :func:`colour.models.common.XYZ_to_Iab` definition unit tests methods.""" - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self.LMS_to_LMS_p = lambda x: x**0.43 @@ -203,7 +205,7 @@ def setup_method(self): ] ) - def test_XYZ_to_Iab(self): + def test_XYZ_to_Iab(self) -> None: """Test :func:`colour.models.common.XYZ_to_Iab` definition.""" np.testing.assert_allclose( @@ -239,7 +241,7 @@ def test_XYZ_to_Iab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Iab(self): + def test_n_dimensional_XYZ_to_Iab(self) -> None: """ Test :func:`colour.models.common.XYZ_to_Iab` definition n-dimensional support. @@ -264,7 +266,7 @@ def test_n_dimensional_XYZ_to_Iab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_Iab(self): + def test_domain_range_scale_XYZ_to_Iab(self) -> None: """ Test :func:`colour.models.common.XYZ_to_Iab` definition domain and range scale support. @@ -288,7 +290,7 @@ def test_domain_range_scale_XYZ_to_Iab(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Iab(self): + def test_nan_XYZ_to_Iab(self) -> None: """Test :func:`colour.models.common.XYZ_to_Iab` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -302,7 +304,7 @@ class TestIab_to_XYZ: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self.LMS_p_to_LMS = lambda x: x ** (1 / 0.43) @@ -325,7 +327,7 @@ def setup_method(self): ) ) - def test_Iab_to_XYZ(self): + def test_Iab_to_XYZ(self) -> None: """Test :func:`colour.models.common.Iab_to_XYZ` definition.""" np.testing.assert_allclose( @@ -361,7 +363,7 @@ def test_Iab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Iab_to_XYZ(self): + def test_n_dimensional_Iab_to_XYZ(self) -> None: """ Test :func:`colour.models.common.Iab_to_XYZ` definition n-dimensional support. @@ -386,7 +388,7 @@ def test_n_dimensional_Iab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_Iab_to_XYZ(self): + def test_domain_range_scale_Iab_to_XYZ(self) -> None: """ Test :func:`colour.models.common.Iab_to_XYZ` definition domain and range scale support. @@ -410,7 +412,7 @@ def test_domain_range_scale_Iab_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Iab_to_XYZ(self): + def test_nan_Iab_to_XYZ(self) -> None: """Test :func:`colour.models.common.Iab_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/models/tests/test_din99.py b/colour/models/tests/test_din99.py index b9039cbf2..e870852e9 100644 --- a/colour/models/tests/test_din99.py +++ b/colour/models/tests/test_din99.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.din99` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -34,7 +36,7 @@ class TestLab_to_DIN99: methods. """ - def test_Lab_to_DIN99(self): + def test_Lab_to_DIN99(self) -> None: """Test :func:`colour.models.din99.Lab_to_DIN99` definition.""" np.testing.assert_allclose( @@ -82,7 +84,7 @@ def test_Lab_to_DIN99(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Lab_to_DIN99(self): + def test_n_dimensional_Lab_to_DIN99(self) -> None: """ Test :func:`colour.models.din99.Lab_to_DIN99` definition n-dimensional support. @@ -103,7 +105,7 @@ def test_n_dimensional_Lab_to_DIN99(self): Lab_to_DIN99(Lab), Lab_99, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Lab_to_DIN99(self): + def test_domain_range_scale_Lab_to_DIN99(self) -> None: """ Test :func:`colour.models.din99.Lab_to_DIN99` definition domain and range scale support. @@ -140,7 +142,7 @@ def test_domain_range_scale_Lab_to_DIN99(self): ) @ignore_numpy_errors - def test_nan_Lab_to_DIN99(self): + def test_nan_Lab_to_DIN99(self) -> None: """Test :func:`colour.models.din99.Lab_to_DIN99` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -157,7 +159,7 @@ class TestDIN99_to_Lab: methods. """ - def test_DIN99_to_Lab(self): + def test_DIN99_to_Lab(self) -> None: """Test :func:`colour.models.din99.DIN99_to_Lab` definition.""" np.testing.assert_allclose( @@ -205,7 +207,7 @@ def test_DIN99_to_Lab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_DIN99_to_Lab(self): + def test_n_dimensional_DIN99_to_Lab(self) -> None: """ Test :func:`colour.models.din99.DIN99_to_Lab` definition n-dimensional support. @@ -226,7 +228,7 @@ def test_n_dimensional_DIN99_to_Lab(self): DIN99_to_Lab(Lab_99), Lab, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_DIN99_to_Lab(self): + def test_domain_range_scale_DIN99_to_Lab(self) -> None: """ Test :func:`colour.models.din99.DIN99_to_Lab` definition domain and range scale support. @@ -263,7 +265,7 @@ def test_domain_range_scale_DIN99_to_Lab(self): ) @ignore_numpy_errors - def test_nan_DIN99_to_Lab(self): + def test_nan_DIN99_to_Lab(self) -> None: """Test :func:`colour.models.din99.DIN99_to_Lab` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -280,7 +282,7 @@ class TestXYZ_to_DIN99: methods. """ - def test_XYZ_to_DIN99(self): + def test_XYZ_to_DIN99(self) -> None: """Test :func:`colour.models.din99.XYZ_to_DIN99` definition.""" np.testing.assert_allclose( @@ -309,7 +311,7 @@ def test_XYZ_to_DIN99(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_DIN99(self): + def test_n_dimensional_XYZ_to_DIN99(self) -> None: """ Test :func:`colour.models.din99.XYZ_to_DIN99` definition n-dimensional support. @@ -330,7 +332,7 @@ def test_n_dimensional_XYZ_to_DIN99(self): XYZ_to_DIN99(XYZ), Lab_99, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_DIN99(self): + def test_domain_range_scale_XYZ_to_DIN99(self) -> None: """ Test :func:`colour.models.din99.XYZ_to_DIN99` definition domain and range scale support. @@ -349,7 +351,7 @@ def test_domain_range_scale_XYZ_to_DIN99(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_DIN99(self): + def test_nan_XYZ_to_DIN99(self) -> None: """Test :func:`colour.models.din99.XYZ_to_DIN99` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -363,7 +365,7 @@ class TestDIN99_to_XYZ: methods. """ - def test_DIN99_to_XYZ(self): + def test_DIN99_to_XYZ(self) -> None: """Test :func:`colour.models.din99.DIN99_to_XYZ` definition.""" np.testing.assert_allclose( @@ -393,7 +395,7 @@ def test_DIN99_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_DIN99_to_XYZ(self): + def test_n_dimensional_DIN99_to_XYZ(self) -> None: """ Test :func:`colour.models.din99.DIN99_to_XYZ` definition n-dimensional support. @@ -414,7 +416,7 @@ def test_n_dimensional_DIN99_to_XYZ(self): DIN99_to_XYZ(Lab_99), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_DIN99_to_XYZ(self): + def test_domain_range_scale_DIN99_to_XYZ(self) -> None: """ Test :func:`colour.models.din99.DIN99_to_XYZ` definition domain and range scale support. @@ -433,7 +435,7 @@ def test_domain_range_scale_DIN99_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_DIN99_to_XYZ(self): + def test_nan_DIN99_to_XYZ(self) -> None: """Test :func:`colour.models.din99.DIN99_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/models/tests/test_hdr_cie_lab.py b/colour/models/tests/test_hdr_cie_lab.py index fab0e55cc..55fffffa8 100644 --- a/colour/models/tests/test_hdr_cie_lab.py +++ b/colour/models/tests/test_hdr_cie_lab.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.hdr_cie_lab` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -29,7 +31,7 @@ class TestExponent_hdr_CIELab: definition unit tests methods. """ - def test_exponent_hdr_CIELab(self): + def test_exponent_hdr_CIELab(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.exponent_hdr_CIELab` definition. @@ -59,7 +61,7 @@ def test_exponent_hdr_CIELab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_exponent_hdr_CIELab(self): + def test_n_dimensional_exponent_hdr_CIELab(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.exponent_hdr_CIELab` definition n-dimensional arrays support. @@ -96,7 +98,7 @@ def test_n_dimensional_exponent_hdr_CIELab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_exponent_hdr_CIELab(self): + def test_domain_range_scale_exponent_hdr_CIELab(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.exponent_hdr_CIELab` definition domain and range scale support. @@ -116,7 +118,7 @@ def test_domain_range_scale_exponent_hdr_CIELab(self): ) @ignore_numpy_errors - def test_nan_exponent_hdr_CIELab(self): + def test_nan_exponent_hdr_CIELab(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.exponent_hdr_CIELab` definition nan support. @@ -132,7 +134,7 @@ class TestXYZ_to_hdr_CIELab: tests methods. """ - def test_XYZ_to_hdr_CIELab(self): + def test_XYZ_to_hdr_CIELab(self) -> None: """Test :func:`colour.models.hdr_cie_lab.XYZ_to_hdr_CIELab` definition.""" np.testing.assert_allclose( @@ -174,7 +176,7 @@ def test_XYZ_to_hdr_CIELab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_hdr_CIELab(self): + def test_n_dimensional_XYZ_to_hdr_CIELab(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.XYZ_to_hdr_CIELab` definition n-dimensional support. @@ -214,7 +216,7 @@ def test_n_dimensional_XYZ_to_hdr_CIELab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_hdr_CIELab(self): + def test_domain_range_scale_XYZ_to_hdr_CIELab(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.XYZ_to_hdr_CIELab` definition domain and range scale support. @@ -238,7 +240,7 @@ def test_domain_range_scale_XYZ_to_hdr_CIELab(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_hdr_CIELab(self): + def test_nan_XYZ_to_hdr_CIELab(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.XYZ_to_hdr_CIELab` definition nan support. @@ -255,7 +257,7 @@ class TestHdr_CIELab_to_XYZ: tests methods. """ - def test_hdr_CIELab_to_XYZ(self): + def test_hdr_CIELab_to_XYZ(self) -> None: """Test :func:`colour.models.hdr_cie_lab.hdr_CIELab_to_XYZ` definition.""" np.testing.assert_allclose( @@ -299,7 +301,7 @@ def test_hdr_CIELab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_hdr_CIELab_to_XYZ(self): + def test_n_dimensional_hdr_CIELab_to_XYZ(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.hdr_CIELab_to_XYZ` definition n-dimensional support. @@ -339,7 +341,7 @@ def test_n_dimensional_hdr_CIELab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_hdr_CIELab_to_XYZ(self): + def test_domain_range_scale_hdr_CIELab_to_XYZ(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.hdr_CIELab_to_XYZ` definition domain and range scale support. @@ -363,7 +365,7 @@ def test_domain_range_scale_hdr_CIELab_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_hdr_CIELab_to_XYZ(self): + def test_nan_hdr_CIELab_to_XYZ(self) -> None: """ Test :func:`colour.models.hdr_cie_lab.hdr_CIELab_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_hdr_ipt.py b/colour/models/tests/test_hdr_ipt.py index 777d21f79..9274186d1 100644 --- a/colour/models/tests/test_hdr_ipt.py +++ b/colour/models/tests/test_hdr_ipt.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.hdr_ipt` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -29,7 +31,7 @@ class TestExponent_hdr_IPT: definition unit tests methods. """ - def test_exponent_hdr_IPT(self): + def test_exponent_hdr_IPT(self) -> None: """Test :func:`colour.models.hdr_ipt.exponent_hdr_IPT` definition.""" np.testing.assert_allclose( @@ -56,7 +58,7 @@ def test_exponent_hdr_IPT(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_exponent_hdr_IPT(self): + def test_n_dimensional_exponent_hdr_IPT(self) -> None: """ Test :func:`colour.models.hdr_ipt.exponent_hdr_IPT` definition n-dimensional arrays support. @@ -93,7 +95,7 @@ def test_n_dimensional_exponent_hdr_IPT(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_exponent_hdr_IPT(self): + def test_domain_range_scale_exponent_hdr_IPT(self) -> None: """ Test :func:`colour.models.hdr_ipt.exponent_hdr_IPT` definition domain and range scale support. @@ -113,7 +115,7 @@ def test_domain_range_scale_exponent_hdr_IPT(self): ) @ignore_numpy_errors - def test_nan_exponent_hdr_IPT(self): + def test_nan_exponent_hdr_IPT(self) -> None: """ Test :func:`colour.models.hdr_ipt.exponent_hdr_IPT` definition nan support. @@ -129,7 +131,7 @@ class TestXYZ_to_hdr_IPT: methods. """ - def test_XYZ_to_hdr_IPT(self): + def test_XYZ_to_hdr_IPT(self) -> None: """Test :func:`colour.models.hdr_ipt.XYZ_to_hdr_IPT` definition.""" np.testing.assert_allclose( @@ -159,7 +161,7 @@ def test_XYZ_to_hdr_IPT(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_hdr_IPT(self): + def test_n_dimensional_XYZ_to_hdr_IPT(self) -> None: """ Test :func:`colour.models.hdr_ipt.XYZ_to_hdr_IPT` definition n-dimensional support. @@ -196,7 +198,7 @@ def test_n_dimensional_XYZ_to_hdr_IPT(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_hdr_IPT(self): + def test_domain_range_scale_XYZ_to_hdr_IPT(self) -> None: """ Test :func:`colour.models.hdr_ipt.XYZ_to_hdr_IPT` definition domain and range scale support. @@ -217,7 +219,7 @@ def test_domain_range_scale_XYZ_to_hdr_IPT(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_hdr_IPT(self): + def test_nan_XYZ_to_hdr_IPT(self) -> None: """ Test :func:`colour.models.hdr_ipt.XYZ_to_hdr_IPT` definition nan support. @@ -234,7 +236,7 @@ class TestHdr_IPT_to_XYZ: methods. """ - def test_hdr_IPT_to_XYZ(self): + def test_hdr_IPT_to_XYZ(self) -> None: """Test :func:`colour.models.hdr_ipt.hdr_IPT_to_XYZ` definition.""" np.testing.assert_allclose( @@ -266,7 +268,7 @@ def test_hdr_IPT_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_hdr_IPT_to_XYZ(self): + def test_n_dimensional_hdr_IPT_to_XYZ(self) -> None: """ Test :func:`colour.models.hdr_ipt.hdr_IPT_to_XYZ` definition n-dimensional support. @@ -303,7 +305,7 @@ def test_n_dimensional_hdr_IPT_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_hdr_IPT_to_XYZ(self): + def test_domain_range_scale_hdr_IPT_to_XYZ(self) -> None: """ Test :func:`colour.models.hdr_ipt.hdr_IPT_to_XYZ` definition domain and range scale support. @@ -324,7 +326,7 @@ def test_domain_range_scale_hdr_IPT_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_hdr_IPT_to_XYZ(self): + def test_nan_hdr_IPT_to_XYZ(self) -> None: """ Test :func:`colour.models.hdr_ipt.hdr_IPT_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_hunter_lab.py b/colour/models/tests/test_hunter_lab.py index 869566e12..698b3a04b 100644 --- a/colour/models/tests/test_hunter_lab.py +++ b/colour/models/tests/test_hunter_lab.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.hunter_lab` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -33,7 +35,7 @@ class TestXYZ_to_K_ab_HunterLab1966: definition unit tests methods. """ - def test_XYZ_to_K_ab_HunterLab1966(self): + def test_XYZ_to_K_ab_HunterLab1966(self) -> None: """ Test :func:`colour.models.hunter_lab.XYZ_to_K_ab_HunterLab1966` definition. @@ -63,7 +65,7 @@ def test_XYZ_to_K_ab_HunterLab1966(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_K_ab_HunterLab1966(self): + def test_n_dimensional_XYZ_to_K_ab_HunterLab1966(self) -> None: """ Test :func:`colour.models.hunter_lab.XYZ_to_K_ab_HunterLab1966` definition n-dimensional support. @@ -85,7 +87,7 @@ def test_n_dimensional_XYZ_to_K_ab_HunterLab1966(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_K_ab_HunterLab1966(self): + def test_nan_XYZ_to_K_ab_HunterLab1966(self) -> None: """ Test :func:`colour.models.hunter_lab.XYZ_to_K_ab_HunterLab1966` definition nan support. @@ -102,7 +104,7 @@ class TestXYZ_to_Hunter_Lab: tests methods. """ - def test_XYZ_to_Hunter_Lab(self): + def test_XYZ_to_Hunter_Lab(self) -> None: """Test :func:`colour.models.hunter_lab.XYZ_to_Hunter_Lab` definition.""" np.testing.assert_allclose( @@ -156,7 +158,7 @@ def test_XYZ_to_Hunter_Lab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Hunter_Lab(self): + def test_n_dimensional_XYZ_to_Hunter_Lab(self) -> None: """ Test :func:`colour.models.hunter_lab.XYZ_to_Hunter_Lab` definition n-dimensional support. @@ -196,7 +198,7 @@ def test_n_dimensional_XYZ_to_Hunter_Lab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_Hunter_Lab(self): + def test_domain_range_scale_XYZ_to_Hunter_Lab(self) -> None: """ Test :func:`colour.models.hunter_lab.XYZ_to_Hunter_Lab` definition domain and range scale support. @@ -220,7 +222,7 @@ def test_domain_range_scale_XYZ_to_Hunter_Lab(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Hunter_Lab(self): + def test_nan_XYZ_to_Hunter_Lab(self) -> None: """ Test :func:`colour.models.hunter_lab.XYZ_to_Hunter_Lab` definition nan support. @@ -237,7 +239,7 @@ class TestHunter_Lab_to_XYZ: tests methods. """ - def test_Hunter_Lab_to_XYZ(self): + def test_Hunter_Lab_to_XYZ(self) -> None: """Test :func:`colour.models.hunter_lab.Hunter_Lab_to_XYZ` definition.""" np.testing.assert_allclose( @@ -291,7 +293,7 @@ def test_Hunter_Lab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Hunter_Lab_to_XYZ(self): + def test_n_dimensional_Hunter_Lab_to_XYZ(self) -> None: """ Test :func:`colour.models.hunter_lab.Hunter_Lab_to_XYZ` definition n-dimensional support. @@ -331,7 +333,7 @@ def test_n_dimensional_Hunter_Lab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_Hunter_Lab_to_XYZ(self): + def test_domain_range_scale_Hunter_Lab_to_XYZ(self) -> None: """ Test :func:`colour.models.hunter_lab.Hunter_Lab_to_XYZ` definition domain and range scale support. @@ -355,7 +357,7 @@ def test_domain_range_scale_Hunter_Lab_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Hunter_Lab_to_XYZ(self): + def test_nan_Hunter_Lab_to_XYZ(self) -> None: """ Test :func:`colour.models.hunter_lab.Hunter_Lab_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_hunter_rdab.py b/colour/models/tests/test_hunter_rdab.py index 76c348e2a..103af7749 100644 --- a/colour/models/tests/test_hunter_rdab.py +++ b/colour/models/tests/test_hunter_rdab.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.hunter_rdab` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -28,7 +30,7 @@ class TestXYZ_to_Hunter_Rdab: unit tests methods. """ - def test_XYZ_to_Hunter_Rdab(self): + def test_XYZ_to_Hunter_Rdab(self) -> None: """Test :func:`colour.models.hunter_rdab.XYZ_to_Hunter_Rdab` definition.""" np.testing.assert_allclose( @@ -82,7 +84,7 @@ def test_XYZ_to_Hunter_Rdab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Hunter_Rdab(self): + def test_n_dimensional_XYZ_to_Hunter_Rdab(self) -> None: """ Test :func:`colour.models.hunter_rdab.XYZ_to_Hunter_Rdab` definition n-dimensional support. @@ -122,7 +124,7 @@ def test_n_dimensional_XYZ_to_Hunter_Rdab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_XYZ_to_Hunter_Rdab(self): + def test_domain_range_scale_XYZ_to_Hunter_Rdab(self) -> None: """ Test :func:`colour.models.hunter_lab.XYZ_to_Hunter_Rdab` definition domain and range scale support. @@ -146,7 +148,7 @@ def test_domain_range_scale_XYZ_to_Hunter_Rdab(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Hunter_Rdab(self): + def test_nan_XYZ_to_Hunter_Rdab(self) -> None: """ Test :func:`colour.models.hunter_rdab.XYZ_to_Hunter_Rdab` definition nan support. @@ -163,7 +165,7 @@ class TestHunter_Rdab_to_XYZ: unit tests methods. """ - def test_Hunter_Rdab_to_XYZ(self): + def test_Hunter_Rdab_to_XYZ(self) -> None: """Test :func:`colour.models.hunter_rdab.Hunter_Rdab_to_XYZ` definition.""" np.testing.assert_allclose( @@ -217,7 +219,7 @@ def test_Hunter_Rdab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_Hunter_Rdab_to_XYZ(self): + def test_n_dimensional_Hunter_Rdab_to_XYZ(self) -> None: """ Test :func:`colour.models.hunter_rdab.Hunter_Rdab_to_XYZ` definition n-dimensional support. @@ -257,7 +259,7 @@ def test_n_dimensional_Hunter_Rdab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_Hunter_Rdab_to_XYZ(self): + def test_domain_range_scale_Hunter_Rdab_to_XYZ(self) -> None: """ Test :func:`colour.models.hunter_lab.Hunter_Rdab_to_XYZ` definition domain and range scale support. @@ -281,7 +283,7 @@ def test_domain_range_scale_Hunter_Rdab_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Hunter_Rdab_to_XYZ(self): + def test_nan_Hunter_Rdab_to_XYZ(self) -> None: """ Test :func:`colour.models.hunter_rdab.Hunter_Rdab_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_icacb.py b/colour/models/tests/test_icacb.py index 263f981a8..328a79bfb 100644 --- a/colour/models/tests/test_icacb.py +++ b/colour/models/tests/test_icacb.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.hunter_rdab` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXYZ_to_ICaCb: methods. """ - def test_XYZ_to_ICaCb(self): + def test_XYZ_to_ICaCb(self) -> None: """Test :func:`colour.models.icacb.XYZ_to_ICaCb` definition.""" np.testing.assert_allclose( @@ -54,7 +56,7 @@ def test_XYZ_to_ICaCb(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_ICaCb(self): + def test_n_dimensional_XYZ_to_ICaCb(self) -> None: """ Test :func:`colour.models.icacb.XYZ_to_ICaCb` definition n-dimensional support. @@ -75,7 +77,7 @@ def test_n_dimensional_XYZ_to_ICaCb(self): XYZ_to_ICaCb(XYZ), ICaCb, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_ICaCb(self): + def test_domain_range_scale_XYZ_to_ICaCb(self) -> None: """ Test :func:`colour.models.icacb.XYZ_to_ICaCb` definition domain and range scale support. @@ -94,7 +96,7 @@ def test_domain_range_scale_XYZ_to_ICaCb(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_ICaCb(self): + def test_nan_XYZ_to_ICaCb(self) -> None: """Test :func:`colour.models.cie_lab.XYZ_to_Lab` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -105,7 +107,7 @@ def test_nan_XYZ_to_ICaCb(self): class TestICaCb_to_XYZ: """Test :func:`colour.models.icacb.ICaCb_to_XYZ` definition.""" - def test_XYZ_to_ICaCb(self): + def test_XYZ_to_ICaCb(self) -> None: """Test :func:`colour.models.icacb.ICaCb_to_XYZ` definition.""" np.testing.assert_allclose( @@ -132,7 +134,7 @@ def test_XYZ_to_ICaCb(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_ICaCb_to_XYZ(self): + def test_n_dimensional_ICaCb_to_XYZ(self) -> None: """ Test :func:`colour.models.icacb.ICaCb_to_XYZ` definition n-dimensional support. @@ -153,7 +155,7 @@ def test_n_dimensional_ICaCb_to_XYZ(self): ICaCb_to_XYZ(ICaCb), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_ICaCb_to_XYZ(self): + def test_domain_range_scale_ICaCb_to_XYZ(self) -> None: """ Test :func:`colour.models.icacb.ICaCb_to_XYZ` definition domain and range scale support. @@ -172,7 +174,7 @@ def test_domain_range_scale_ICaCb_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_ICaCb_to_XYZ(self): + def test_nan_ICaCb_to_XYZ(self) -> None: """Test :func:`colour.models.cie_lab.XYZ_to_Lab` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/models/tests/test_igpgtg.py b/colour/models/tests/test_igpgtg.py index fd7ff49e2..bf3524e37 100644 --- a/colour/models/tests/test_igpgtg.py +++ b/colour/models/tests/test_igpgtg.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.igpgtg` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXYZ_to_IgPgTg: methods. """ - def test_XYZ_to_IgPgTg(self): + def test_XYZ_to_IgPgTg(self) -> None: """Test :func:`colour.models.igpgtg.XYZ_to_IgPgTg` definition.""" np.testing.assert_allclose( @@ -48,7 +50,7 @@ def test_XYZ_to_IgPgTg(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_IgPgTg(self): + def test_n_dimensional_XYZ_to_IgPgTg(self) -> None: """ Test :func:`colour.models.igpgtg.XYZ_to_IgPgTg` definition n-dimensional support. @@ -69,7 +71,7 @@ def test_n_dimensional_XYZ_to_IgPgTg(self): XYZ_to_IgPgTg(XYZ), IgPgTg, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_IgPgTg(self): + def test_domain_range_scale_XYZ_to_IgPgTg(self) -> None: """ Test :func:`colour.models.igpgtg.XYZ_to_IgPgTg` definition domain and range scale support. @@ -88,7 +90,7 @@ def test_domain_range_scale_XYZ_to_IgPgTg(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_IgPgTg(self): + def test_nan_XYZ_to_IgPgTg(self) -> None: """ Test :func:`colour.models.igpgtg.XYZ_to_IgPgTg` definition nan support. @@ -105,7 +107,7 @@ class TestIgPgTg_to_XYZ: methods. """ - def test_IgPgTg_to_XYZ(self): + def test_IgPgTg_to_XYZ(self) -> None: """Test :func:`colour.models.igpgtg.IgPgTg_to_XYZ` definition.""" np.testing.assert_allclose( @@ -126,7 +128,7 @@ def test_IgPgTg_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_IgPgTg_to_XYZ(self): + def test_n_dimensional_IgPgTg_to_XYZ(self) -> None: """ Test :func:`colour.models.igpgtg.IgPgTg_to_XYZ` definition n-dimensional support. @@ -147,7 +149,7 @@ def test_n_dimensional_IgPgTg_to_XYZ(self): IgPgTg_to_XYZ(IgPgTg), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_IgPgTg_to_XYZ(self): + def test_domain_range_scale_IgPgTg_to_XYZ(self) -> None: """ Test :func:`colour.models.igpgtg.IgPgTg_to_XYZ` definition domain and range scale support. @@ -166,7 +168,7 @@ def test_domain_range_scale_IgPgTg_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_IgPgTg_to_XYZ(self): + def test_nan_IgPgTg_to_XYZ(self) -> None: """ Test :func:`colour.models.igpgtg.IgPgTg_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_ipt.py b/colour/models/tests/test_ipt.py index c8e29bfe5..ab2aa9b7b 100644 --- a/colour/models/tests/test_ipt.py +++ b/colour/models/tests/test_ipt.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.ipt` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -25,7 +27,7 @@ class TestXYZ_to_IPT: """Define :func:`colour.models.ipt.XYZ_to_IPT` definition unit tests methods.""" - def test_XYZ_to_IPT(self): + def test_XYZ_to_IPT(self) -> None: """Test :func:`colour.models.ipt.XYZ_to_IPT` definition.""" np.testing.assert_allclose( @@ -46,7 +48,7 @@ def test_XYZ_to_IPT(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_IPT(self): + def test_n_dimensional_XYZ_to_IPT(self) -> None: """ Test :func:`colour.models.ipt.XYZ_to_IPT` definition n-dimensional support. @@ -63,7 +65,7 @@ def test_n_dimensional_XYZ_to_IPT(self): IPT = np.reshape(IPT, (2, 3, 3)) np.testing.assert_allclose(XYZ_to_IPT(XYZ), IPT, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_XYZ_to_IPT(self): + def test_domain_range_scale_XYZ_to_IPT(self) -> None: """ Test :func:`colour.models.ipt.XYZ_to_IPT` definition domain and range scale support. @@ -82,7 +84,7 @@ def test_domain_range_scale_XYZ_to_IPT(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_IPT(self): + def test_nan_XYZ_to_IPT(self) -> None: """Test :func:`colour.models.ipt.XYZ_to_IPT` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -96,7 +98,7 @@ class TestIPT_to_XYZ: methods. """ - def test_IPT_to_XYZ(self): + def test_IPT_to_XYZ(self) -> None: """Test :func:`colour.models.ipt.IPT_to_XYZ` definition.""" np.testing.assert_allclose( @@ -117,7 +119,7 @@ def test_IPT_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_IPT_to_XYZ(self): + def test_n_dimensional_IPT_to_XYZ(self) -> None: """ Test :func:`colour.models.ipt.IPT_to_XYZ` definition n-dimensional support. @@ -134,7 +136,7 @@ def test_n_dimensional_IPT_to_XYZ(self): XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_allclose(IPT_to_XYZ(IPT), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_IPT_to_XYZ(self): + def test_domain_range_scale_IPT_to_XYZ(self) -> None: """ Test :func:`colour.models.ipt.IPT_to_XYZ` definition domain and range scale support. @@ -153,7 +155,7 @@ def test_domain_range_scale_IPT_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_IPT_to_XYZ(self): + def test_nan_IPT_to_XYZ(self) -> None: """Test :func:`colour.models.ipt.IPT_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -167,7 +169,7 @@ class TestIPTHueAngle: methods. """ - def test_IPT_hue_angle(self): + def test_IPT_hue_angle(self) -> None: """Test :func:`colour.models.ipt.IPT_hue_angle` definition.""" np.testing.assert_allclose( @@ -188,7 +190,7 @@ def test_IPT_hue_angle(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_IPT_hue_angle(self): + def test_n_dimensional_IPT_hue_angle(self) -> None: """ Test :func:`colour.models.ipt.IPT_hue_angle` definition n-dimensional support. @@ -209,7 +211,7 @@ def test_n_dimensional_IPT_hue_angle(self): IPT_hue_angle(IPT), hue, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_IPT_hue_angle(self): + def test_domain_range_scale_IPT_hue_angle(self) -> None: """ Test :func:`colour.models.ipt.IPT_hue_angle` definition domain and range scale support. @@ -228,7 +230,7 @@ def test_domain_range_scale_IPT_hue_angle(self): ) @ignore_numpy_errors - def test_nan_IPT_hue_angle(self): + def test_nan_IPT_hue_angle(self) -> None: """Test :func:`colour.models.ipt.IPT_hue_angle` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/models/tests/test_jzazbz.py b/colour/models/tests/test_jzazbz.py index 72ec17603..9b2a2cc46 100644 --- a/colour/models/tests/test_jzazbz.py +++ b/colour/models/tests/test_jzazbz.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.jzazbz` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -34,7 +36,7 @@ class TestXYZ_to_Izazbz: tests methods. """ - def test_XYZ_to_Izazbz(self): + def test_XYZ_to_Izazbz(self) -> None: """Test :func:`colour.models.jzazbz.XYZ_to_Izazbz` definition.""" np.testing.assert_allclose( @@ -74,7 +76,7 @@ def test_XYZ_to_Izazbz(self): ), ) - def test_n_dimensional_XYZ_to_Izazbz(self): + def test_n_dimensional_XYZ_to_Izazbz(self) -> None: """ Test :func:`colour.models.jzazbz.XYZ_to_Izazbz` definition n-dimensional support. @@ -95,7 +97,7 @@ def test_n_dimensional_XYZ_to_Izazbz(self): XYZ_to_Izazbz(XYZ), Izazbz, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_Izazbz(self): + def test_domain_range_scale_XYZ_to_Izazbz(self) -> None: """ Test :func:`colour.models.jzazbz.XYZ_to_Izazbz` definition domain and range scale support. @@ -114,7 +116,7 @@ def test_domain_range_scale_XYZ_to_Izazbz(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Izazbz(self): + def test_nan_XYZ_to_Izazbz(self) -> None: """ Test :func:`colour.models.jzazbz.XYZ_to_Izazbz` definition nan support. @@ -131,7 +133,7 @@ class TestIzazbz_to_XYZ: methods. """ - def test_Izazbz_to_XYZ(self): + def test_Izazbz_to_XYZ(self) -> None: """Test :func:`colour.models.jzazbz.Izazbz_to_XYZ` definition.""" np.testing.assert_allclose( @@ -177,7 +179,7 @@ def test_Izazbz_to_XYZ(self): ), ) - def test_n_dimensional_Izazbz_to_XYZ(self): + def test_n_dimensional_Izazbz_to_XYZ(self) -> None: """ Test :func:`colour.models.jzazbz.Izazbz_to_XYZ` definition n-dimensional support. @@ -198,7 +200,7 @@ def test_n_dimensional_Izazbz_to_XYZ(self): Izazbz_to_XYZ(Izazbz), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Izazbz_to_XYZ(self): + def test_domain_range_scale_Izazbz_to_XYZ(self) -> None: """ Test :func:`colour.models.jzazbz.Izazbz_to_XYZ` definition domain and range scale support. @@ -217,7 +219,7 @@ def test_domain_range_scale_Izazbz_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Izazbz_to_XYZ(self): + def test_nan_Izazbz_to_XYZ(self) -> None: """ Test :func:`colour.models.jzazbz.Izazbz_to_XYZ` definition nan support. @@ -234,7 +236,7 @@ class TestXYZ_to_Jzazbz: tests methods. """ - def test_XYZ_to_Jzazbz(self): + def test_XYZ_to_Jzazbz(self) -> None: """Test :func:`colour.models.jzazbz.XYZ_to_Jzazbz` definition.""" np.testing.assert_allclose( @@ -255,7 +257,7 @@ def test_XYZ_to_Jzazbz(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Jzazbz(self): + def test_n_dimensional_XYZ_to_Jzazbz(self) -> None: """ Test :func:`colour.models.jzazbz.XYZ_to_Jzazbz` definition n-dimensional support. @@ -276,7 +278,7 @@ def test_n_dimensional_XYZ_to_Jzazbz(self): XYZ_to_Jzazbz(XYZ), Jzazbz, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_Jzazbz(self): + def test_domain_range_scale_XYZ_to_Jzazbz(self) -> None: """ Test :func:`colour.models.jzazbz.XYZ_to_Jzazbz` definition domain and range scale support. @@ -293,7 +295,7 @@ def test_domain_range_scale_XYZ_to_Jzazbz(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Jzazbz(self): + def test_nan_XYZ_to_Jzazbz(self) -> None: """ Test :func:`colour.models.jzazbz.XYZ_to_Jzazbz` definition nan support. @@ -310,7 +312,7 @@ class TestJzazbz_to_XYZ: methods. """ - def test_Jzazbz_to_XYZ(self): + def test_Jzazbz_to_XYZ(self) -> None: """Test :func:`colour.models.jzazbz.Jzazbz_to_XYZ` definition.""" np.testing.assert_allclose( @@ -331,7 +333,7 @@ def test_Jzazbz_to_XYZ(self): atol=1e-6, ) - def test_n_dimensional_Jzazbz_to_XYZ(self): + def test_n_dimensional_Jzazbz_to_XYZ(self) -> None: """ Test :func:`colour.models.jzazbz.Jzazbz_to_XYZ` definition n-dimensional support. @@ -352,7 +354,7 @@ def test_n_dimensional_Jzazbz_to_XYZ(self): Jzazbz_to_XYZ(Jzazbz), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Jzazbz_to_XYZ(self): + def test_domain_range_scale_Jzazbz_to_XYZ(self) -> None: """ Test :func:`colour.models.jzazbz.Jzazbz_to_XYZ` definition domain and range scale support. @@ -371,7 +373,7 @@ def test_domain_range_scale_Jzazbz_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Jzazbz_to_XYZ(self): + def test_nan_Jzazbz_to_XYZ(self) -> None: """ Test :func:`colour.models.jzazbz.Jzazbz_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_oklab.py b/colour/models/tests/test_oklab.py index 9c0edef2f..c6524e2e9 100644 --- a/colour/models/tests/test_oklab.py +++ b/colour/models/tests/test_oklab.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.oklab` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXYZ_to_Oklab: tests methods. """ - def test_XYZ_to_Oklab(self): + def test_XYZ_to_Oklab(self) -> None: """Test :func:`colour.models.oklab.XYZ_to_Oklab` definition.""" np.testing.assert_allclose( @@ -48,7 +50,7 @@ def test_XYZ_to_Oklab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Oklab(self): + def test_n_dimensional_XYZ_to_Oklab(self) -> None: """ Test :func:`colour.models.oklab.XYZ_to_Oklab` definition n-dimensional support. @@ -69,7 +71,7 @@ def test_n_dimensional_XYZ_to_Oklab(self): XYZ_to_Oklab(XYZ), Oklab, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_Oklab(self): + def test_domain_range_scale_XYZ_to_Oklab(self) -> None: """ Test :func:`colour.models.oklab.XYZ_to_Oklab` definition domain and range scale support. @@ -88,7 +90,7 @@ def test_domain_range_scale_XYZ_to_Oklab(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Oklab(self): + def test_nan_XYZ_to_Oklab(self) -> None: """ Test :func:`colour.models.oklab.XYZ_to_Oklab` definition nan support. @@ -105,7 +107,7 @@ class TestOklab_to_XYZ: methods. """ - def test_Oklab_to_XYZ(self): + def test_Oklab_to_XYZ(self) -> None: """Test :func:`colour.models.oklab.Oklab_to_XYZ` definition.""" np.testing.assert_allclose( @@ -126,7 +128,7 @@ def test_Oklab_to_XYZ(self): atol=1e-6, ) - def test_n_dimensional_Oklab_to_XYZ(self): + def test_n_dimensional_Oklab_to_XYZ(self) -> None: """ Test :func:`colour.models.oklab.Oklab_to_XYZ` definition n-dimensional support. @@ -147,7 +149,7 @@ def test_n_dimensional_Oklab_to_XYZ(self): Oklab_to_XYZ(Oklab), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_Oklab_to_XYZ(self): + def test_domain_range_scale_Oklab_to_XYZ(self) -> None: """ Test :func:`colour.models.oklab.Oklab_to_XYZ` definition domain and range scale support. @@ -165,7 +167,7 @@ def test_domain_range_scale_Oklab_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Oklab_to_XYZ(self): + def test_nan_Oklab_to_XYZ(self) -> None: """ Test :func:`colour.models.oklab.Oklab_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_osa_ucs.py b/colour/models/tests/test_osa_ucs.py index 589a0f1dc..ce3a9ce88 100644 --- a/colour/models/tests/test_osa_ucs.py +++ b/colour/models/tests/test_osa_ucs.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.osa_ucs` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXYZ_to_OSA_UCS: methods. """ - def test_XYZ_to_OSA_UCS(self): + def test_XYZ_to_OSA_UCS(self) -> None: """Test :func:`colour.models.osa_ucs.XYZ_to_OSA_UCS` definition.""" np.testing.assert_allclose( @@ -48,7 +50,7 @@ def test_XYZ_to_OSA_UCS(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_OSA_UCS(self): + def test_n_dimensional_XYZ_to_OSA_UCS(self) -> None: """ Test :func:`colour.models.osa_ucs.XYZ_to_OSA_UCS` definition n-dimensional support. @@ -69,7 +71,7 @@ def test_n_dimensional_XYZ_to_OSA_UCS(self): XYZ_to_OSA_UCS(XYZ), Ljg, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_OSA_UCS(self): + def test_domain_range_scale_XYZ_to_OSA_UCS(self) -> None: """ Test :func:`colour.models.osa_ucs.XYZ_to_OSA_UCS` definition domain and range scale support. @@ -88,7 +90,7 @@ def test_domain_range_scale_XYZ_to_OSA_UCS(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_OSA_UCS(self): + def test_nan_XYZ_to_OSA_UCS(self) -> None: """ Test :func:`colour.models.osa_ucs.XYZ_to_OSA_UCS` definition nan support. @@ -105,7 +107,7 @@ class TestOSA_UCS_to_XYZ: methods. """ - def test_OSA_UCS_to_XYZ(self): + def test_OSA_UCS_to_XYZ(self) -> None: """Test :func:`colour.models.osa_ucs.OSA_UCS_to_XYZ` definition.""" np.testing.assert_allclose( @@ -135,7 +137,7 @@ def test_OSA_UCS_to_XYZ(self): atol=5e-5, ) - def test_n_dimensional_OSA_UCS_to_XYZ(self): + def test_n_dimensional_OSA_UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.osa_ucs.OSA_UCS_to_XYZ` definition n-dimensional support. @@ -156,7 +158,7 @@ def test_n_dimensional_OSA_UCS_to_XYZ(self): OSA_UCS_to_XYZ(Ljg), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_OSA_UCS_to_XYZ(self): + def test_domain_range_scale_OSA_UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.osa_ucs.OSA_UCS_to_XYZ` definition domain and range scale support. @@ -173,7 +175,7 @@ def test_domain_range_scale_OSA_UCS_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_OSA_UCS_to_XYZ(self): + def test_nan_OSA_UCS_to_XYZ(self) -> None: """ Test :func:`colour.models.osa_ucs.OSA_UCS_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_prolab.py b/colour/models/tests/test_prolab.py index 70f934ba0..cc5e77cd5 100644 --- a/colour/models/tests/test_prolab.py +++ b/colour/models/tests/test_prolab.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.prolab` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXYZ_to_ProLab: tests methods. """ - def test_XYZ_to_ProLab(self): + def test_XYZ_to_ProLab(self) -> None: """Test :func:`colour.models.ProLab.XYZ_to_ProLab` definition.""" np.testing.assert_allclose( @@ -48,7 +50,7 @@ def test_XYZ_to_ProLab(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_ProLab(self): + def test_n_dimensional_XYZ_to_ProLab(self) -> None: """ Test :func:`colour.models.prolab.XYZ_to_ProLab` definition n-dimensional support. @@ -69,7 +71,7 @@ def test_n_dimensional_XYZ_to_ProLab(self): XYZ_to_ProLab(XYZ), ProLab, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_ProLab(self): + def test_domain_range_scale_XYZ_to_ProLab(self) -> None: """ Test :func:`colour.models.prolab.XYZ_to_ProLab` definition domain and range scale support. @@ -88,7 +90,7 @@ def test_domain_range_scale_XYZ_to_ProLab(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_ProLab(self): + def test_nan_XYZ_to_ProLab(self) -> None: """ Test :func:`colour.models.ProLab.XYZ_to_ProLab` definition nan support. @@ -105,7 +107,7 @@ class TestProLab_to_XYZ: methods. """ - def test_ProLab_to_XYZ(self): + def test_ProLab_to_XYZ(self) -> None: """Test :func:`colour.models.ProLab.ProLab_to_XYZ` definition.""" np.testing.assert_allclose( @@ -126,7 +128,7 @@ def test_ProLab_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_ProLab(self): + def test_n_dimensional_XYZ_to_ProLab(self) -> None: """ Test :func:`colour.models.prolab.XYZ_to_ProLab` definition n-dimensional support. @@ -147,7 +149,7 @@ def test_n_dimensional_XYZ_to_ProLab(self): ProLab_to_XYZ(ProLab), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_ProLab(self): + def test_domain_range_scale_XYZ_to_ProLab(self) -> None: """ Test :func:`colour.models.prolab.XYZ_to_ProLab` definition domain and range scale support. @@ -166,7 +168,7 @@ def test_domain_range_scale_XYZ_to_ProLab(self): ) @ignore_numpy_errors - def test_nan_ProLab_to_XYZ(self): + def test_nan_ProLab_to_XYZ(self) -> None: """ Test :func:`colour.models.ProLab.ProLab_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_ragoo2021.py b/colour/models/tests/test_ragoo2021.py index 8f7ccb92d..096f0f6b3 100644 --- a/colour/models/tests/test_ragoo2021.py +++ b/colour/models/tests/test_ragoo2021.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.ragoo2021` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXYZ_to_IPT_Ragoo2021: unit tests methods. """ - def test_XYZ_to_IPT_Ragoo2021(self): + def test_XYZ_to_IPT_Ragoo2021(self) -> None: """ Test :func:`colour.models.ragoo2021.XYZ_to_IPT_Ragoo2021` definition. """ @@ -50,7 +52,7 @@ def test_XYZ_to_IPT_Ragoo2021(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_IPT_Ragoo2021(self): + def test_n_dimensional_XYZ_to_IPT_Ragoo2021(self) -> None: """ Test :func:`colour.models.ragoo2021.XYZ_to_IPT_Ragoo2021` definition n-dimensional support. @@ -71,7 +73,7 @@ def test_n_dimensional_XYZ_to_IPT_Ragoo2021(self): XYZ_to_IPT_Ragoo2021(XYZ), IPT, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_XYZ_to_IPT_Ragoo2021(self): + def test_domain_range_scale_XYZ_to_IPT_Ragoo2021(self) -> None: """ Test :func:`colour.models.ragoo2021.XYZ_to_IPT_Ragoo2021` definition domain and range scale support. @@ -90,7 +92,7 @@ def test_domain_range_scale_XYZ_to_IPT_Ragoo2021(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_IPT_Ragoo2021(self): + def test_nan_XYZ_to_IPT_Ragoo2021(self) -> None: """ Test :func:`colour.models.ragoo2021.XYZ_to_IPT_Ragoo2021` definition nan support. @@ -107,7 +109,7 @@ class TestIPT_Ragoo2021_to_XYZ: unit tests methods. """ - def test_IPT_Ragoo2021_to_XYZ(self): + def test_IPT_Ragoo2021_to_XYZ(self) -> None: """ Test :func:`colour.models.ragoo2021.IPT_Ragoo2021_to_XYZ` definition. """ @@ -130,7 +132,7 @@ def test_IPT_Ragoo2021_to_XYZ(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_IPT_Ragoo2021_to_XYZ(self): + def test_n_dimensional_IPT_Ragoo2021_to_XYZ(self) -> None: """ Test :func:`colour.models.ragoo2021.IPT_Ragoo2021_to_XYZ` definition n-dimensional support. @@ -151,7 +153,7 @@ def test_n_dimensional_IPT_Ragoo2021_to_XYZ(self): IPT_Ragoo2021_to_XYZ(IPT), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_IPT_Ragoo2021_to_XYZ(self): + def test_domain_range_scale_IPT_Ragoo2021_to_XYZ(self) -> None: """ Test :func:`colour.models.ragoo2021.IPT_Ragoo2021_to_XYZ` definition domain and range scale support. @@ -170,7 +172,7 @@ def test_domain_range_scale_IPT_Ragoo2021_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_IPT_Ragoo2021_to_XYZ(self): + def test_nan_IPT_Ragoo2021_to_XYZ(self) -> None: """ Test :func:`colour.models.ragoo2021.IPT_Ragoo2021_to_XYZ` definition nan support. diff --git a/colour/models/tests/test_yrg.py b/colour/models/tests/test_yrg.py index c8d069b60..3df1f5f53 100644 --- a/colour/models/tests/test_yrg.py +++ b/colour/models/tests/test_yrg.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.models.yrg` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -34,7 +36,7 @@ class TestLMS_to_Yrg: methods. """ - def test_LMS_to_Yrg(self): + def test_LMS_to_Yrg(self) -> None: """Test :func:`colour.models.yrg.LMS_to_Yrg` definition.""" np.testing.assert_allclose( @@ -55,7 +57,7 @@ def test_LMS_to_Yrg(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_LMS_to_Yrg(self): + def test_n_dimensional_LMS_to_Yrg(self) -> None: """ Test :func:`colour.models.yrg.LMS_to_Yrg` definition n-dimensional support. @@ -72,7 +74,7 @@ def test_n_dimensional_LMS_to_Yrg(self): Yrg = np.reshape(Yrg, (2, 3, 3)) np.testing.assert_allclose(LMS_to_Yrg(LMS), Yrg, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_LMS_to_Yrg(self): + def test_domain_range_scale_LMS_to_Yrg(self) -> None: """ Test :func:`colour.models.yrg.LMS_to_Yrg` definition domain and range scale support. @@ -91,7 +93,7 @@ def test_domain_range_scale_LMS_to_Yrg(self): ) @ignore_numpy_errors - def test_nan_LMS_to_Yrg(self): + def test_nan_LMS_to_Yrg(self) -> None: """Test :func:`colour.models.yrg.LMS_to_Yrg` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -104,7 +106,7 @@ class TestYrg_to_LMS: Define :func:`colour.models.yrg.Yrg_to_LMS` definition unit tests methods. """ - def test_Yrg_to_LMS(self): + def test_Yrg_to_LMS(self) -> None: """Test :func:`colour.models.yrg.Yrg_to_LMS` definition.""" np.testing.assert_allclose( @@ -125,7 +127,7 @@ def test_Yrg_to_LMS(self): atol=1e-4, ) - def test_n_dimensional_Yrg_to_LMS(self): + def test_n_dimensional_Yrg_to_LMS(self) -> None: """ Test :func:`colour.models.yrg.Yrg_to_LMS` definition n-dimensional support. @@ -142,7 +144,7 @@ def test_n_dimensional_Yrg_to_LMS(self): LMS = np.reshape(LMS, (2, 3, 3)) np.testing.assert_allclose(Yrg_to_LMS(Yrg), LMS, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_Yrg_to_LMS(self): + def test_domain_range_scale_Yrg_to_LMS(self) -> None: """ Test :func:`colour.models.yrg.Yrg_to_LMS` definition domain and range scale support. @@ -161,7 +163,7 @@ def test_domain_range_scale_Yrg_to_LMS(self): ) @ignore_numpy_errors - def test_nan_Yrg_to_LMS(self): + def test_nan_Yrg_to_LMS(self) -> None: """Test :func:`colour.models.yrg.Yrg_to_LMS` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -175,7 +177,7 @@ class TestXYZ_to_Yrg: methods. """ - def test_XYZ_to_Yrg(self): + def test_XYZ_to_Yrg(self) -> None: """Test :func:`colour.models.yrg.XYZ_to_Yrg` definition.""" np.testing.assert_allclose( @@ -196,7 +198,7 @@ def test_XYZ_to_Yrg(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_Yrg(self): + def test_n_dimensional_XYZ_to_Yrg(self) -> None: """ Test :func:`colour.models.yrg.XYZ_to_Yrg` definition n-dimensional support. @@ -213,7 +215,7 @@ def test_n_dimensional_XYZ_to_Yrg(self): Yrg = np.reshape(Yrg, (2, 3, 3)) np.testing.assert_allclose(XYZ_to_Yrg(XYZ), Yrg, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_XYZ_to_Yrg(self): + def test_domain_range_scale_XYZ_to_Yrg(self) -> None: """ Test :func:`colour.models.yrg.XYZ_to_Yrg` definition domain and range scale support. @@ -232,7 +234,7 @@ def test_domain_range_scale_XYZ_to_Yrg(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_Yrg(self): + def test_nan_XYZ_to_Yrg(self) -> None: """Test :func:`colour.models.yrg.XYZ_to_Yrg` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] @@ -245,7 +247,7 @@ class TestYrg_to_XYZ: Define :func:`colour.models.yrg.Yrg_to_XYZ` definition unit tests methods. """ - def test_Yrg_to_XYZ(self): + def test_Yrg_to_XYZ(self) -> None: """Test :func:`colour.models.yrg.Yrg_to_XYZ` definition.""" np.testing.assert_allclose( @@ -266,7 +268,7 @@ def test_Yrg_to_XYZ(self): atol=2e-4, ) - def test_n_dimensional_Yrg_to_XYZ(self): + def test_n_dimensional_Yrg_to_XYZ(self) -> None: """ Test :func:`colour.models.yrg.Yrg_to_XYZ` definition n-dimensional support. @@ -283,7 +285,7 @@ def test_n_dimensional_Yrg_to_XYZ(self): XYZ = np.reshape(XYZ, (2, 3, 3)) np.testing.assert_allclose(Yrg_to_XYZ(Yrg), XYZ, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_Yrg_to_XYZ(self): + def test_domain_range_scale_Yrg_to_XYZ(self) -> None: """ Test :func:`colour.models.yrg.Yrg_to_XYZ` definition domain and range scale support. @@ -302,7 +304,7 @@ def test_domain_range_scale_Yrg_to_XYZ(self): ) @ignore_numpy_errors - def test_nan_Yrg_to_XYZ(self): + def test_nan_Yrg_to_XYZ(self) -> None: """Test :func:`colour.models.yrg.Yrg_to_XYZ` definition nan support.""" cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan] diff --git a/colour/notation/munsell.py b/colour/notation/munsell.py index 5867bcb62..a26bd322e 100644 --- a/colour/notation/munsell.py +++ b/colour/notation/munsell.py @@ -1949,7 +1949,7 @@ def hue_angle_to_hue(hue_angle: float) -> NDArrayFloat: return tstack(cast(ArrayLike, [hue, code])) -def hue_to_ASTM_hue(hue_and_code) -> float: +def hue_to_ASTM_hue(hue_and_code: ArrayLike) -> float: """ Convert from the *Munsell* *Colorlab* specification hue and *Munsell* *Colorlab* specification codeto *ASTM* hue number. diff --git a/colour/notation/tests/test_css_color_3.py b/colour/notation/tests/test_css_color_3.py index cdf898b18..d3f5bc037 100644 --- a/colour/notation/tests/test_css_color_3.py +++ b/colour/notation/tests/test_css_color_3.py @@ -25,7 +25,7 @@ class TestKeywordToRGBCSSColor3: definition unit tests methods. """ - def test_keyword_to_RGB_CSSColor3(self): + def test_keyword_to_RGB_CSSColor3(self) -> None: """ Test :func:`colour.notation.css_color_3.keyword_to_RGB_CSSColor3` definition. diff --git a/colour/notation/tests/test_hexadecimal.py b/colour/notation/tests/test_hexadecimal.py index 46c0719a0..ca97f3867 100644 --- a/colour/notation/tests/test_hexadecimal.py +++ b/colour/notation/tests/test_hexadecimal.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.notation.hexadecimal` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -30,7 +32,7 @@ class TestRGB_to_HEX: tests methods. """ - def test_RGB_to_HEX(self): + def test_RGB_to_HEX(self) -> None: """Test :func:`colour.notation.hexadecimal.RGB_to_HEX` definition.""" assert RGB_to_HEX(np.array([0.45620519, 0.03081071, 0.04091952])) == "#74070a" @@ -52,7 +54,7 @@ def test_RGB_to_HEX(self): ["#fe0e0e", "#0e0e0e", "#000e00"], ) - def test_n_dimensional_RGB_to_HEX(self): + def test_n_dimensional_RGB_to_HEX(self) -> None: """ Test :func:`colour.notation.hexadecimal.RGB_to_HEX` definition n-dimensional arrays support. @@ -69,7 +71,7 @@ def test_n_dimensional_RGB_to_HEX(self): HEX = np.reshape(HEX, (2, 3)) assert RGB_to_HEX(RGB).tolist() == HEX.tolist() - def test_domain_range_scale_RGB_to_HEX(self): + def test_domain_range_scale_RGB_to_HEX(self) -> None: """ Test :func:`colour.notation.hexadecimal.RGB_to_HEX` definition domain and range scale support. @@ -84,7 +86,7 @@ def test_domain_range_scale_RGB_to_HEX(self): assert RGB_to_HEX(RGB * factor) == HEX @ignore_numpy_errors - def test_nan_RGB_to_HEX(self): + def test_nan_RGB_to_HEX(self) -> None: """ Test :func:`colour.notation.hexadecimal.RGB_to_HEX` definition nan support. @@ -101,7 +103,7 @@ class TestHEX_to_RGB: tests methods. """ - def test_HEX_to_RGB(self): + def test_HEX_to_RGB(self) -> None: """Test :func:`colour.notation.hexadecimal.HEX_to_RGB` definition.""" np.testing.assert_allclose( @@ -122,7 +124,7 @@ def test_HEX_to_RGB(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_HEX_to_RGB(self): + def test_n_dimensional_HEX_to_RGB(self) -> None: """ Test :func:`colour.notation.hexadecimal.HEX_to_RGB` definition n-dimensional arrays support. @@ -139,7 +141,7 @@ def test_n_dimensional_HEX_to_RGB(self): RGB = np.reshape(RGB, (2, 3, 3)) np.testing.assert_allclose(HEX_to_RGB(HEX), RGB, atol=TOLERANCE_ABSOLUTE_TESTS) - def test_domain_range_scale_HEX_to_RGB(self): + def test_domain_range_scale_HEX_to_RGB(self) -> None: """ Test :func:`colour.notation.hexadecimal.HEX_to_RGB` definition domain and range scale support. diff --git a/colour/notation/tests/test_munsell.py b/colour/notation/tests/test_munsell.py index c5af0a8cf..a5723d2a6 100644 --- a/colour/notation/tests/test_munsell.py +++ b/colour/notation/tests/test_munsell.py @@ -1106,7 +1106,7 @@ class TestMunsellValuePriest1920: unit tests methods. """ - def test_munsell_value_Priest1920(self): + def test_munsell_value_Priest1920(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Priest1920` definition. @@ -1130,7 +1130,7 @@ def test_munsell_value_Priest1920(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_value_Priest1920(self): + def test_n_dimensional_munsell_value_Priest1920(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Priest1920` definition n-dimensional arrays support. @@ -1157,7 +1157,7 @@ def test_n_dimensional_munsell_value_Priest1920(self): munsell_value_Priest1920(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_munsell_value_Priest1920(self): + def test_domain_range_scale_munsell_value_Priest1920(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Priest1920` definition domain and range scale support. @@ -1176,7 +1176,7 @@ def test_domain_range_scale_munsell_value_Priest1920(self): ) @ignore_numpy_errors - def test_nan_munsell_value_Priest1920(self): + def test_nan_munsell_value_Priest1920(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Priest1920` definition nan support. @@ -1191,7 +1191,7 @@ class TestMunsellValueMunsell1933: definition unit tests methods. """ - def test_munsell_value_Munsell1933(self): + def test_munsell_value_Munsell1933(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Munsell1933` definition. @@ -1215,7 +1215,7 @@ def test_munsell_value_Munsell1933(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_value_Munsell1933(self): + def test_n_dimensional_munsell_value_Munsell1933(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Munsell1933` definition n-dimensional arrays support. @@ -1242,7 +1242,7 @@ def test_n_dimensional_munsell_value_Munsell1933(self): munsell_value_Munsell1933(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_munsell_value_Munsell1933(self): + def test_domain_range_scale_munsell_value_Munsell1933(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Munsell1933` definition domain and range scale support. @@ -1261,7 +1261,7 @@ def test_domain_range_scale_munsell_value_Munsell1933(self): ) @ignore_numpy_errors - def test_nan_munsell_value_Munsell1933(self): + def test_nan_munsell_value_Munsell1933(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Munsell1933` definition nan support. @@ -1276,7 +1276,7 @@ class TestMunsellValueMoon1943: unit tests methods. """ - def test_munsell_value_Moon1943(self): + def test_munsell_value_Moon1943(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Moon1943` definition. @@ -1300,7 +1300,7 @@ def test_munsell_value_Moon1943(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_value_Moon1943(self): + def test_n_dimensional_munsell_value_Moon1943(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Moon1943` definition n-dimensional arrays support. @@ -1327,7 +1327,7 @@ def test_n_dimensional_munsell_value_Moon1943(self): munsell_value_Moon1943(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_munsell_value_Moon1943(self): + def test_domain_range_scale_munsell_value_Moon1943(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Moon1943` definition domain and range scale support. @@ -1346,7 +1346,7 @@ def test_domain_range_scale_munsell_value_Moon1943(self): ) @ignore_numpy_errors - def test_nan_munsell_value_Moon1943(self): + def test_nan_munsell_value_Moon1943(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Moon1943` definition nan support. @@ -1361,7 +1361,7 @@ class TestMunsellValueSaunderson1944: definition unit tests methods. """ - def test_munsell_value_Saunderson1944(self): + def test_munsell_value_Saunderson1944(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Saunderson1944` definition. @@ -1385,7 +1385,7 @@ def test_munsell_value_Saunderson1944(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_value_Saunderson1944(self): + def test_n_dimensional_munsell_value_Saunderson1944(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Saunderson1944` definition n-dimensional arrays support. @@ -1412,7 +1412,7 @@ def test_n_dimensional_munsell_value_Saunderson1944(self): munsell_value_Saunderson1944(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_munsell_value_Saunderson1944(self): + def test_domain_range_scale_munsell_value_Saunderson1944(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Saunderson1944` definition domain and range scale support. @@ -1431,7 +1431,7 @@ def test_domain_range_scale_munsell_value_Saunderson1944(self): ) @ignore_numpy_errors - def test_nan_munsell_value_Saunderson1944(self): + def test_nan_munsell_value_Saunderson1944(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Saunderson1944` definition nan support. @@ -1448,7 +1448,7 @@ class TestMunsellValueLadd1955: unit tests methods. """ - def test_munsell_value_Ladd1955(self): + def test_munsell_value_Ladd1955(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Ladd1955` definition. @@ -1472,7 +1472,7 @@ def test_munsell_value_Ladd1955(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_value_Ladd1955(self): + def test_n_dimensional_munsell_value_Ladd1955(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Ladd1955` definition n-dimensional arrays support. @@ -1499,7 +1499,7 @@ def test_n_dimensional_munsell_value_Ladd1955(self): munsell_value_Ladd1955(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_munsell_value_Ladd1955(self): + def test_domain_range_scale_munsell_value_Ladd1955(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Ladd1955` definition domain and range scale support. @@ -1518,7 +1518,7 @@ def test_domain_range_scale_munsell_value_Ladd1955(self): ) @ignore_numpy_errors - def test_nan_munsell_value_Ladd1955(self): + def test_nan_munsell_value_Ladd1955(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_Ladd1955` definition nan support. @@ -1533,7 +1533,7 @@ class TestMunsellValueMcCamy1992: unit tests methods. """ - def test_munsell_value_McCamy1987(self): + def test_munsell_value_McCamy1987(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_McCamy1987` definition. @@ -1557,7 +1557,7 @@ def test_munsell_value_McCamy1987(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_value_McCamy1987(self): + def test_n_dimensional_munsell_value_McCamy1987(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_McCamy1987` definition n-dimensional arrays support. @@ -1584,7 +1584,7 @@ def test_n_dimensional_munsell_value_McCamy1987(self): munsell_value_McCamy1987(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_munsell_value_McCamy1987(self): + def test_domain_range_scale_munsell_value_McCamy1987(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_McCamy1987` definition domain and range scale support. @@ -1603,7 +1603,7 @@ def test_domain_range_scale_munsell_value_McCamy1987(self): ) @ignore_numpy_errors - def test_nan_munsell_value_McCamy1987(self): + def test_nan_munsell_value_McCamy1987(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_McCamy1987` definition nan support. @@ -1618,7 +1618,7 @@ class TestMunsellValueASTMD1535: definition unit tests methods. """ - def test_munsell_value_ASTMD1535(self): + def test_munsell_value_ASTMD1535(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition. @@ -1642,7 +1642,7 @@ def test_munsell_value_ASTMD1535(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_value_ASTMD1535(self): + def test_n_dimensional_munsell_value_ASTMD1535(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition n-dimensional arrays support. @@ -1669,7 +1669,7 @@ def test_n_dimensional_munsell_value_ASTMD1535(self): munsell_value_ASTMD1535(Y), V, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_domain_range_scale_munsell_value_ASTMD1535(self): + def test_domain_range_scale_munsell_value_ASTMD1535(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition domain and range scale support. @@ -1688,7 +1688,7 @@ def test_domain_range_scale_munsell_value_ASTMD1535(self): ) @ignore_numpy_errors - def test_nan_munsell_value_ASTMD1535(self): + def test_nan_munsell_value_ASTMD1535(self) -> None: """ Test :func:`colour.notation.munsell.munsell_value_ASTMD1535` definition nan support. @@ -1703,7 +1703,7 @@ class TestMunsellSpecification_to_xyY: definition unit tests methods. """ - def test_munsell_specification_to_xyY(self): + def test_munsell_specification_to_xyY(self) -> None: """ Test :func:`colour.notation.munsell.munsell_specification_to_xyY` definition. @@ -1733,7 +1733,7 @@ def test_munsell_specification_to_xyY(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_specification_to_xyY(self): + def test_n_dimensional_munsell_specification_to_xyY(self) -> None: """ Test :func:`colour.notation.munsell.munsell_specification_to_xyY` definition n-dimensional arrays support. @@ -1777,7 +1777,7 @@ def test_n_dimensional_munsell_specification_to_xyY(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_munsell_specification_to_xyY(self): + def test_domain_range_scale_munsell_specification_to_xyY(self) -> None: """ Test :func:`colour.notation.munsell.munsell_specification_to_xyY` definition domain and range scale support. @@ -1800,7 +1800,7 @@ def test_domain_range_scale_munsell_specification_to_xyY(self): ) @ignore_numpy_errors - def test_nan_munsell_specification_to_xyY(self): + def test_nan_munsell_specification_to_xyY(self) -> None: """ Test :func:`colour.notation.munsell.munsell_specification_to_xyY` definition nan support. @@ -1819,7 +1819,7 @@ class TestMunsellColour_to_xyY: unit tests methods. """ - def test_domain_range_scale_munsell_colour_to_xyY(self): + def test_domain_range_scale_munsell_colour_to_xyY(self) -> None: """ Test :func:`colour.notation.munsell.munsell_colour_to_xyY` definition domain and range scale support. @@ -1841,7 +1841,7 @@ def test_domain_range_scale_munsell_colour_to_xyY(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_munsell_colour_to_xyY(self): + def test_n_dimensional_munsell_colour_to_xyY(self) -> None: """ Test :func:`colour.notation.munsell.munsell_colour_to_xyY` definition n-dimensional arrays support. @@ -1892,7 +1892,7 @@ class TestxyY_to_munsell_specification: definition unit tests methods. """ - def test_xyY_to_munsell_specification(self): + def test_xyY_to_munsell_specification(self) -> None: """ Test :func:`colour.notation.munsell.xyY_to_munsell_specification` definition. @@ -1923,7 +1923,7 @@ def test_xyY_to_munsell_specification(self): atol=0.00001, ) - def test_n_dimensional_xyY_to_munsell_specification(self): + def test_n_dimensional_xyY_to_munsell_specification(self) -> None: """ Test :func:`colour.notation.munsell.xyY_to_munsell_specification` definition n-dimensional arrays support. @@ -1948,7 +1948,7 @@ def test_n_dimensional_xyY_to_munsell_specification(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_xyY_to_munsell_specification(self): + def test_raise_exception_xyY_to_munsell_specification(self) -> None: """ Test :func:`colour.notation.munsell.xyY_to_munsell_specification` definition raised exception. @@ -1960,7 +1960,7 @@ def test_raise_exception_xyY_to_munsell_specification(self): np.array([0.90615118, 0.57945103, 0.91984064]), ) - def test_domain_range_scale_xyY_to_munsell_specification(self): + def test_domain_range_scale_xyY_to_munsell_specification(self) -> None: """ Test :func:`colour.notation.munsell.xyY_to_munsell_specification` definition domain and range scale support. @@ -1983,7 +1983,7 @@ def test_domain_range_scale_xyY_to_munsell_specification(self): ) @ignore_numpy_errors - def test_nan_xyY_to_munsell_specification(self): + def test_nan_xyY_to_munsell_specification(self) -> None: """ Test :func:`colour.notation.munsell.xyY_to_munsell_specification` definition nan support. @@ -2002,7 +2002,7 @@ class TestxyY_to_munsell_colour: unit tests methods. """ - def test_domain_range_scale_xyY_to_munsell_colour(self): + def test_domain_range_scale_xyY_to_munsell_colour(self) -> None: """ Test :func:`colour.notation.munsell.xyY_to_munsell_colour` definition domain and range scale support. @@ -2020,7 +2020,7 @@ def test_domain_range_scale_xyY_to_munsell_colour(self): with domain_range_scale(scale): assert xyY_to_munsell_colour(xyY * factor) == munsell_colour - def test_n_dimensional_xyY_to_munsell_colour(self): + def test_n_dimensional_xyY_to_munsell_colour(self) -> None: """ Test :func:`colour.notation.munsell.xyY_to_munsell_colour` definition n-dimensional arrays support. @@ -2055,7 +2055,7 @@ class TestParseMunsellColour: unit tests methods. """ - def test_parse_munsell_colour(self): + def test_parse_munsell_colour(self) -> None: """ Test :func:`colour.notation.munsell.is_grey_munsell_colour` definition. @@ -2079,7 +2079,7 @@ def test_parse_munsell_colour(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_parse_munsell_colour(self): + def test_raise_exception_parse_munsell_colour(self) -> None: """ Test :func:`colour.notation.munsell.is_grey_munsell_colour` definition raised exception. @@ -2094,7 +2094,7 @@ class TestIsGreyMunsellColour: unit tests methods. """ - def test_is_grey_munsell_colour(self): + def test_is_grey_munsell_colour(self) -> None: """ Test :func:`colour.notation.munsell.is_grey_munsell_colour` definition. @@ -2115,7 +2115,7 @@ class TestNormaliseMunsellSpecification: definition unit tests methods. """ - def test_normalise_munsell_specification(self): + def test_normalise_munsell_specification(self) -> None: """ Test :func:`colour.notation.munsell.normalise_munsell_specification` definition. @@ -2152,7 +2152,7 @@ class TestMunsellColourToMunsellSpecification: munsell_colour_to_munsell_specification` definition unit tests methods. """ - def test_munsell_colour_to_munsell_specification(self): + def test_munsell_colour_to_munsell_specification(self) -> None: """ Test :func:`colour.notation.munsell.\ munsell_colour_to_munsell_specification` definition. @@ -2195,7 +2195,7 @@ class TestMunsellSpecificationToMunsellColour: munsell_specification_to_munsell_colour` definition unit tests methods. """ - def test_munsell_specification_to_munsell_colour(self): + def test_munsell_specification_to_munsell_colour(self) -> None: """ Test :func:`colour.notation.munsell.\ munsell_specification_to_munsell_colour` definition. @@ -2240,7 +2240,7 @@ class Test_xyY_fromRenotation: unit tests methods. """ - def test_xyY_from_renotation(self): + def test_xyY_from_renotation(self) -> None: """ Test :func:`colour.notation.munsell.xyY_from_renotation` definition. @@ -2268,7 +2268,7 @@ class TestIsSpecificationInRenotation: definition unit tests methods. """ - def test_is_specification_in_renotation(self): + def test_is_specification_in_renotation(self) -> None: """ Test :func:`colour.notation.munsell.is_specification_in_renotation` definition. @@ -2287,7 +2287,7 @@ class TestBoundingHuesFromRenotation: definition unit tests methods. """ - def test_bounding_hues_from_renotation(self): + def test_bounding_hues_from_renotation(self) -> None: """ Test :func:`colour.notation.munsell.bounding_hues_from_renotation` definition. @@ -2307,7 +2307,7 @@ class TestHueToHueAngle: tests methods. """ - def test_hue_to_hue_angle(self): + def test_hue_to_hue_angle(self) -> None: """Test :func:`colour.notation.munsell.hue_to_hue_angle` definition.""" for hue, code, angle in MUNSELL_HUE_TO_ANGLE: @@ -2320,7 +2320,7 @@ class TestHueAngleToHue: tests methods. """ - def test_hue_angle_to_hue(self): + def test_hue_angle_to_hue(self) -> None: """Test :func:`colour.notation.munsell.hue_angle_to_hue` definition.""" for hue, code, angle in MUNSELL_HUE_TO_ANGLE: @@ -2333,7 +2333,7 @@ class TestHueTo_ASTM_hue: tests methods. """ - def test_hue_to_ASTM_hue(self): + def test_hue_to_ASTM_hue(self) -> None: """Test :func:`colour.notation.munsell.hue_to_ASTM_hue` definition.""" for hue, code, angle in MUNSELL_HUE_TO_ASTM_HUE: @@ -2346,7 +2346,7 @@ class TestInterpolationMethodFromRenotationOvoid: interpolation_method_from_renotation_ovoid` definition unit tests methods. """ - def test_interpolation_method_from_renotation_ovoid(self): + def test_interpolation_method_from_renotation_ovoid(self) -> None: """ Test :func:`colour.notation.munsell.\ interpolation_method_from_renotation_ovoid` definition. @@ -2377,7 +2377,7 @@ class Test_xy_fromRenotationOvoid: unit tests methods. """ - def test_xy_from_renotation_ovoid(self): + def test_xy_from_renotation_ovoid(self) -> None: """ Test :func:`colour.notation.munsell.xy_from_renotation_ovoid` definition. @@ -2398,7 +2398,7 @@ class TestLCHabToMunsellSpecification: definition unit tests methods. """ - def test_LCHab_to_munsell_specification(self): + def test_LCHab_to_munsell_specification(self) -> None: """ Test :func:`colour.notation.munsell.LCHab_to_munsell_specification` definition. @@ -2451,7 +2451,7 @@ class TestMaximumChromaFromRenotation: definition unit tests methods. """ - def test_maximum_chroma_from_renotation(self): + def test_maximum_chroma_from_renotation(self) -> None: """ Test :func:`colour.notation.munsell.maximum_chroma_from_renotation` definition. @@ -2470,7 +2470,7 @@ class TestMunsellSpecification_to_xy: definition unit tests methods. """ - def test_munsell_specification_to_xy(self): + def test_munsell_specification_to_xy(self) -> None: """ Test :func:`colour.notation.munsell.munsell_specification_to_xy` definition. diff --git a/colour/phenomena/tests/test_rayleigh.py b/colour/phenomena/tests/test_rayleigh.py index 7680c311a..75dc4b393 100644 --- a/colour/phenomena/tests/test_rayleigh.py +++ b/colour/phenomena/tests/test_rayleigh.py @@ -485,7 +485,7 @@ class TestAirRefractionIndexPenndorf1957: air_refraction_index_Penndorf1957` definition unit tests methods. """ - def test_air_refraction_index_Penndorf1957(self): + def test_air_refraction_index_Penndorf1957(self) -> None: """ Test :func:`colour.phenomena.rayleigh.\ air_refraction_index_Penndorf1957` definition. @@ -509,7 +509,7 @@ def test_air_refraction_index_Penndorf1957(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_air_refraction_index_Penndorf1957(self): + def test_n_dimensional_air_refraction_index_Penndorf1957(self) -> None: """ Test :func:`colour.phenomena.rayleigh.\ air_refraction_index_Penndorf1957` definition n-dimensional arrays support. @@ -543,7 +543,7 @@ def test_n_dimensional_air_refraction_index_Penndorf1957(self): ) @ignore_numpy_errors - def test_nan_air_refraction_index_Penndorf1957(self): + def test_nan_air_refraction_index_Penndorf1957(self) -> None: """ Test :func:`colour.phenomena.rayleigh.\ air_refraction_index_Penndorf1957` definition nan support. @@ -560,7 +560,7 @@ class TestAirRefractionIndexEdlen1966: definition unit tests methods. """ - def test_air_refraction_index_Edlen1966(self): + def test_air_refraction_index_Edlen1966(self) -> None: """ Test :func:`colour.phenomena.\ rayleigh.air_refraction_index_Edlen1966` definition. @@ -584,7 +584,7 @@ def test_air_refraction_index_Edlen1966(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_air_refraction_index_Edlen1966(self): + def test_n_dimensional_air_refraction_index_Edlen1966(self) -> None: """ Test :func:`colour.phenomena.rayleigh.\ air_refraction_index_Edlen1966` definition n-dimensional arrays support. @@ -618,7 +618,7 @@ def test_n_dimensional_air_refraction_index_Edlen1966(self): ) @ignore_numpy_errors - def test_nan_air_refraction_index_Edlen1966(self): + def test_nan_air_refraction_index_Edlen1966(self) -> None: """ Test :func:`colour.phenomena.rayleigh.\ air_refraction_index_Edlen1966` definition nan support. @@ -635,7 +635,7 @@ class TestAirRefractionIndexPeck1972: definition unit tests methods. """ - def test_air_refraction_index_Peck1972(self): + def test_air_refraction_index_Peck1972(self) -> None: """ Test :func:`colour.phenomena.rayleigh.air_refraction_index_Peck1972` definition. @@ -659,7 +659,7 @@ def test_air_refraction_index_Peck1972(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_air_refraction_index_Peck1972(self): + def test_n_dimensional_air_refraction_index_Peck1972(self) -> None: """ Test :func:`colour.phenomena.rayleigh.air_refraction_index_Peck1972` definition n-dimensional arrays support. @@ -687,7 +687,7 @@ def test_n_dimensional_air_refraction_index_Peck1972(self): ) @ignore_numpy_errors - def test_nan_air_refraction_index_Peck1972(self): + def test_nan_air_refraction_index_Peck1972(self) -> None: """ Test :func:`colour.phenomena.rayleigh.air_refraction_index_Peck1972` definition nan support. @@ -704,7 +704,7 @@ class TestAirRefractionIndexBodhaine1999: air_refraction_index_Bodhaine1999` definition unit tests methods. """ - def test_air_refraction_index_Bodhaine1999(self): + def test_air_refraction_index_Bodhaine1999(self) -> None: """ Test :func:`colour.phenomena.rayleigh.\ air_refraction_index_Bodhaine1999` definition. @@ -746,7 +746,7 @@ def test_air_refraction_index_Bodhaine1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_air_refraction_index_Bodhaine1999(self): + def test_n_dimensional_air_refraction_index_Bodhaine1999(self) -> None: """ Test :func:`colour.phenomena.rayleigh.\ air_refraction_index_Bodhaine1999` definition n-dimensional arrays support. @@ -780,7 +780,7 @@ def test_n_dimensional_air_refraction_index_Bodhaine1999(self): ) @ignore_numpy_errors - def test_nan_air_refraction_index_Bodhaine1999(self): + def test_nan_air_refraction_index_Bodhaine1999(self) -> None: """ Test :func:`colour.phenomena.rayleigh.\ air_refraction_index_Bodhaine1999` definition nan support. @@ -796,7 +796,7 @@ class TestN2Depolarisation: unit tests methods. """ - def test_N2_depolarisation(self): + def test_N2_depolarisation(self) -> None: """Test :func:`colour.phenomena.rayleigh.N2_depolarisation` definition.""" np.testing.assert_allclose( @@ -817,7 +817,7 @@ def test_N2_depolarisation(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_N2_depolarisation(self): + def test_n_dimensional_N2_depolarisation(self) -> None: """ Test :func:`colour.phenomena.rayleigh.N2_depolarisation` definition n-dimensional arrays support. @@ -845,7 +845,7 @@ def test_n_dimensional_N2_depolarisation(self): ) @ignore_numpy_errors - def test_nan_N2_depolarisation(self): + def test_nan_N2_depolarisation(self) -> None: """ Test :func:`colour.phenomena.rayleigh.N2_depolarisation` definition nan support. @@ -860,7 +860,7 @@ class TestO2Depolarisation: unit tests methods. """ - def test_O2_depolarisation(self): + def test_O2_depolarisation(self) -> None: """Test :func:`colour.phenomena.rayleigh.O2_depolarisation` definition.""" np.testing.assert_allclose( @@ -881,7 +881,7 @@ def test_O2_depolarisation(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_O2_depolarisation(self): + def test_n_dimensional_O2_depolarisation(self) -> None: """ Test :func:`colour.phenomena.rayleigh.O2_depolarisation` definition n-dimensional arrays support. @@ -909,7 +909,7 @@ def test_n_dimensional_O2_depolarisation(self): ) @ignore_numpy_errors - def test_nan_O2_depolarisation(self): + def test_nan_O2_depolarisation(self) -> None: """ Test :func:`colour.phenomena.rayleigh.O2_depolarisation` definition nan support. @@ -924,7 +924,7 @@ class TestF_airPenndorf1957: unit tests methods. """ - def test_F_air_Penndorf1957(self): + def test_F_air_Penndorf1957(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Penndorf1957` definition. @@ -932,7 +932,7 @@ def test_F_air_Penndorf1957(self): assert F_air_Penndorf1957(0.360) == 1.0608 - def test_n_dimensional_F_air_Penndorf1957(self): + def test_n_dimensional_F_air_Penndorf1957(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Penndorf1957` definition n-dimensional arrays support. @@ -960,7 +960,7 @@ def test_n_dimensional_F_air_Penndorf1957(self): ) @ignore_numpy_errors - def test_nan_F_air_Penndorf1957(self): + def test_nan_F_air_Penndorf1957(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Penndorf1957` definition nan support. @@ -975,12 +975,12 @@ class TestF_airYoung1981: unit tests methods. """ - def test_F_air_Young1981(self): + def test_F_air_Young1981(self) -> None: """Test :func:`colour.phenomena.rayleigh.F_air_Young1981` definition.""" assert F_air_Young1981(0.360) == 1.0480 - def test_n_dimensional_F_air_Young1981(self): + def test_n_dimensional_F_air_Young1981(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Young1981` definition n-dimensional arrays support. @@ -1008,7 +1008,7 @@ def test_n_dimensional_F_air_Young1981(self): ) @ignore_numpy_errors - def test_nan_F_air_Young1981(self): + def test_nan_F_air_Young1981(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Young1981` definition nan support. @@ -1023,7 +1023,7 @@ class TestF_airBates1984: tests methods. """ - def test_F_air_Bates1984(self): + def test_F_air_Bates1984(self) -> None: """Test :func:`colour.phenomena.rayleigh.F_air_Bates1984` definition.""" np.testing.assert_allclose( @@ -1044,7 +1044,7 @@ def test_F_air_Bates1984(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_F_air_Bates1984(self): + def test_n_dimensional_F_air_Bates1984(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Bates1984` definition n-dimensional arrays support. @@ -1072,7 +1072,7 @@ def test_n_dimensional_F_air_Bates1984(self): ) @ignore_numpy_errors - def test_nan_F_air_Bates1984(self): + def test_nan_F_air_Bates1984(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Bates1984` definition nan support. @@ -1087,7 +1087,7 @@ class TestF_airBodhaine1999: unit tests methods. """ - def test_F_air_Bodhaine1999(self): + def test_F_air_Bodhaine1999(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Bodhaine1999` definition. @@ -1129,7 +1129,7 @@ def test_F_air_Bodhaine1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_F_air_Bodhaine1999(self): + def test_n_dimensional_F_air_Bodhaine1999(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Bodhaine1999` definition n-dimensional arrays support. @@ -1157,7 +1157,7 @@ def test_n_dimensional_F_air_Bodhaine1999(self): ) @ignore_numpy_errors - def test_nan_F_air_Bodhaine1999(self): + def test_nan_F_air_Bodhaine1999(self) -> None: """ Test :func:`colour.phenomena.rayleigh.F_air_Bodhaine1999` definition nan support. @@ -1173,7 +1173,7 @@ class TestMolecularDensity: unit tests methods. """ - def test_molecular_density(self): + def test_molecular_density(self) -> None: """Test :func:`colour.phenomena.rayleigh.molecular_density` definition.""" np.testing.assert_allclose( @@ -1188,7 +1188,7 @@ def test_molecular_density(self): molecular_density(400), 1.834724604086825e19, atol=10000 ) - def test_n_dimensional_molecular_density(self): + def test_n_dimensional_molecular_density(self) -> None: """ Test :func:`colour.phenomena.rayleigh.molecular_density` definition n-dimensional arrays support. @@ -1216,7 +1216,7 @@ def test_n_dimensional_molecular_density(self): ) @ignore_numpy_errors - def test_nan_molecular_density(self): + def test_nan_molecular_density(self) -> None: """ Test :func:`colour.phenomena.rayleigh.molecular_density` definition nan support. @@ -1231,7 +1231,7 @@ class TestMeanMolecularWeights: definition unit tests methods. """ - def test_mean_molecular_weights(self): + def test_mean_molecular_weights(self) -> None: """ Test :func:`colour.phenomena.rayleigh.mean_molecular_weights` definition. @@ -1253,7 +1253,7 @@ def test_mean_molecular_weights(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_mean_molecular_weights(self): + def test_n_dimensional_mean_molecular_weights(self) -> None: """ Test :func:`colour.phenomena.rayleigh.mean_molecular_weights` definition n-dimensional arrays support. @@ -1281,7 +1281,7 @@ def test_n_dimensional_mean_molecular_weights(self): ) @ignore_numpy_errors - def test_nan_mean_molecular_weights(self): + def test_nan_mean_molecular_weights(self) -> None: """ Test :func:`colour.phenomena.rayleigh.mean_molecular_weights` definition nan support. @@ -1296,7 +1296,7 @@ class TestGravityList1968: unit tests methods. """ - def test_gravity_List1968(self): + def test_gravity_List1968(self) -> None: """Test :func:`colour.phenomena.rayleigh.gravity_List1968` definition.""" np.testing.assert_allclose( @@ -1317,7 +1317,7 @@ def test_gravity_List1968(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_gravity_List1968(self): + def test_n_dimensional_gravity_List1968(self) -> None: """ Test :func:`colour.phenomena.rayleigh.gravity_List1968` definition n-dimensional arrays support. @@ -1336,7 +1336,7 @@ def test_n_dimensional_gravity_List1968(self): np.testing.assert_allclose(gravity_List1968(), g, atol=TOLERANCE_ABSOLUTE_TESTS) @ignore_numpy_errors - def test_nan_gravity_List1968(self): + def test_nan_gravity_List1968(self) -> None: """ Test :func:`colour.phenomena.rayleigh.gravity_List1968` definition nan support. @@ -1352,7 +1352,7 @@ class TestScatteringCrossSection: definition unit tests methods. """ - def test_scattering_cross_section(self): + def test_scattering_cross_section(self) -> None: """ Test :func:`colour.phenomena.rayleigh.scattering_cross_section` definition. @@ -1412,7 +1412,7 @@ def test_scattering_cross_section(self): atol=1e-30, ) - def test_n_dimensional_scattering_cross_section(self): + def test_n_dimensional_scattering_cross_section(self) -> None: """ Test :func:`colour.phenomena.rayleigh.scattering_cross_section` definition n-dimensional arrays support. @@ -1437,7 +1437,7 @@ def test_n_dimensional_scattering_cross_section(self): ) @ignore_numpy_errors - def test_nan_scattering_cross_section(self): + def test_nan_scattering_cross_section(self) -> None: """ Test :func:`colour.phenomena.rayleigh.scattering_cross_section` definition nan support. @@ -1453,7 +1453,7 @@ class TestRayleighOpticalDepth: definition unit tests methods. """ - def test_rayleigh_optical_depth(self): + def test_rayleigh_optical_depth(self) -> None: """ Test :func:`colour.phenomena.rayleigh.rayleigh_optical_depth` definition. @@ -1549,7 +1549,7 @@ def test_rayleigh_optical_depth(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_rayleigh_optical_depth(self): + def test_n_dimensional_rayleigh_optical_depth(self) -> None: """ Test :func:`colour.phenomena.rayleigh.rayleigh_optical_depth` definition n-dimensional arrays support. @@ -1574,7 +1574,7 @@ def test_n_dimensional_rayleigh_optical_depth(self): ) @ignore_numpy_errors - def test_nan_rayleigh_optical_depth(self): + def test_nan_rayleigh_optical_depth(self) -> None: """ Test :func:`colour.phenomena.rayleigh.rayleigh_optical_depth` definition nan support. @@ -1590,7 +1590,7 @@ class TestSdRayleighScattering: definition unit tests methods. """ - def test_sd_rayleigh_scattering(self): + def test_sd_rayleigh_scattering(self) -> None: """ Test :func:`colour.phenomena.rayleigh.sd_rayleigh_scattering` definition. diff --git a/colour/plotting/colorimetry.py b/colour/plotting/colorimetry.py index 105a5d65e..28b2dfff6 100644 --- a/colour/plotting/colorimetry.py +++ b/colour/plotting/colorimetry.py @@ -26,6 +26,7 @@ from __future__ import annotations +from collections.abc import ValuesView from functools import reduce import matplotlib.pyplot as plt @@ -268,6 +269,7 @@ def plot_multi_sds( Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), plot_kwargs: dict | List[dict] | None = None, **kwargs: Any, diff --git a/colour/plotting/common.py b/colour/plotting/common.py index 89fb76221..cf6696982 100644 --- a/colour/plotting/common.py +++ b/colour/plotting/common.py @@ -68,6 +68,7 @@ LiteralRGBColourspace, Mapping, NDArrayFloat, + Real, Sequence, Tuple, TypedDict, @@ -776,7 +777,7 @@ def render( def label_rectangles( - labels: Sequence[str], + labels: Sequence[str | Real], rectangles: Sequence[Patch], rotation: Literal["horizontal", "vertical"] | str = "vertical", text_size: float = CONSTANTS_COLOUR_STYLE.font.scaling.medium, @@ -847,7 +848,7 @@ def label_rectangles( return figure, axes -def uniform_axes3d(**kwargs: Any) -> Tuple[Figure, Axes]: +def uniform_axes3d(**kwargs: Any) -> Tuple[Figure, Axes3D]: """ Set equal aspect ratio to given 3d axes. @@ -1133,7 +1134,7 @@ def update_settings_collection( settings_collection: dict | List[dict], keyword_arguments: dict | List[dict], expected_count: int, -): +) -> None: """ Update given settings collection, *in-place*, with given keyword arguments and expected count of settings collection elements. @@ -1233,7 +1234,7 @@ def plot_single_colour_swatch( } ) def plot_multi_colour_swatches( - colour_swatches: Sequence[ArrayLike | ColourSwatch], + colour_swatches: ArrayLike | Sequence[ArrayLike | ColourSwatch], width: float = 1, height: float = 1, spacing: float = 0, @@ -1318,7 +1319,7 @@ def plot_multi_colour_swatches( _figure, axes = artist(**kwargs) # Handling case where `colour_swatches` is a regular *ArrayLike*. - colour_swatches = list(colour_swatches) + colour_swatches = list(colour_swatches) # pyright: ignore colour_swatches_converted = [] if not isinstance(first_item(colour_swatches), ColourSwatch): for _i, colour_swatch in enumerate( diff --git a/colour/plotting/diagrams.py b/colour/plotting/diagrams.py index bfe10c4e3..f74619748 100644 --- a/colour/plotting/diagrams.py +++ b/colour/plotting/diagrams.py @@ -16,6 +16,7 @@ from __future__ import annotations import bisect +from collections.abc import ValuesView import numpy as np from matplotlib.axes import Axes @@ -881,6 +882,7 @@ def plot_sds_in_chromaticity_diagram( Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), cmfs: ( MultiSpectralDistributions | str | Sequence[MultiSpectralDistributions | str] @@ -1103,7 +1105,9 @@ def plot_sds_in_chromaticity_diagram( def plot_sds_in_chromaticity_diagram_CIE1931( sds: ( Sequence[SpectralDistribution | MultiSpectralDistributions] + | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), cmfs: ( MultiSpectralDistributions | str | Sequence[MultiSpectralDistributions | str] @@ -1213,7 +1217,9 @@ class instances or a list of :class:`colour.SpectralDistribution` class def plot_sds_in_chromaticity_diagram_CIE1960UCS( sds: ( Sequence[SpectralDistribution | MultiSpectralDistributions] + | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), cmfs: ( MultiSpectralDistributions | str | Sequence[MultiSpectralDistributions | str] @@ -1324,7 +1330,9 @@ class instances or a list of :class:`colour.SpectralDistribution` class def plot_sds_in_chromaticity_diagram_CIE1976UCS( sds: ( Sequence[SpectralDistribution | MultiSpectralDistributions] + | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), cmfs: ( MultiSpectralDistributions | str | Sequence[MultiSpectralDistributions | str] diff --git a/colour/plotting/models.py b/colour/plotting/models.py index 3bc8d3147..e2e256543 100644 --- a/colour/plotting/models.py +++ b/colour/plotting/models.py @@ -70,6 +70,7 @@ Literal, LiteralColourspaceModel, LiteralRGBColourspace, + NDArray, NDArrayFloat, Sequence, Tuple, @@ -264,7 +265,7 @@ def colourspace_model_axis_reorder( def lines_pointer_gamut( method: (Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] | str) = "CIE 1931", -): +) -> tuple[NDArray, NDArray]: """ Return the *Pointer's Gamut* line vertices, i.e., positions, normals and colours, according to given method. diff --git a/colour/plotting/quality.py b/colour/plotting/quality.py index 5bbd3ac55..5bc3af990 100644 --- a/colour/plotting/quality.py +++ b/colour/plotting/quality.py @@ -12,6 +12,7 @@ from __future__ import annotations +from collections.abc import ValuesView from itertools import cycle import numpy as np @@ -288,6 +289,7 @@ def plot_multi_sds_colour_rendering_indexes_bars( Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), **kwargs: Any, ) -> Tuple[Figure, Axes]: @@ -422,6 +424,7 @@ def plot_multi_sds_colour_quality_scales_bars( Sequence[SpectralDistribution | MultiSpectralDistributions] | SpectralDistribution | MultiSpectralDistributions + | ValuesView ), method: Literal["NIST CQS 7.4", "NIST CQS 9.0"] | str = "NIST CQS 9.0", **kwargs: Any, diff --git a/colour/plotting/temperature.py b/colour/plotting/temperature.py index aa5361f1d..b7bd5d12e 100644 --- a/colour/plotting/temperature.py +++ b/colour/plotting/temperature.py @@ -33,6 +33,7 @@ List, Literal, NDArray, + NDArrayFloat, Sequence, Tuple, cast, @@ -123,7 +124,7 @@ def lines_daylight_locus( xy_to_ij = METHODS_CHROMATICITY_DIAGRAM[method]["xy_to_ij"] - def CCT_to_plotting_colourspace(CCT): + def CCT_to_plotting_colourspace(CCT: ArrayLike) -> NDArrayFloat: """ Convert given correlated colour temperature :math:`T_{cp}` to the default plotting colourspace. @@ -305,7 +306,7 @@ def lines_planckian_locus( uv_to_ij = METHODS_CHROMATICITY_DIAGRAM[method]["uv_to_ij"] - def CCT_D_uv_to_plotting_colourspace(CCT_D_uv): + def CCT_D_uv_to_plotting_colourspace(CCT_D_uv: ArrayLike) -> NDArrayFloat: """ Convert given correlated colour temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` to the default plotting colourspace. diff --git a/colour/plotting/tests/test_blindness.py b/colour/plotting/tests/test_blindness.py index 77e82d004..d9eb076d9 100644 --- a/colour/plotting/tests/test_blindness.py +++ b/colour/plotting/tests/test_blindness.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.blindness` module.""" +from __future__ import annotations + import numpy as np from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -24,7 +26,7 @@ class TestPlotCvdSimulationMachado2009: definition unit tests methods. """ - def test_plot_cvd_simulation_Machado2009(self): + def test_plot_cvd_simulation_Machado2009(self) -> None: """ Test :func:`colour.plotting.blindness.plot_cvd_simulation_Machado2009` definition. diff --git a/colour/plotting/tests/test_characterisation.py b/colour/plotting/tests/test_characterisation.py index 0fa362031..5186bd32a 100644 --- a/colour/plotting/tests/test_characterisation.py +++ b/colour/plotting/tests/test_characterisation.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.characterisation` module.""" +from __future__ import annotations + from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -27,7 +29,7 @@ class TestPlotSingleColourChecker: definition unit tests methods. """ - def test_plot_single_colour_checker(self): + def test_plot_single_colour_checker(self) -> None: """ Test :func:`colour.plotting.characterisation.\ plot_single_colour_checker` definition. @@ -45,7 +47,7 @@ class TestPlotMultiColourCheckers: definition unit tests methods. """ - def test_plot_multi_colour_checkers(self): + def test_plot_multi_colour_checkers(self) -> None: """ Test :func:`colour.plotting.characterisation.\ plot_multi_colour_checkers` definition. diff --git a/colour/plotting/tests/test_colorimetry.py b/colour/plotting/tests/test_colorimetry.py index 9b82c9405..5dc208872 100644 --- a/colour/plotting/tests/test_colorimetry.py +++ b/colour/plotting/tests/test_colorimetry.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.colorimetry` module.""" +from __future__ import annotations + from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -50,7 +52,7 @@ class TestPlotSingleSd: tests methods. """ - def test_plot_single_sd(self): + def test_plot_single_sd(self) -> None: """Test :func:`colour.plotting.colorimetry.plot_single_sd` definition.""" sd = SpectralDistribution( @@ -83,7 +85,7 @@ class TestPlotMultiSds: tests methods. """ - def test_plot_multi_sds(self): + def test_plot_multi_sds(self) -> None: """Test :func:`colour.plotting.colorimetry.plot_multi_sds` definition.""" sd_1 = SpectralDistribution( @@ -134,7 +136,7 @@ class TestPlotSingleCmfs: unit tests methods. """ - def test_plot_single_cmfs(self): + def test_plot_single_cmfs(self) -> None: """Test :func:`colour.plotting.colorimetry.plot_single_cmfs` definition.""" figure, axes = plot_single_cmfs() @@ -149,7 +151,7 @@ class TestPlotMultiCmfs: tests methods. """ - def test_plot_multi_cmfs(self): + def test_plot_multi_cmfs(self) -> None: """Test :func:`colour.plotting.colorimetry.plot_multi_cmfs` definition.""" figure, axes = plot_multi_cmfs( @@ -169,7 +171,7 @@ class TestPlotSingleIlluminantSd: definition unit tests methods. """ - def test_plot_single_illuminant_sd(self): + def test_plot_single_illuminant_sd(self) -> None: """ Test :func:`colour.plotting.colorimetry.plot_single_illuminant_sd` definition. @@ -187,7 +189,7 @@ class TestPlotMultiIlluminantSds: definition unit tests methods. """ - def test_plot_multi_illuminant_sds(self): + def test_plot_multi_illuminant_sds(self) -> None: """ Test :func:`colour.plotting.colorimetry.plot_multi_illuminant_sds` definition. @@ -213,7 +215,7 @@ class TestPlotVisibleSpectrum: definition unit tests methods. """ - def test_plot_visible_spectrum(self): + def test_plot_visible_spectrum(self) -> None: """ Test :func:`colour.plotting.colorimetry.plot_visible_spectrum` definition. @@ -231,7 +233,7 @@ class TestPlotSingleLightnessFunction: definition unit tests methods. """ - def test_plot_single_lightness_function(self): + def test_plot_single_lightness_function(self) -> None: """ Test :func:`colour.plotting.colorimetry.\ plot_single_lightness_function` definition. @@ -249,7 +251,7 @@ class TestPlotMultiLightnessFunctions: definition unit tests methods. """ - def test_plot_multi_lightness_functions(self): + def test_plot_multi_lightness_functions(self) -> None: """ Test :func:`colour.plotting.colorimetry.\ plot_multi_lightness_functions` definition. @@ -267,7 +269,7 @@ class TestPlotSingleLuminanceFunction: definition unit tests methods. """ - def test_plot_single_luminance_function(self): + def test_plot_single_luminance_function(self) -> None: """ Test :func:`colour.plotting.colorimetry.\ plot_single_luminance_function` definition. @@ -285,7 +287,7 @@ class TestPlotMultiLuminanceFunctions: definition unit tests methods. """ - def test_plot_multi_luminance_functions(self): + def test_plot_multi_luminance_functions(self) -> None: """ Test :func:`colour.plotting.colorimetry.\ plot_multi_luminance_functions` definition. @@ -303,7 +305,7 @@ class TestPlotBlackbodySpectralRadiance: plot_blackbody_spectral_radiance` definition unit tests methods. """ - def test_plot_blackbody_spectral_radiance(self): + def test_plot_blackbody_spectral_radiance(self) -> None: """ Test :func:`colour.plotting.colorimetry.\ plot_blackbody_spectral_radiance` definition. @@ -321,7 +323,7 @@ class TestPlotBlackbodyColours: definition unit tests methods. """ - def test_plot_blackbody_colours(self): + def test_plot_blackbody_colours(self) -> None: """ Test :func:`colour.plotting.colorimetry.plot_blackbody_colours` definition. diff --git a/colour/plotting/tests/test_common.py b/colour/plotting/tests/test_common.py index 350f3b54a..52ffae485 100644 --- a/colour/plotting/tests/test_common.py +++ b/colour/plotting/tests/test_common.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.common` module.""" +from __future__ import annotations + import os import shutil import tempfile @@ -10,10 +12,12 @@ import numpy as np from matplotlib.axes import Axes from matplotlib.figure import Figure +from mpl_toolkits.mplot3d.axes3d import Axes3D import colour from colour.colorimetry import SDS_ILLUMINANTS from colour.constants import TOLERANCE_ABSOLUTE_TESTS +from colour.hints import List, cast from colour.io import read_image from colour.models import RGB_COLOURSPACES, XYZ_to_sRGB, gamma_function from colour.plotting import ( @@ -80,7 +84,7 @@ class TestColourStyle: methods. """ - def test_colour_style(self): + def test_colour_style(self) -> None: """Test :func:`colour.plotting.common.colour_style` definition.""" assert isinstance(colour_style(use_style=False), dict) @@ -92,14 +96,14 @@ class TestOverrideStyle: methods. """ - def test_override_style(self): + def test_override_style(self) -> None: """Test :func:`colour.plotting.common.override_style` definition.""" text_color = plt.rcParams["text.color"] try: @override_style(**{"text.color": "red"}) - def test_text_color_override(): + def test_text_color_override() -> None: """Test :func:`colour.plotting.common.override_style` definition.""" attest(plt.rcParams["text.color"] == "red") @@ -115,7 +119,7 @@ class TestFontScaling: methods. """ - def test_font_scaling(self): + def test_font_scaling(self) -> None: """Test :func:`colour.plotting.common.font_scaling` definition.""" with font_scaling("medium-colour-science", 2): @@ -130,7 +134,7 @@ class TestXYZToPlottingColourspace: definition unit tests methods. """ - def test_XYZ_to_plotting_colourspace(self): + def test_XYZ_to_plotting_colourspace(self) -> None: """ Test :func:`colour.plotting.common.XYZ_to_plotting_colourspace` definition. @@ -150,7 +154,7 @@ class TestColourCycle: methods. """ - def test_colour_cycle(self): + def test_colour_cycle(self) -> None: """Test :func:`colour.plotting.common.colour_cycle` definition.""" cycler = colour_cycle() @@ -188,26 +192,20 @@ class TestArtist: methods. """ - def test_axes_args(self): - """ - Test `colour.plotting.common.artist` figure / axis association - """ - fig1 = plt.figure() - fig_sub1 = fig1.subfigures() - fig_sub2 = fig_sub1.subfigures() - ax1 = fig_sub2.gca() + def test_artist(self) -> None: + """Test :func:`colour.plotting.common.artist` definition.""" - fig_result1, _ = artist(axes=ax1) + figure_1 = plt.figure() + axes = figure_1.subfigures().subfigures().gca() # pyright: ignore - assert fig1 is fig_result1 + figure_2, _axes = artist(axes=axes) - _ = plt.figure() + assert figure_1 is figure_2 - fig_result2, _ = artist(axes=ax1) - assert fig1 is fig_result2 + plt.figure() - def test_artist(self): - """Test :func:`colour.plotting.common.artist` definition.""" + figure_2, _axes = artist(axes=axes) + assert figure_1 is figure_2 figure_1, axes_1 = artist() @@ -227,7 +225,7 @@ class TestCamera: methods. """ - def test_camera(self): + def test_camera(self) -> None: """Test :func:`colour.plotting.common.camera` definition.""" figure, _axes = artist() @@ -245,17 +243,17 @@ class TestRender: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._temporary_directory = tempfile.mkdtemp() - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_render(self): + def test_render(self) -> None: """Test :func:`colour.plotting.common.render` definition.""" figure, axes = artist() @@ -293,7 +291,7 @@ class TestLabelRectangles: tests methods. """ - def test_label_rectangles(self): + def test_label_rectangles(self) -> None: """Test :func:`colour.plotting.common.label_rectangles` definition.""" figure, axes = artist() @@ -301,7 +299,10 @@ def test_label_rectangles(self): samples = np.linspace(0, 1, 10) _figure, axes = label_rectangles( - samples, axes.bar(samples, 1), figure=figure, axes=axes + cast(List[float], samples.tolist()), + axes.bar(samples, 1), + figure=figure, + axes=axes, ) assert len(axes.texts) == len(samples) @@ -313,11 +314,11 @@ class TestUniformAxes3d: methods. """ - def test_uniform_axes3d(self): + def test_uniform_axes3d(self) -> None: """Test :func:`colour.plotting.common.uniform_axes3d` definition.""" figure, _axes = artist() - axes = figure.add_subplot(111, projection="3d") + axes = cast(Axes3D, figure.add_subplot(111, projection="3d")) uniform_axes3d(axes=axes) @@ -331,7 +332,7 @@ class TestFilterPassthrough: tests methods. """ - def test_filter_passthrough(self): + def test_filter_passthrough(self) -> None: """Test :func:`colour.plotting.common.filter_passthrough` definition.""" assert sorted( @@ -375,7 +376,7 @@ class TestFilterRgbColourspaces: unit tests methods. """ - def test_filter_RGB_colourspaces(self): + def test_filter_RGB_colourspaces(self) -> None: """ Test :func:`colour.plotting.common.filter_RGB_colourspaces` definition. @@ -393,7 +394,7 @@ class TestFilterCmfs: methods. """ - def test_filter_cmfs(self): + def test_filter_cmfs(self) -> None: """Test :func:`colour.plotting.common.filter_cmfs` definition.""" assert sorted( @@ -410,7 +411,7 @@ class TestFilterIlluminants: tests methods. """ - def test_filter_illuminants(self): + def test_filter_illuminants(self) -> None: """Test :func:`colour.plotting.common.filter_illuminants` definition.""" assert sorted(filter_illuminants(["D50"]).keys()) == ["D50"] @@ -422,7 +423,7 @@ class TestFilterColourCheckers: unit tests methods. """ - def test_filter_colour_checkers(self): + def test_filter_colour_checkers(self) -> None: """Test :func:`colour.plotting.common.filter_colour_checkers` definition.""" assert sorted( @@ -441,7 +442,7 @@ class TestUpdateSettingsCollection: definition unit tests methods. """ - def test_update_settings_collection(self): + def test_update_settings_collection(self) -> None: """ Test :func:`colour.plotting.common.update_settings_collection` definition. @@ -464,7 +465,7 @@ class TestPlotSingleColourSwatch: unit tests methods. """ - def test_plot_single_colour_swatch(self): + def test_plot_single_colour_swatch(self) -> None: """ Test :func:`colour.plotting.common.plot_single_colour_swatch` definition. @@ -491,7 +492,7 @@ class TestPlotMultiColourSwatches: definition unit tests methods. """ - def test_plot_multi_colour_swatches(self): + def test_plot_multi_colour_swatches(self) -> None: """ Test :func:`colour.plotting.common.plot_multi_colour_swatches` definition. @@ -527,7 +528,7 @@ class TestPlotSingleFunction: tests methods. """ - def test_plot_single_function(self): + def test_plot_single_function(self) -> None: """Test :func:`colour.plotting.common.plot_single_function` definition.""" figure, axes = plot_single_function(partial(gamma_function, exponent=1 / 2.2)) @@ -542,7 +543,7 @@ class TestPlotMultiFunctions: tests methods. """ - def test_plot_multi_functions(self): + def test_plot_multi_functions(self) -> None: """Test :func:`colour.plotting.common.plot_multi_functions` definition.""" functions = { @@ -581,11 +582,15 @@ class TestPlotImage: methods. """ - def test_plot_image(self): + def test_plot_image(self) -> None: """Test :func:`colour.plotting.common.plot_image` definition.""" path = os.path.join( - colour.__path__[0], "..", "docs", "_static", "Logo_Medium_001.png" + colour.__path__[0], # pyright: ignore + "..", + "docs", + "_static", + "Logo_Medium_001.png", ) # Distribution does not ship the documentation thus we are skipping diff --git a/colour/plotting/tests/test_corresponding.py b/colour/plotting/tests/test_corresponding.py index dba1bddc9..6be6d0a2e 100644 --- a/colour/plotting/tests/test_corresponding.py +++ b/colour/plotting/tests/test_corresponding.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.corresponding` module.""" +from __future__ import annotations + from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -23,7 +25,7 @@ class TestPlotCorrespondingChromaticitiesPrediction: plot_corresponding_chromaticities_prediction` definition unit tests methods. """ - def test_plot_corresponding_chromaticities_prediction(self): + def test_plot_corresponding_chromaticities_prediction(self) -> None: """ Test :func:`colour.plotting.corresponding.\ plot_corresponding_chromaticities_prediction` definition. diff --git a/colour/plotting/tests/test_diagrams.py b/colour/plotting/tests/test_diagrams.py index 297296d1e..8dd77b54e 100644 --- a/colour/plotting/tests/test_diagrams.py +++ b/colour/plotting/tests/test_diagrams.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.diagrams` module.""" +from __future__ import annotations + import pytest from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -54,7 +56,7 @@ class TestLinesSpectralLocus: unit tests methods. """ - def test_lines_spectral_locus(self): + def test_lines_spectral_locus(self) -> None: """ Test :func:`colour.plotting.diagrams.lines_spectral_locus` definition. @@ -69,7 +71,7 @@ class TestPlotSpectralLocus: unit tests methods. """ - def test_plot_spectral_locus(self): + def test_plot_spectral_locus(self) -> None: """ Test :func:`colour.plotting.diagrams.plot_spectral_locus` definition. """ @@ -117,7 +119,7 @@ class TestPlotChromaticityDiagramColours: definition unit tests methods. """ - def test_plot_chromaticity_diagram_colours(self): + def test_plot_chromaticity_diagram_colours(self) -> None: """ Test :func:`colour.plotting.diagrams.plot_chromaticity_diagram_colours` definition. @@ -145,7 +147,7 @@ class TestPlotChromaticityDiagram: definition unit tests methods. """ - def test_plot_chromaticity_diagram(self): + def test_plot_chromaticity_diagram(self) -> None: """ Test :func:`colour.plotting.diagrams.plot_chromaticity_diagram` definition. @@ -182,7 +184,7 @@ class TestPlotChromaticityDiagramCIE1931: definition unit tests methods. """ - def test_plot_chromaticity_diagram_CIE1931(self): + def test_plot_chromaticity_diagram_CIE1931(self) -> None: """ Test :func:`colour.plotting.diagrams.\ plot_chromaticity_diagram_CIE1931` definition. @@ -200,7 +202,7 @@ class TestPlotChromaticityDiagramCIE1960UCS: plot_chromaticity_diagram_CIE1960UCS` definition unit tests methods. """ - def test_plot_chromaticity_diagram_CIE1960UCS(self): + def test_plot_chromaticity_diagram_CIE1960UCS(self) -> None: """ Test :func:`colour.plotting.diagrams.\ plot_chromaticity_diagram_CIE1960UCS` definition. @@ -218,7 +220,7 @@ class TestPlotChromaticityDiagramCIE1976UCS: plot_chromaticity_diagram_CIE1976UCS` definition unit tests methods. """ - def test_plot_chromaticity_diagram_CIE1976UCS(self): + def test_plot_chromaticity_diagram_CIE1976UCS(self) -> None: """ Test :func:`colour.plotting.diagrams.\ plot_chromaticity_diagram_CIE1976UCS` definition. @@ -236,7 +238,7 @@ class TestPlotSdsInChromaticityDiagram: plot_sds_in_chromaticity_diagram` definition unit tests methods. """ - def test_plot_sds_in_chromaticity_diagram(self): + def test_plot_sds_in_chromaticity_diagram(self) -> None: """ Test :func:`colour.plotting.diagrams.plot_sds_in_chromaticity_diagram` definition. @@ -276,7 +278,7 @@ class TestPlotSdsInChromaticityDiagramCIE1931: plot_sds_in_chromaticity_diagram_CIE1931` definition unit tests methods. """ - def test_plot_sds_in_chromaticity_diagram_CIE1931(self): + def test_plot_sds_in_chromaticity_diagram_CIE1931(self) -> None: """ Test :func:`colour.plotting.diagrams.\ plot_sds_in_chromaticity_diagram_CIE1931` definition. @@ -296,7 +298,7 @@ class TestPlotSdsInChromaticityDiagramCIE1960UCS: plot_sds_in_chromaticity_diagram_CIE1960UCS` definition unit tests methods. """ - def test_plot_sds_in_chromaticity_diagram_CIE1960UCS(self): + def test_plot_sds_in_chromaticity_diagram_CIE1960UCS(self) -> None: """ Test :func:`colour.plotting.diagrams.\ plot_sds_in_chromaticity_diagram_CIE1960UCS` definition. @@ -316,7 +318,7 @@ class TestPlotSdsInChromaticityDiagramCIE1976UCS: plot_sds_in_chromaticity_diagram_CIE1976UCS` definition unit tests methods. """ - def test_plot_sds_in_chromaticity_diagram_CIE1976UCS(self): + def test_plot_sds_in_chromaticity_diagram_CIE1976UCS(self) -> None: """ Test :func:`colour.plotting.diagrams.\ plot_sds_in_chromaticity_diagram_CIE1976UCS` definition. diff --git a/colour/plotting/tests/test_graph.py b/colour/plotting/tests/test_graph.py index 9a60b724f..07cef22a7 100644 --- a/colour/plotting/tests/test_graph.py +++ b/colour/plotting/tests/test_graph.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.graph` module.""" +from __future__ import annotations + import tempfile from colour.plotting import plot_automatic_colour_conversion_graph @@ -23,7 +25,7 @@ class TestPlotAutomaticColourConversionGraph: plot_automatic_colour_conversion_graph` definition unit tests methods. """ - def test_plot_automatic_colour_conversion_graph(self): + def test_plot_automatic_colour_conversion_graph(self) -> None: """ Test :func:`colour.plotting.graph.\ plot_automatic_colour_conversion_graph` definition. diff --git a/colour/plotting/tests/test_models.py b/colour/plotting/tests/test_models.py index 4db8c4d44..3ba72e01c 100644 --- a/colour/plotting/tests/test_models.py +++ b/colour/plotting/tests/test_models.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.models` module.""" +from __future__ import annotations + import numpy as np import pytest from matplotlib.axes import Axes @@ -65,7 +67,7 @@ class TestCommonColourspaceModelAxisReorder: definition unit tests methods. """ - def test_colourspace_model_axis_reorder(self): + def test_colourspace_model_axis_reorder(self) -> None: """ Test :func:`colour.plotting.models.colourspace_model_axis_reorder` definition. @@ -108,7 +110,7 @@ class TestLinesPointerGamut: tests methods. """ - def test_lines_pointer_gamut(self): + def test_lines_pointer_gamut(self) -> None: """ Test :func:`colour.plotting.models.lines_pointer_gamut` definition. """ @@ -122,7 +124,7 @@ class TestPlotPointerGamut: tests methods. """ - def test_plot_pointer_gamut(self): + def test_plot_pointer_gamut(self) -> None: """Test :func:`colour.plotting.models.plot_pointer_gamut` definition.""" figure, axes = plot_pointer_gamut() @@ -149,7 +151,7 @@ class TestPlotRGBColourspacesInChromaticityDiagram: plot_RGB_colourspaces_in_chromaticity_diagram` definition unit tests methods. """ - def test_plot_RGB_colourspaces_in_chromaticity_diagram(self): + def test_plot_RGB_colourspaces_in_chromaticity_diagram(self) -> None: """ Test :func:`colour.plotting.models.\ plot_RGB_colourspaces_in_chromaticity_diagram` definition. @@ -190,7 +192,7 @@ class TestPlotRGBColourspacesInChromaticityDiagramCIE1931: methods. """ - def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931(self): + def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931(self) -> None: """ Test :func:`colour.plotting.models.\ plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931` definition. @@ -211,7 +213,7 @@ class TestPlotRGBColourspacesInChromaticityDiagramCIE1960UCS: methods. """ - def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS(self): + def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS(self) -> None: """ Test :func:`colour.plotting.models.\ plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS` definition. @@ -235,7 +237,7 @@ class TestPlotRGBColourspacesInChromaticityDiagramCIE1976UCS: methods. """ - def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS(self): + def test_plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS(self) -> None: """ Test :func:`colour.plotting.models.\ plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS` definition. @@ -258,7 +260,7 @@ class TestPlotRGBChromaticitiesInChromaticityDiagram: plot_RGB_chromaticities_in_chromaticity_diagram` definition unit tests methods. """ - def test_plot_RGB_chromaticities_in_chromaticity_diagram(self): + def test_plot_RGB_chromaticities_in_chromaticity_diagram(self) -> None: """ Test :func:`colour.plotting.models.\ plot_RGB_chromaticities_in_chromaticity_diagram` definition. @@ -279,7 +281,7 @@ class TestPlotRGBChromaticitiesInChromaticityDiagramCIE1931: methods. """ - def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931(self): + def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931(self) -> None: """ Test :func:`colour.plotting.models.\ plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931` definition. @@ -300,7 +302,7 @@ class TestPlotRGBChromaticitiesInChromaticityDiagramCIE1960UCS: tests methods. """ - def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS(self): + def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS(self) -> None: """ Test :func:`colour.plotting.models.\ plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS` definition. @@ -324,7 +326,7 @@ class TestPlotRGBChromaticitiesInChromaticityDiagramCIE1976UCS: tests methods. """ - def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS(self): + def test_plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS(self) -> None: """ Test :func:`colour.plotting.models.\ plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS` definition. @@ -347,7 +349,7 @@ class TestEllipsesMacAdam1942: tests methods. """ - def test_ellipses_MacAdam1942(self): + def test_ellipses_MacAdam1942(self) -> None: """Test :func:`colour.plotting.models.ellipses_MacAdam1942` definition.""" assert len(ellipses_MacAdam1942()) == 25 @@ -362,7 +364,7 @@ class TestPlotEllipsesMacAdam1942InChromaticityDiagram: methods. """ - def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram(self): + def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram(self) -> None: """ Test :func:`colour.plotting.models.\ plot_ellipses_MacAdam1942_in_chromaticity_diagram` definition. @@ -391,7 +393,7 @@ class TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1931: tests methods. """ - def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931(self): + def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931(self) -> None: """ Test :func:`colour.plotting.models.\ plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931` definition. @@ -415,7 +417,7 @@ class TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1960UCS: def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS( self, - ): + ) -> None: """ Test :func:`colour.plotting.models.\ plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS` definition. @@ -439,7 +441,7 @@ class TestPlotEllipsesMacAdam1942InChromaticityDiagramCIE1976UCS: def test_plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS( self, - ): + ) -> None: """ Test :func:`colour.plotting.models.\ plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS` definition. @@ -460,7 +462,7 @@ class TestPlotSingleCctf: tests methods. """ - def test_plot_single_cctf(self): + def test_plot_single_cctf(self) -> None: """Test :func:`colour.plotting.models.plot_single_cctf` definition.""" figure, axes = plot_single_cctf("ITU-R BT.709") @@ -475,7 +477,7 @@ class TestPlotMultiCctfs: tests methods. """ - def test_plot_multi_cctfs(self): + def test_plot_multi_cctfs(self) -> None: """Test :func:`colour.plotting.models.plot_multi_cctfs` definition.""" figure, axes = plot_multi_cctfs(["ITU-R BT.709", "sRGB"]) @@ -490,7 +492,7 @@ class TestPlotConstantHueLoci: unit tests methods. """ - def test_plot_constant_hue_loci(self): + def test_plot_constant_hue_loci(self) -> None: """Test :func:`colour.plotting.models.plot_constant_hue_loci` definition.""" data = [ diff --git a/colour/plotting/tests/test_notation.py b/colour/plotting/tests/test_notation.py index 61d4f5e78..8563ce124 100644 --- a/colour/plotting/tests/test_notation.py +++ b/colour/plotting/tests/test_notation.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.notation` module.""" +from __future__ import annotations + from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -27,7 +29,7 @@ class TestPlotSingleMunsellValueFunction: definition unit tests methods. """ - def test_plot_single_munsell_value_function(self): + def test_plot_single_munsell_value_function(self) -> None: """ Test :func:`colour.plotting.notation.\ plot_single_munsell_value_function` definition. @@ -45,7 +47,7 @@ class TestPlotMultiMunsellValueFunctions: definition unit tests methods. """ - def test_plot_multi_munsell_value_functions(self): + def test_plot_multi_munsell_value_functions(self) -> None: """ Test :func:`colour.plotting.notation.\ plot_multi_munsell_value_functions` definition. diff --git a/colour/plotting/tests/test_phenomena.py b/colour/plotting/tests/test_phenomena.py index ccda103ba..d94268850 100644 --- a/colour/plotting/tests/test_phenomena.py +++ b/colour/plotting/tests/test_phenomena.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.phenomena` module.""" +from __future__ import annotations + from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -27,7 +29,7 @@ class TestPlotSingleSdRayleighScattering: plot_single_sd_rayleigh_scattering` definition unit tests methods. """ - def test_plot_single_sd_rayleigh_scattering(self): + def test_plot_single_sd_rayleigh_scattering(self) -> None: """ Test :func:`colour.plotting.phenomena.\ plot_single_sd_rayleigh_scattering` definition. @@ -45,7 +47,7 @@ class TestPlotTheBlueSky: tests methods. """ - def test_plot_the_blue_sky(self): + def test_plot_the_blue_sky(self) -> None: """Test :func:`colour.plotting.phenomena.plot_the_blue_sky` definition.""" figure, axes = plot_the_blue_sky() diff --git a/colour/plotting/tests/test_quality.py b/colour/plotting/tests/test_quality.py index 97f5ab47e..8d2b45c47 100644 --- a/colour/plotting/tests/test_quality.py +++ b/colour/plotting/tests/test_quality.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.quality` module.""" +from __future__ import annotations + from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -40,7 +42,7 @@ class TestPlotColourQualityBars: unit tests methods. """ - def test_plot_colour_quality_bars(self): + def test_plot_colour_quality_bars(self) -> None: """ Test :func:`colour.plotting.quality.plot_colour_quality_bars` definition. @@ -52,7 +54,7 @@ def test_plot_colour_quality_bars(self): cqs_i = colour_quality_scale(illuminant, additional_data=True) cqs_l = colour_quality_scale(light_source, additional_data=True) - figure, axes = plot_colour_quality_bars([cqs_i, cqs_l]) + figure, axes = plot_colour_quality_bars([cqs_i, cqs_l]) # pyright: ignore assert isinstance(figure, Figure) assert isinstance(axes, Axes) @@ -64,7 +66,7 @@ class TestPlotSingleSdColourRenderingIndexBars: plot_single_sd_colour_rendering_index_bars` definition unit tests methods. """ - def test_plot_single_sd_colour_rendering_index_bars(self): + def test_plot_single_sd_colour_rendering_index_bars(self) -> None: """ Test :func:`colour.plotting.quality.\ plot_single_sd_colour_rendering_index_bars` definition. @@ -84,7 +86,7 @@ class TestPlotMultiSdsColourRenderingIndexesBars: plot_multi_sds_colour_rendering_indexes_bars` definition unit tests methods. """ - def test_plot_multi_sds_colour_rendering_indexes_bars(self): + def test_plot_multi_sds_colour_rendering_indexes_bars(self) -> None: """ Test :func:`colour.plotting.quality.\ plot_multi_sds_colour_rendering_indexes_bars` definition. @@ -104,7 +106,7 @@ class TestPlotSingleSdColourQualityScaleBars: plot_single_sd_colour_quality_scale_bars` definition unit tests methods. """ - def test_plot_single_sd_colour_quality_scale_bars(self): + def test_plot_single_sd_colour_quality_scale_bars(self) -> None: """ Test :func:`colour.plotting.quality.\ plot_single_sd_colour_quality_scale_bars` definition. @@ -122,7 +124,7 @@ class TestPlotMultiSdsColourQualityScalesBars: plot_multi_sds_colour_quality_scales_bars` definition unit tests methods. """ - def test_plot_multi_sds_colour_quality_scales_bars(self): + def test_plot_multi_sds_colour_quality_scales_bars(self) -> None: """ Test :func:`colour.plotting.quality.\ plot_multi_sds_colour_quality_scales_bars` definition. diff --git a/colour/plotting/tests/test_section.py b/colour/plotting/tests/test_section.py index 8fe179919..8653bcae7 100644 --- a/colour/plotting/tests/test_section.py +++ b/colour/plotting/tests/test_section.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.section` module.""" +from __future__ import annotations + from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -36,7 +38,7 @@ class TestPlotHullSectionColours: definition unit tests methods. """ - def test_plot_hull_section_colours(self): + def test_plot_hull_section_colours(self) -> None: """ Test :func:`colour.plotting.section.plot_hull_section_colours` definition. @@ -73,7 +75,7 @@ class TestPlotHullSectionContour: definition unit tests methods. """ - def test_plot_hull_section_contour(self): + def test_plot_hull_section_contour(self) -> None: """ Test :func:`colour.plotting.section.plot_hull_section_contour` definition. @@ -100,7 +102,7 @@ class TestPlotVisibleSpectrumSection: definition unit tests methods. """ - def test_plot_visible_spectrum_section(self): + def test_plot_visible_spectrum_section(self) -> None: """ Test :func:`colour.plotting.section.plot_visible_spectrum_section` definition. @@ -121,7 +123,7 @@ class TestPlotRGBColourspaceSection: definition unit tests methods. """ - def test_plot_RGB_colourspace_section(self): + def test_plot_RGB_colourspace_section(self) -> None: """ Test :func:`colour.plotting.section.plot_RGB_colourspace_section` definition. diff --git a/colour/plotting/tests/test_temperature.py b/colour/plotting/tests/test_temperature.py index 7f00cbca2..0957808d1 100644 --- a/colour/plotting/tests/test_temperature.py +++ b/colour/plotting/tests/test_temperature.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.temperature` module.""" +from __future__ import annotations + import pytest from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -40,7 +42,7 @@ class TestLinesDaylightLocus: unit tests methods. """ - def test_lines_daylight_locus(self): + def test_lines_daylight_locus(self) -> None: """ Test :func:`colour.plotting.diagrams.lines_daylight_locus` definition. """ @@ -54,7 +56,7 @@ class TestPlotDaylightLocus: unit tests methods. """ - def test_plot_daylight_locus(self): + def test_plot_daylight_locus(self) -> None: """ Test :func:`colour.plotting.temperature.plot_daylight_locus` definition. @@ -84,7 +86,7 @@ class TestLinesPlanckianLocus: unit tests methods. """ - def test_lines_planckian_locus(self): + def test_lines_planckian_locus(self) -> None: """ Test :func:`colour.plotting.diagrams.lines_planckian_locus` definition. """ @@ -98,7 +100,7 @@ class TestPlotPlanckianLocus: unit tests methods. """ - def test_plot_planckian_locus(self): + def test_plot_planckian_locus(self) -> None: """ Test :func:`colour.plotting.temperature.plot_planckian_locus` definition. @@ -133,7 +135,7 @@ class TestPlotPlanckianLocusInChromaticityDiagram: plot_planckian_locus_in_chromaticity_diagram` definition unit tests methods. """ - def test_plot_planckian_locus_in_chromaticity_diagram(self): + def test_plot_planckian_locus_in_chromaticity_diagram(self) -> None: """ Test :func:`colour.plotting.temperature.\ plot_planckian_locus_in_chromaticity_diagram` definition. @@ -182,7 +184,7 @@ class TestPlotPlanckianLocusInChromaticityDiagramCIE1931: methods. """ - def test_plot_planckian_locus_in_chromaticity_diagram_CIE1931(self): + def test_plot_planckian_locus_in_chromaticity_diagram_CIE1931(self) -> None: """ Test :func:`colour.plotting.temperature.\ plot_planckian_locus_in_chromaticity_diagram_CIE1931` definition. @@ -203,7 +205,7 @@ class TestPlotPlanckianLocusInChromaticityDiagramCIE1960UCS: methods. """ - def test_plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS(self): + def test_plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS(self) -> None: """ Test :func:`colour.plotting.temperature.\ plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS` definition. diff --git a/colour/plotting/tests/test_volume.py b/colour/plotting/tests/test_volume.py index 87c7f5e21..6b0540456 100644 --- a/colour/plotting/tests/test_volume.py +++ b/colour/plotting/tests/test_volume.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.volume` module.""" +from __future__ import annotations + import numpy as np from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -29,7 +31,7 @@ class TestNadirGrid: methods. """ - def test_nadir_grid(self): + def test_nadir_grid(self) -> None: """Test :func:`colour.plotting.volume.nadir_grid` definition.""" quads, faces_colours, edges_colours = nadir_grid(segments=1) @@ -124,7 +126,7 @@ class TestRGBIdentityCube: tests methods. """ - def test_RGB_identity_cube(self): + def test_RGB_identity_cube(self) -> None: """Test :func:`colour.plotting.volume.RGB_identity_cube` definition.""" vertices, RGB = RGB_identity_cube(1, 1, 1) @@ -196,7 +198,7 @@ class TestPlotRGBColourspacesGamuts: definition unit tests methods. """ - def test_plot_RGB_colourspaces_gamuts(self): + def test_plot_RGB_colourspaces_gamuts(self) -> None: """ Test :func:`colour.plotting.volume.plot_RGB_colourspaces_gamuts` definition. @@ -219,7 +221,7 @@ class TestPlotRGBScatter: tests methods. """ - def test_plot_RGB_scatter(self): + def test_plot_RGB_scatter(self) -> None: """Test :func:`colour.plotting.volume.plot_RGB_scatter` definition.""" figure, axes = plot_RGB_scatter(np.random.random((128, 128, 3)), "ITU-R BT.709") diff --git a/colour/plotting/tm3018/components.py b/colour/plotting/tm3018/components.py index 6aad47a8b..af91aae3a 100644 --- a/colour/plotting/tm3018/components.py +++ b/colour/plotting/tm3018/components.py @@ -429,7 +429,7 @@ def plot_colour_vector_graphic( zorder=CONSTANTS_COLOUR_STYLE.zorder.midground_line, ) - def corner_label_and_text(label: str, text: str, ha: str, va: str): + def corner_label_and_text(label: str, text: str, ha: str, va: str) -> None: """Draw a label and text in given corner.""" x = -1.45 if ha == "left" else 1.45 diff --git a/colour/plotting/tm3018/tests/test_components.py b/colour/plotting/tm3018/tests/test_components.py index c97c8072b..da36225d6 100644 --- a/colour/plotting/tm3018/tests/test_components.py +++ b/colour/plotting/tm3018/tests/test_components.py @@ -50,7 +50,7 @@ class TestPlotSpectraANSIIESTM3018: plot_spectra_ANSIIESTM3018` definition unit tests methods. """ - def test_plot_spectra_ANSIIESTM3018(self): + def test_plot_spectra_ANSIIESTM3018(self) -> None: """ Test :func:`colour.plotting.tm3018.components.\ plot_spectra_ANSIIESTM3018` definition. @@ -68,7 +68,7 @@ class TestPlotColourVectorGraphic: plot_colour_vector_graphic` definition unit tests methods. """ - def test_plot_colour_vector_graphic(self): + def test_plot_colour_vector_graphic(self) -> None: """ Test :func:`colour.plotting.tm3018.components.\ plot_colour_vector_graphic` definition. @@ -86,7 +86,7 @@ class TestPlot16BinBars: definition unit tests methods. """ - def test_plot_16_bin_bars(self): + def test_plot_16_bin_bars(self) -> None: """ Test :func:`colour.plotting.tm3018.components.plot_16_bin_bars` definition. @@ -104,7 +104,7 @@ class TestPlotLocalChromaShifts: definition unit tests methods. """ - def test_plot_local_chroma_shifts(self): + def test_plot_local_chroma_shifts(self) -> None: """ Test :func:`colour.plotting.tm3018.components.\ plot_local_chroma_shifts` definition. @@ -122,7 +122,7 @@ class TestPlotLocalHueShifts: definition unit tests methods. """ - def test_plot_local_hue_shifts(self): + def test_plot_local_hue_shifts(self) -> None: """ Test :func:`colour.plotting.tm3018.components.\ plot_local_hue_shifts` definition. @@ -140,7 +140,7 @@ class TestPlotLocalColourFidelities: plot_local_colour_fidelities` definition unit tests methods. """ - def test_plot_local_colour_fidelities(self): + def test_plot_local_colour_fidelities(self) -> None: """ Test :func:`colour.plotting.tm3018.components.\ plot_local_colour_fidelities` definition. @@ -158,7 +158,7 @@ class TestPlotColourFidelityIndexes: plot_colour_fidelity_indexes` definition unit tests methods. """ - def test_plot_colour_fidelity_indexes(self): + def test_plot_colour_fidelity_indexes(self) -> None: """ Test :func:`colour.plotting.tm3018.components.\ plot_colour_fidelity_indexes` definition. diff --git a/colour/plotting/tm3018/tests/test_report.py b/colour/plotting/tm3018/tests/test_report.py index 107845a6e..6b8a68d3c 100644 --- a/colour/plotting/tm3018/tests/test_report.py +++ b/colour/plotting/tm3018/tests/test_report.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.plotting.tm3018.report` module.""" +from __future__ import annotations + from matplotlib.axes import Axes from matplotlib.figure import Figure @@ -32,7 +34,7 @@ class TestPlotSingleSdColourRenditionReportFull: plot_single_sd_colour_rendition_report_full` definition unit tests methods. """ - def test_plot_single_sd_colour_rendition_report_full(self): + def test_plot_single_sd_colour_rendition_report_full(self) -> None: """ Test :func:`colour.plotting.tm3018.report.\ plot_single_sd_colour_rendition_report_full` definition. @@ -53,7 +55,7 @@ class TestPlotSingleSdColourRenditionReportIntermediate: methods. """ - def test_plot_single_sd_colour_rendition_report_intermediate(self): + def test_plot_single_sd_colour_rendition_report_intermediate(self) -> None: """ Test :func:`colour.plotting.tm3018.report.\ plot_single_sd_colour_rendition_report_intermediate` definition. @@ -73,7 +75,7 @@ class TestPlotSingleSdColourRenditionReportSimple: plot_single_sd_colour_rendition_report_simple` definition unit tests methods. """ - def test_plot_color_vector_graphic(self): + def test_plot_color_vector_graphic(self) -> None: """ Test :func:`colour.plotting.tm3018.report.\ plot_single_sd_colour_rendition_report_simple` definition. @@ -93,7 +95,7 @@ class TestPlotSingleSdColourRenditionReport: plot_single_sd_colour_rendition_report` definition unit tests methods. """ - def test_plot_single_sd_colour_rendition_report(self): + def test_plot_single_sd_colour_rendition_report(self) -> None: """ Test :func:`colour.plotting.tm3018.report.\ plot_single_sd_colour_rendition_report` definition. diff --git a/colour/plotting/volume.py b/colour/plotting/volume.py index 253c0ed29..a199d3834 100644 --- a/colour/plotting/volume.py +++ b/colour/plotting/volume.py @@ -319,19 +319,21 @@ def RGB_identity_cube( height_segments: int = 16, depth_segments: int = 16, planes: ( - Literal[ - "-x", - "+x", - "-y", - "+y", - "-z", - "+z", - "xy", - "xz", - "yz", - "yx", - "zx", - "zy", + Sequence[ + Literal[ + "-x", + "+x", + "-y", + "+y", + "-z", + "+z", + "xy", + "xz", + "yz", + "yx", + "zx", + "zy", + ] ] | None ) = None, diff --git a/colour/quality/__init__.py b/colour/quality/__init__.py index 960c01880..ed72189f7 100644 --- a/colour/quality/__init__.py +++ b/colour/quality/__init__.py @@ -64,7 +64,7 @@ def colour_fidelity_index( sd_test: SpectralDistribution, - additional_data=False, + additional_data: bool = False, method: Literal["CIE 2017", "ANSI/IES TM-30-18"] | str = "CIE 2017", ) -> ( float diff --git a/colour/quality/tests/test_cfi2017.py b/colour/quality/tests/test_cfi2017.py index 187638990..08c50cacf 100644 --- a/colour/quality/tests/test_cfi2017.py +++ b/colour/quality/tests/test_cfi2017.py @@ -19,8 +19,10 @@ reshape_sd, sd_blackbody, ) +from colour.hints import cast from colour.quality.cfi2017 import ( CCT_reference_illuminant, + ColourRendering_Specification_CIE2017, colour_fidelity_index_CIE2017, sd_reference_illuminant, ) @@ -552,14 +554,17 @@ class TestColourFidelityIndexCIE2017: definition unit tests methods. """ - def test_colour_fidelity_index_CIE2017(self): + def test_colour_fidelity_index_CIE2017(self) -> None: """ Test :func:`colour.quality.CIE2017.colour_fidelity_index_CIE2017` definition. """ for sd in [SD_SAMPLE_5NM, SD_SAMPLE_1NM]: - specification = colour_fidelity_index_CIE2017(sd, additional_data=True) + specification = cast( + ColourRendering_Specification_CIE2017, + colour_fidelity_index_CIE2017(sd, additional_data=True), + ) np.testing.assert_allclose(specification.R_f, 81.6, atol=0.1) np.testing.assert_allclose( specification.R_s, @@ -667,8 +672,9 @@ def test_colour_fidelity_index_CIE2017(self): atol=0.1, ) - specification = colour_fidelity_index_CIE2017( - SDS_ILLUMINANTS["FL1"], additional_data=True + specification = cast( + ColourRendering_Specification_CIE2017, + colour_fidelity_index_CIE2017(SDS_ILLUMINANTS["FL1"], additional_data=True), ) np.testing.assert_allclose(specification.R_f, 80.6, atol=0.1) np.testing.assert_allclose( @@ -777,8 +783,9 @@ def test_colour_fidelity_index_CIE2017(self): atol=0.1, ) - specification = colour_fidelity_index_CIE2017( - SDS_ILLUMINANTS["FL2"], additional_data=True + specification = cast( + ColourRendering_Specification_CIE2017, + colour_fidelity_index_CIE2017(SDS_ILLUMINANTS["FL2"], additional_data=True), ) np.testing.assert_allclose(specification.R_f, 70.1, atol=0.1) np.testing.assert_allclose( @@ -887,7 +894,7 @@ def test_colour_fidelity_index_CIE2017(self): atol=0.1, ) - def test_raise_exception_colour_fidelity_index_CFI2017(self): + def test_raise_exception_colour_fidelity_index_CFI2017(self) -> None: """ Test :func:`colour.quality.CIE2017.colour_fidelity_index_CFI2017` definition raised exception. @@ -906,7 +913,7 @@ class TestCctReferenceIlluminant: definition unit tests methods. """ - def test_CCT_reference_illuminant(self): + def test_CCT_reference_illuminant(self) -> None: """ Test :func:`colour.quality.CIE2017.CCT_reference_illuminant` definition. @@ -924,7 +931,7 @@ class TestSdReferenceIlluminant: definition unit tests methods. """ - def test_sd_reference_illuminant(self): + def test_sd_reference_illuminant(self) -> None: """ Test :func:`colour.quality.CIE2017.sd_reference_illuminant` definition. diff --git a/colour/quality/tests/test_cqs.py b/colour/quality/tests/test_cqs.py index 79c3ef84e..fede00973 100644 --- a/colour/quality/tests/test_cqs.py +++ b/colour/quality/tests/test_cqs.py @@ -1,9 +1,12 @@ """Define the unit tests for the :mod:`colour.quality.cqs` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry import SDS_ILLUMINANTS, SDS_LIGHT_SOURCES from colour.constants import TOLERANCE_ABSOLUTE_TESTS +from colour.hints import cast from colour.quality import ( ColourRendering_Specification_CQS, colour_quality_scale, @@ -28,58 +31,75 @@ class TestColourQualityScale: tests methods. """ - def test_colour_quality_scale(self): + def test_colour_quality_scale(self) -> None: """Test :func:`colour.quality.cqs.colour_quality_scale` definition.""" np.testing.assert_allclose( - colour_quality_scale(SDS_ILLUMINANTS["FL1"]), + cast(float, colour_quality_scale(SDS_ILLUMINANTS["FL1"])), 74.982585798279914, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_quality_scale(SDS_ILLUMINANTS["FL1"], method="NIST CQS 7.4"), + cast( + float, + colour_quality_scale(SDS_ILLUMINANTS["FL1"], method="NIST CQS 7.4"), + ), 75.377089740493361, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_quality_scale(SDS_ILLUMINANTS["FL2"]), + cast(float, colour_quality_scale(SDS_ILLUMINANTS["FL2"])), 64.111822015662852, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_quality_scale(SDS_ILLUMINANTS["FL2"], method="NIST CQS 7.4"), + cast( + float, + colour_quality_scale(SDS_ILLUMINANTS["FL2"], method="NIST CQS 7.4"), + ), 64.774586908581369, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_quality_scale(SDS_LIGHT_SOURCES["Neodimium Incandescent"]), + cast( + float, colour_quality_scale(SDS_LIGHT_SOURCES["Neodimium Incandescent"]) + ), 89.737456186836681, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_quality_scale( - SDS_LIGHT_SOURCES["Neodimium Incandescent"], - method="NIST CQS 7.4", + cast( + float, + colour_quality_scale( + SDS_LIGHT_SOURCES["Neodimium Incandescent"], + method="NIST CQS 7.4", + ), ), 87.700300087538821, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_quality_scale(SDS_LIGHT_SOURCES["F32T8/TL841 (Triphosphor)"]), + cast( + float, + colour_quality_scale(SDS_LIGHT_SOURCES["F32T8/TL841 (Triphosphor)"]), + ), 84.934928463428903, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_quality_scale( - SDS_LIGHT_SOURCES["F32T8/TL841 (Triphosphor)"], - method="NIST CQS 7.4", + cast( + float, + colour_quality_scale( + SDS_LIGHT_SOURCES["F32T8/TL841 (Triphosphor)"], + method="NIST CQS 7.4", + ), ), 83.255457439460713, atol=TOLERANCE_ABSOLUTE_TESTS, @@ -200,195 +220,198 @@ def test_colour_quality_scale(self): ), }, colorimetry_data=( - [ + ( DataColorimetry_VS( name="VS1", XYZ=np.array([0.13183826, 0.09887241, 0.22510560]), Lab=np.array([37.63929023, 27.59987425, -26.20530751]), - C=38.058786112947161, + C=np.array([38.058786112947161]), ), DataColorimetry_VS( name="VS2", XYZ=np.array([0.13061818, 0.10336027, 0.30741529]), Lab=np.array([38.43888224, 23.35252921, -37.81858787]), - C=44.447566961689617, + C=np.array([44.447566961689617]), ), DataColorimetry_VS( name="VS3", XYZ=np.array([0.10089287, 0.09200351, 0.32265558]), Lab=np.array([36.36721207, 11.00392324, -43.53144829]), - C=44.900705083686788, + C=np.array([44.900705083686788]), ), DataColorimetry_VS( name="VS4", XYZ=np.array([0.13339390, 0.15696027, 0.38421714]), Lab=np.array([46.57313273, -9.89411460, -33.95550516]), - C=35.367638235231176, + C=np.array([35.367638235231176]), ), DataColorimetry_VS( name="VS5", XYZ=np.array([0.18662999, 0.24708620, 0.40043676]), Lab=np.array([56.79040832, -23.15964295, -18.30798276]), - C=29.522047597875542, + C=np.array([29.522047597875542]), ), DataColorimetry_VS( name="VS6", XYZ=np.array([0.15843362, 0.24157338, 0.26933196]), Lab=np.array([56.24498076, -36.24891195, -1.43946286]), - C=36.277481597875926, + C=np.array([36.277481597875926]), ), DataColorimetry_VS( name="VS7", XYZ=np.array([0.14991085, 0.24929718, 0.13823961]), Lab=np.array([57.00687838, -44.55799945, 24.99093151]), - C=51.087786926248803, + C=np.array([51.087786926248803]), ), DataColorimetry_VS( name="VS8", XYZ=np.array([0.26141761, 0.36817692, 0.11429088]), Lab=np.array([67.14003019, -33.22377274, 48.66064659]), - C=58.920943658800866, + C=np.array([58.920943658800866]), ), DataColorimetry_VS( name="VS9", XYZ=np.array([0.42410903, 0.52851922, 0.11439812]), Lab=np.array([77.78749106, -22.21024952, 66.98873308]), - C=70.5746806093467, + C=np.array([70.5746806093467]), ), DataColorimetry_VS( name="VS10", XYZ=np.array([0.55367933, 0.62018757, 0.09672217]), Lab=np.array([82.92339395, -8.84301088, 80.99721844]), - C=81.478513954529475, + C=np.array([81.478513954529475]), ), DataColorimetry_VS( name="VS11", XYZ=np.array([0.39755898, 0.39521027, 0.05739407]), Lab=np.array([69.12701310, 6.97471851, 71.51095397]), - C=71.850283480415115, + C=np.array([71.850283480415115]), ), DataColorimetry_VS( name="VS12", XYZ=np.array([0.43757530, 0.38969458, 0.08630191]), Lab=np.array([68.72913590, 20.83589132, 59.86354051]), - C=63.385943630694335, + C=np.array([63.385943630694335]), ), DataColorimetry_VS( name="VS13", XYZ=np.array([0.34657727, 0.27547744, 0.08900676]), Lab=np.array([59.47793328, 31.84647528, 43.02166812]), - C=53.526273138196274, + C=np.array([53.526273138196274]), ), DataColorimetry_VS( name="VS14", XYZ=np.array([0.14271714, 0.09107438, 0.04949461]), Lab=np.array([36.19033157, 40.77665898, 18.34813575]), - C=44.714539058373845, + C=np.array([44.714539058373845]), ), DataColorimetry_VS( name="VS15", XYZ=np.array([0.13593948, 0.09214669, 0.11591665]), Lab=np.array([36.39436371, 35.62220213, -4.79596673]), - C=35.94360278722214, + C=np.array([35.94360278722214]), ), - ], - [ + ), + ( DataColorimetry_VS( name="VS1", XYZ=np.array([0.15205130, 0.10842697, 0.21629425]), Lab=np.array([39.31425803, 32.98285941, -21.74818073]), - C=39.507624328927392, + C=np.array([39.507624328927392]), ), DataColorimetry_VS( name="VS2", XYZ=np.array([0.13187179, 0.10619377, 0.29945481]), Lab=np.array([38.93186373, 22.05038057, -35.82206456]), - C=42.064707208617435, + C=np.array([42.064707208617435]), ), DataColorimetry_VS( name="VS3", XYZ=np.array([0.10123263, 0.09853741, 0.32956604]), Lab=np.array([37.57864252, 6.04766746, -42.39139508]), - C=42.82061020516246, + C=np.array([42.82061020516246]), ), DataColorimetry_VS( name="VS4", XYZ=np.array([0.13144454, 0.16803553, 0.39315864]), Lab=np.array([48.01155296, -17.36604069, -32.56734417]), - C=36.908146466038922, + C=np.array([36.908146466038922]), ), DataColorimetry_VS( name="VS5", XYZ=np.array([0.18145723, 0.25845953, 0.41319313]), Lab=np.array([57.89053983, -30.61152779, -17.92233237]), - C=35.472181086008781, + C=np.array([35.472181086008781]), ), DataColorimetry_VS( name="VS6", XYZ=np.array([0.15184114, 0.25076481, 0.28160235]), Lab=np.array([57.14986362, -44.01984887, -1.76443512]), - C=44.055196354398468, + C=np.array([44.055196354398468]), ), DataColorimetry_VS( name="VS7", XYZ=np.array([0.13956282, 0.25328776, 0.14470413]), Lab=np.array([57.39436644, -52.59240053, 24.11037488]), - C=57.8556027598421, + C=np.array([57.8556027598421]), ), DataColorimetry_VS( name="VS8", XYZ=np.array([0.24672357, 0.36210726, 0.11976641]), Lab=np.array([66.68062145, -37.45331629, 46.38001890]), - C=59.614235332660144, + C=np.array([59.614235332660144]), ), DataColorimetry_VS( name="VS9", XYZ=np.array([0.40820163, 0.50861708, 0.11894288]), Lab=np.array([76.59516365, -21.90847578, 63.69499819]), - C=67.357509638238682, + C=np.array([67.357509638238682]), ), DataColorimetry_VS( name="VS10", XYZ=np.array([0.56036726, 0.60569219, 0.10169199]), Lab=np.array([82.14661230, -3.82032735, 78.14954550]), - C=78.24286780890229, + C=np.array([78.24286780890229]), ), DataColorimetry_VS( name="VS11", XYZ=np.array([0.40540651, 0.38003446, 0.05753983]), Lab=np.array([68.02315451, 14.17690044, 69.54409225]), - C=70.974398718322206, + C=np.array([70.974398718322206]), ), DataColorimetry_VS( name="VS12", XYZ=np.array([0.45407809, 0.37920609, 0.08621297]), Lab=np.array([67.96206127, 28.93563884, 58.57062794]), - C=65.328321974859804, + C=np.array([65.328321974859804]), ), DataColorimetry_VS( name="VS13", XYZ=np.array([0.37207030, 0.27413935, 0.08882217]), Lab=np.array([59.35552778, 40.92542311, 42.87088737]), - C=59.268906188196901, + C=np.array([59.268906188196901]), ), DataColorimetry_VS( name="VS14", XYZ=np.array([0.19307398, 0.11049957, 0.04883445]), Lab=np.array([39.66448332, 53.96576475, 24.65796798]), - C=59.332277465127156, + C=np.array([59.332277465127156]), ), DataColorimetry_VS( name="VS15", XYZ=np.array([0.17306027, 0.10700056, 0.11280793]), Lab=np.array([39.07062485, 45.99788526, 0.67641984]), - C=46.002858517472262, + C=np.array([46.002858517472262]), ), - ], + ), ), ) - specification_t = colour_quality_scale( - SDS_ILLUMINANTS["FL1"], additional_data=True, method="NIST CQS 7.4" + specification_t = cast( + ColourRendering_Specification_CQS, + colour_quality_scale( + SDS_ILLUMINANTS["FL1"], additional_data=True, method="NIST CQS 7.4" + ), ) np.testing.assert_allclose( @@ -512,195 +535,198 @@ def test_colour_quality_scale(self): ), }, colorimetry_data=( - [ + ( DataColorimetry_VS( name="VS1", XYZ=np.array([0.14271715, 0.09107438, 0.04949462]), Lab=np.array([36.19033159, 40.77666015, 18.34813122]), - C=44.714538268056295, + C=np.array([44.714538268056295]), ), DataColorimetry_VS( name="VS2", XYZ=np.array([0.34657727, 0.27547744, 0.08900676]), Lab=np.array([59.47793328, 31.84647553, 43.02166698]), - C=53.526272364542265, + C=np.array([53.526272364542265]), ), DataColorimetry_VS( name="VS3", XYZ=np.array([0.41050103, 0.38688447, 0.06613576]), Lab=np.array([68.52498199, 13.58373774, 66.83110597]), - C=68.197614738277153, + C=np.array([68.197614738277153]), ), DataColorimetry_VS( name="VS4", XYZ=np.array([0.45427132, 0.50401485, 0.08193287]), Lab=np.array([76.31503360, -7.01311937, 74.42292542]), - C=74.752629859451574, + C=np.array([74.752629859451574]), ), DataColorimetry_VS( name="VS5", XYZ=np.array([0.42410903, 0.52851922, 0.11439811]), Lab=np.array([77.78749106, -22.21024992, 66.98873490]), - C=70.574682470722237, + C=np.array([70.574682470722237]), ), DataColorimetry_VS( name="VS6", XYZ=np.array([0.26141761, 0.36817692, 0.11429088]), Lab=np.array([67.14003019, -33.22377278, 48.66064673]), - C=58.920943801328043, + C=np.array([58.920943801328043]), ), DataColorimetry_VS( name="VS7", XYZ=np.array([0.14991085, 0.24929718, 0.13823960]), Lab=np.array([57.00687837, -44.55800078, 24.99093412]), - C=51.087789364109447, + C=np.array([51.087789364109447]), ), DataColorimetry_VS( name="VS8", XYZ=np.array([0.15843361, 0.24157338, 0.26933192]), Lab=np.array([56.24498073, -36.24891645, -1.43945699]), - C=36.277485856650493, + C=np.array([36.277485856650493]), ), DataColorimetry_VS( name="VS9", XYZ=np.array([0.18662998, 0.24708620, 0.40043672]), Lab=np.array([56.79040828, -23.15964795, -18.30797717]), - C=29.522048055967336, + C=np.array([29.522048055967336]), ), DataColorimetry_VS( name="VS10", XYZ=np.array([0.13339389, 0.15696027, 0.38421709]), Lab=np.array([46.57313267, -9.89412218, -33.95549821]), - C=35.367633681665495, + C=np.array([35.367633681665495]), ), DataColorimetry_VS( name="VS11", XYZ=np.array([0.09900743, 0.09954465, 0.32039098]), Lab=np.array([37.76058147, 3.51413565, -40.81527590]), - C=40.966277550944625, + C=np.array([40.966277550944625]), ), DataColorimetry_VS( name="VS12", XYZ=np.array([0.11576390, 0.09613722, 0.31928926]), Lab=np.array([37.14003664, 18.77460935, -41.73197608]), - C=45.760723157938472, + C=np.array([45.760723157938472]), ), DataColorimetry_VS( name="VS13", XYZ=np.array([0.20975356, 0.16847879, 0.37267453]), Lab=np.array([48.06778877, 25.97523691, -29.94366223]), - C=39.640078711661452, + C=np.array([39.640078711661452]), ), DataColorimetry_VS( name="VS14", XYZ=np.array([0.32298108, 0.24163045, 0.36212750]), Lab=np.array([56.25066973, 37.45976513, -14.49801776]), - C=40.167480906459893, + C=np.array([40.167480906459893]), ), DataColorimetry_VS( name="VS15", XYZ=np.array([0.22039693, 0.15371392, 0.17553541]), Lab=np.array([46.13873255, 39.31630210, -2.10769974]), - C=39.372757193029329, + C=np.array([39.372757193029329]), ), - ], - [ + ), + ( DataColorimetry_VS( name="VS1", XYZ=np.array([0.19307399, 0.11049957, 0.04883449]), Lab=np.array([39.66448335, 53.96576813, 24.65795205]), - C=59.332273930950407, + C=np.array([59.332273930950407]), ), DataColorimetry_VS( name="VS2", XYZ=np.array([0.37207030, 0.27413935, 0.08882218]), Lab=np.array([59.35552779, 40.92542394, 42.87088336]), - C=59.268903858924929, + C=np.array([59.268903858924929]), ), DataColorimetry_VS( name="VS3", XYZ=np.array([0.42080177, 0.37272049, 0.06618662]), Lab=np.array([67.48063529, 21.22017785, 65.01028998]), - C=68.385917784001094, + C=np.array([68.385917784001094]), ), DataColorimetry_VS( name="VS4", XYZ=np.array([0.46201298, 0.49481812, 0.08588402]), Lab=np.array([75.75009449, -2.36998858, 72.10803500]), - C=72.146971918467017, + C=np.array([72.146971918467017]), ), DataColorimetry_VS( name="VS5", XYZ=np.array([0.40820163, 0.50861708, 0.11894286]), Lab=np.array([76.59516364, -21.90847694, 63.69500310]), - C=67.35751466170575, + C=np.array([67.35751466170575]), ), DataColorimetry_VS( name="VS6", XYZ=np.array([0.24672357, 0.36210726, 0.11976641]), Lab=np.array([66.68062144, -37.45331655, 46.38001966]), - C=59.614236088535129, + C=np.array([59.614236088535129]), ), DataColorimetry_VS( name="VS7", XYZ=np.array([0.13956281, 0.25328776, 0.14470409]), Lab=np.array([57.39436642, -52.59240564, 24.11038403]), - C=57.855611215555271, + C=np.array([57.855611215555271]), ), DataColorimetry_VS( name="VS8", XYZ=np.array([0.15184111, 0.25076481, 0.28160222]), Lab=np.array([57.14986354, -44.01986548, -1.76441495]), - C=44.055212144295837, + C=np.array([44.055212144295837]), ), DataColorimetry_VS( name="VS9", XYZ=np.array([0.18145720, 0.25845953, 0.41319296]), Lab=np.array([57.89053974, -30.61154597, -17.92231311]), - C=35.472187042106164, + C=np.array([35.472187042106164]), ), DataColorimetry_VS( name="VS10", XYZ=np.array([0.13144449, 0.16803553, 0.39315843]), Lab=np.array([48.01155280, -17.36606803, -32.56732004]), - C=36.908138035180549, + C=np.array([36.908138035180549]), ), DataColorimetry_VS( name="VS11", XYZ=np.array([0.09725029, 0.10655822, 0.32331756]), Lab=np.array([38.99463289, -3.20501320, -39.09286753]), - C=39.224028364277721, + C=np.array([39.224028364277721]), ), DataColorimetry_VS( name="VS12", XYZ=np.array([0.11497971, 0.09965866, 0.31509326]), Lab=np.array([37.78109906, 15.45054732, -40.03995920]), - C=42.917569190579727, + C=np.array([42.917569190579727]), ), DataColorimetry_VS( name="VS13", XYZ=np.array([0.23125767, 0.17972670, 0.36038776]), Lab=np.array([49.46294201, 29.95248104, -25.97793559]), - C=39.648508903390763, + C=np.array([39.648508903390763]), ), DataColorimetry_VS( name="VS14", XYZ=np.array([0.35887695, 0.25609884, 0.35518732]), Lab=np.array([57.66488716, 43.83765559, -11.16556087]), - C=45.237261162848789, + C=np.array([45.237261162848789]), ), DataColorimetry_VS( name="VS15", XYZ=np.array([0.26552457, 0.17192965, 0.17300682]), Lab=np.array([48.50225789, 48.80528996, 2.49443403]), - C=48.868993532230895, + C=np.array([48.868993532230895]), ), - ], + ), ), ) - specification_t = colour_quality_scale( - SDS_ILLUMINANTS["FL1"], additional_data=True, method="NIST CQS 9.0" + specification_t = cast( + ColourRendering_Specification_CQS, + colour_quality_scale( + SDS_ILLUMINANTS["FL1"], additional_data=True, method="NIST CQS 9.0" + ), ) np.testing.assert_allclose( diff --git a/colour/quality/tests/test_cri.py b/colour/quality/tests/test_cri.py index 695962e84..9349ee4ce 100644 --- a/colour/quality/tests/test_cri.py +++ b/colour/quality/tests/test_cri.py @@ -6,6 +6,7 @@ from colour.colorimetry import SDS_ILLUMINANTS, SpectralDistribution from colour.constants import TOLERANCE_ABSOLUTE_TESTS +from colour.hints import cast from colour.quality import ( ColourRendering_Specification_CRI, colour_rendering_index, @@ -114,29 +115,29 @@ class TestColourRenderingIndex: definition unit tests methods. """ - def test_colour_rendering_index(self): + def test_colour_rendering_index(self) -> None: """Test :func:`colour.quality.cri.colour_rendering_index` definition.""" np.testing.assert_allclose( - colour_rendering_index(SDS_ILLUMINANTS["FL1"]), + cast(float, colour_rendering_index(SDS_ILLUMINANTS["FL1"])), 75.852827992149358, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_rendering_index(SDS_ILLUMINANTS["FL2"]), + cast(float, colour_rendering_index(SDS_ILLUMINANTS["FL2"])), 64.233724121664778, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_rendering_index(SDS_ILLUMINANTS["A"]), + cast(float, colour_rendering_index(SDS_ILLUMINANTS["A"])), 99.996230290506887, atol=TOLERANCE_ABSOLUTE_TESTS, ) np.testing.assert_allclose( - colour_rendering_index(SpectralDistribution(DATA_SAMPLE)), + cast(float, colour_rendering_index(SpectralDistribution(DATA_SAMPLE))), 70.815265381660197, atol=TOLERANCE_ABSOLUTE_TESTS, ) @@ -161,7 +162,7 @@ def test_colour_rendering_index(self): 14: DataColourQualityScale_TCS(name="TCS14", Q_a=94.884867470552663), }, colorimetry_data=( - [ + ( DataColorimetry_TCS( name="TCS01", XYZ=np.array([31.19561134, 29.74560797, 23.44190201]), @@ -246,8 +247,8 @@ def test_colour_rendering_index(self): uv=np.array([0.18328188, 0.35214117]), UVW=np.array([-6.11563143, 19.91896684, 40.34566797]), ), - ], - [ + ), + ( DataColorimetry_TCS( name="TCS01", XYZ=np.array([33.04774537, 29.80902109, 24.23929188]), @@ -332,12 +333,13 @@ def test_colour_rendering_index(self): uv=np.array([0.18597686, 0.34955284]), UVW=np.array([-6.34991066, 18.99712303, 39.76962229]), ), - ], + ), ), ) - specification_t = colour_rendering_index( - SDS_ILLUMINANTS["FL1"], additional_data=True + specification_t = cast( + ColourRendering_Specification_CRI, + colour_rendering_index(SDS_ILLUMINANTS["FL1"], additional_data=True), ) np.testing.assert_allclose( diff --git a/colour/quality/tests/test_ssi.py b/colour/quality/tests/test_ssi.py index 415a0ad12..051bbae5e 100644 --- a/colour/quality/tests/test_ssi.py +++ b/colour/quality/tests/test_ssi.py @@ -559,7 +559,7 @@ class TestSpectralSimilarityIndex: definition unit tests methods. """ - def test_spectral_similarity_index(self): + def test_spectral_similarity_index(self) -> None: """Test :func:`colour.quality.ssi.spectral_similarity_index` definition.""" assert ( @@ -573,7 +573,7 @@ def test_spectral_similarity_index(self): == 72.0 ) - def test_spectral_similarity_rounding(self): + def test_spectral_similarity_rounding(self) -> None: """ Test :func:`colour.quality.ssi.spectral_similarity_index` for producing continuous values. diff --git a/colour/quality/tests/test_tm3018.py b/colour/quality/tests/test_tm3018.py index 6d4661135..b06249d97 100644 --- a/colour/quality/tests/test_tm3018.py +++ b/colour/quality/tests/test_tm3018.py @@ -8,10 +8,14 @@ http://media.ies.org/docs/errata/TM-30-18_tools_etc.zip. """ +from __future__ import annotations + import numpy as np from colour.colorimetry import SDS_ILLUMINANTS +from colour.hints import cast from colour.quality.tm3018 import ( + ColourQuality_Specification_ANSIIESTM3018, averages_area, colour_fidelity_index_ANSIIESTM3018, ) @@ -36,14 +40,17 @@ class TestColourFidelityIndexANSIIESTM3018: definition unit tests methods. """ - def test_colour_fidelity_index_ANSIIESTM3018(self): + def test_colour_fidelity_index_ANSIIESTM3018(self) -> None: """ Test :func:`colour.quality.tm3018.colour_fidelity_index_ANSIIESTM3018` definition. """ - specification = colour_fidelity_index_ANSIIESTM3018( - SDS_ILLUMINANTS["FL2"], additional_data=True + specification = cast( + ColourQuality_Specification_ANSIIESTM3018, + colour_fidelity_index_ANSIIESTM3018( + SDS_ILLUMINANTS["FL2"], additional_data=True + ), ) np.testing.assert_allclose(specification.R_f, 70, atol=2e-1) @@ -197,7 +204,7 @@ class TestAveragesArea: methods. """ - def test_averages_area(self): + def test_averages_area(self) -> None: """Test :func:`colour.quality.tm3018.averages_area` definition.""" # Simple 3 * sqrt(2) by sqrt(2) rectangle. diff --git a/colour/recovery/jakob2019.py b/colour/recovery/jakob2019.py index 01cfbed36..3d8571278 100644 --- a/colour/recovery/jakob2019.py +++ b/colour/recovery/jakob2019.py @@ -790,7 +790,7 @@ def interpolator(self) -> RegularGridInterpolator: return self._interpolator - def _create_interpolator(self): + def _create_interpolator(self) -> None: """ Create a :class:`scipy.interpolate.RegularGridInterpolator` class instance for read or generated coefficients. @@ -810,7 +810,7 @@ def generate( illuminant: SpectralDistribution | None = None, size: int = 64, print_callable: Callable = print, - ): + ) -> None: """ Generate the lookup table data for given *RGB* colourspace, colour matching functions, illuminant and given size. diff --git a/colour/recovery/jiang2013.py b/colour/recovery/jiang2013.py index aa6bddd94..9416270b6 100644 --- a/colour/recovery/jiang2013.py +++ b/colour/recovery/jiang2013.py @@ -270,7 +270,7 @@ def RGB_to_msds_camera_sensitivities_Jiang2013( RGB: ArrayLike, illuminant: SpectralDistribution, reflectances: MultiSpectralDistributions, - basis_functions=BASIS_FUNCTIONS_DYER2017, + basis_functions: ArrayLike = BASIS_FUNCTIONS_DYER2017, shape: SpectralShape | None = None, ) -> MultiSpectralDistributions: """ @@ -369,6 +369,7 @@ def RGB_to_msds_camera_sensitivities_Jiang2013( """ R, G, B = tsplit(np.reshape(RGB, [-1, 3])) + basis_functions = as_float_array(basis_functions) shape = optional(shape, illuminant.shape) R_w, G_w, B_w = tsplit(np.moveaxis(basis_functions, 0, 1)) diff --git a/colour/recovery/otsu2018.py b/colour/recovery/otsu2018.py index bbe76fc6a..c5f58cc39 100644 --- a/colour/recovery/otsu2018.py +++ b/colour/recovery/otsu2018.py @@ -181,7 +181,7 @@ def shape(self) -> SpectralShape | None: Returns ------- - :py:data:`None` or :class:`colour.SpectralShape` + :class:`colour.SpectralShape` or :py:data:`None` Shape used by the *Otsu et al. (2018)* dataset. """ @@ -195,7 +195,7 @@ def basis_functions(self) -> NDArrayFloat | None: Returns ------- - :py:data:`None` or :class:`numpy.ndarray` + :class:`numpy.ndarray` or :py:data:`None` Basis functions of the *Otsu et al. (2018)* dataset. """ @@ -208,7 +208,7 @@ def means(self) -> NDArrayFloat | None: Returns ------- - :py:data:`None` or :class:`numpy.ndarray` + :class:`numpy.ndarray` or :py:data:`None` Means of the *Otsu et al. (2018)* dataset. """ @@ -222,7 +222,7 @@ def selector_array(self) -> NDArrayFloat | None: Returns ------- - :py:data:`None` or :class:`numpy.ndarray` + :class:`numpy.ndarray` or :py:data:`None` Selector array of the *Otsu et al. (2018)* dataset. """ @@ -691,7 +691,7 @@ def reflectances(self) -> NDArrayFloat | None: return self._reflectances @reflectances.setter - def reflectances(self, value: ArrayLike | None): + def reflectances(self, value: ArrayLike | None) -> None: """Setter for the **self.reflectances** property.""" if value is not None: @@ -1006,7 +1006,7 @@ def __init__( self, parent: Self | None = None, children: list | None = None, - data: Self | None = None, + data: Data_Otsu2018 | None = None, ) -> None: super().__init__(parent=parent, children=children, data=data) @@ -1054,7 +1054,7 @@ def row(self) -> Tuple[float, float, Self, Self]: else: raise ValueError('The "partition axis" is undefined!') - def split(self, children: Sequence[Self], axis: PartitionAxis): + def split(self, children: Sequence[Self], axis: PartitionAxis) -> None: """ Convert the leaf node into an inner node using given children and partition axis. @@ -1372,7 +1372,7 @@ def optimise( iterations: int = 8, minimum_cluster_size: int | None = None, print_callable: Callable = print, - ): + ) -> None: """ Optimise the tree by repeatedly performing optimal partitioning of the nodes, creating a tree that minimises the total reconstruction error. diff --git a/colour/recovery/tests/test__init__.py b/colour/recovery/tests/test__init__.py index f0ac2d95e..e2d27e1cf 100644 --- a/colour/recovery/tests/test__init__.py +++ b/colour/recovery/tests/test__init__.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.recovery` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry import ( @@ -32,7 +34,7 @@ class TestXYZ_to_sd: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._cmfs = reshape_msds( @@ -42,7 +44,7 @@ def setup_method(self): self._sd_D65 = reshape_sd(SDS_ILLUMINANTS["D65"], self._cmfs.shape) - def test_domain_range_scale_XYZ_to_sd(self): + def test_domain_range_scale_XYZ_to_sd(self) -> None: """ Test :func:`colour.recovery.XYZ_to_sd` definition domain and range scale support. diff --git a/colour/recovery/tests/test_jakob2019.py b/colour/recovery/tests/test_jakob2019.py index 6406ee478..105b19585 100644 --- a/colour/recovery/tests/test_jakob2019.py +++ b/colour/recovery/tests/test_jakob2019.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.recovery.jakob2019` module.""" +from __future__ import annotations + import os import shutil import tempfile @@ -11,6 +13,7 @@ from colour.colorimetry import handle_spectral_arguments, sd_to_XYZ from colour.constants import TOLERANCE_ABSOLUTE_TESTS from colour.difference import JND_CIE1976, delta_E_CIE1976 +from colour.hints import Type from colour.models import ( RGB_COLOURSPACE_sRGB, RGB_to_XYZ, @@ -47,7 +50,7 @@ class TestErrorFunction: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._shape = SPECTRAL_SHAPE_JAKOB2019 @@ -57,7 +60,7 @@ def setup_method(self): self._Lab_e = np.array([72, -20, 61]) - def test_intermediates(self): + def test_intermediates(self) -> None: """ Test intermediate results of :func:`colour.recovery.jakob2019.error_function` with @@ -81,7 +84,7 @@ def test_intermediates(self): ] for coefficients in coefficient_list: - error, _derror, R, XYZ, Lab = error_function( + error, _derror, R, XYZ, Lab = error_function( # pyright: ignore coefficients, self._Lab_e, self._cmfs, @@ -104,7 +107,7 @@ def test_intermediates(self): assert abs(error_reference - error) < JND_CIE1976 / 100 assert delta_E_CIE1976(Lab, sd_Lab) < JND_CIE1976 / 100 - def test_derivatives(self): + def test_derivatives(self) -> None: """ Test the gradients computed using closed-form expressions of the derivatives with finite difference approximations. @@ -122,7 +125,7 @@ def test_derivatives(self): coefficients = ones(3) coefficients[coefficient_i] = sample - error, derror = error_function( + error, derror = error_function( # pyright: ignore coefficients, self._Lab_e, self._cmfs, self._sd_D65 ) @@ -145,13 +148,13 @@ class TestXYZ_to_sd_Jakob2019: unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._shape = SPECTRAL_SHAPE_JAKOB2019 self._cmfs, self._sd_D65 = handle_spectral_arguments(shape_default=self._shape) - def test_XYZ_to_sd_Jakob2019(self): + def test_XYZ_to_sd_Jakob2019(self) -> None: """Test :func:`colour.recovery.jakob2019.XYZ_to_sd_Jakob2019` definition.""" # Tests the round-trip with values of a colour checker. @@ -165,7 +168,7 @@ def test_XYZ_to_sd_Jakob2019(self): if error > JND_CIE1976 / 100: # pragma: no cover pytest.fail(f"Delta E for '{name}' is {error}!") - def test_domain_range_scale_XYZ_to_sd_Jakob2019(self): + def test_domain_range_scale_XYZ_to_sd_Jakob2019(self) -> None: """ Test :func:`colour.recovery.jakob2019.XYZ_to_sd_Jakob2019` definition domain and range scale support. @@ -173,7 +176,7 @@ def test_domain_range_scale_XYZ_to_sd_Jakob2019(self): XYZ_i = np.array([0.20654008, 0.12197225, 0.05136952]) XYZ_o = sd_to_XYZ( - XYZ_to_sd_Jakob2019(XYZ_i, self._cmfs, self._sd_D65), + XYZ_to_sd_Jakob2019(XYZ_i, self._cmfs, self._sd_D65, additional_data=False), # pyright: ignore self._cmfs, self._sd_D65, ) @@ -181,9 +184,14 @@ def test_domain_range_scale_XYZ_to_sd_Jakob2019(self): d_r = (("reference", 1, 1), ("1", 1, 0.01), ("100", 100, 1)) for scale, factor_a, factor_b in d_r: with domain_range_scale(scale): - np.testing.assert_allclose( + np.testing.assert_allclose( # pyright: ignore sd_to_XYZ( - XYZ_to_sd_Jakob2019(XYZ_i * factor_a, self._cmfs, self._sd_D65), + XYZ_to_sd_Jakob2019( + XYZ_i * factor_a, + self._cmfs, + self._sd_D65, + additional_data=False, + ), # pyright: ignore self._cmfs, self._sd_D65, ), @@ -199,7 +207,7 @@ class TestLUT3D_Jakob2019: """ @classmethod - def generate_LUT(cls): + def generate_LUT(cls: Type[TestLUT3D_Jakob2019]) -> LUT3D_Jakob2019: """ Generate the *LUT* used for the unit tests. @@ -223,7 +231,7 @@ def generate_LUT(cls): return cls._LUT - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -236,7 +244,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(LUT3D_Jakob2019) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -251,12 +259,12 @@ def test_required_methods(self): for method in required_methods: assert method in dir(LUT3D_Jakob2019) - def test_size(self): + def test_size(self) -> None: """Test :attr:`colour.recovery.jakob2019.LUT3D_Jakob2019.size` property.""" assert TestLUT3D_Jakob2019.generate_LUT().size == 5 - def test_lightness_scale(self): + def test_lightness_scale(self) -> None: """ Test :attr:`colour.recovery.jakob2019.LUT3D_Jakob2019.lightness_scale` property. @@ -268,7 +276,7 @@ def test_lightness_scale(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_coefficients(self): + def test_coefficients(self) -> None: """ Test :attr:`colour.recovery.jakob2019.LUT3D_Jakob2019.coefficients` property. @@ -276,7 +284,7 @@ def test_coefficients(self): assert TestLUT3D_Jakob2019.generate_LUT().coefficients.shape == (3, 5, 5, 5, 3) - def test_LUT3D_Jakob2019(self): + def test_LUT3D_Jakob2019(self) -> None: """ Test the entirety of the :class:`colour.recovery.jakob2019.LUT3D_Jakob2019`class. @@ -327,7 +335,7 @@ def test_LUT3D_Jakob2019(self): f"{self._RGB_colourspace.name} is {error}!" ) - def test_raise_exception_RGB_to_coefficients(self): + def test_raise_exception_RGB_to_coefficients(self) -> None: """ Test :func:`colour.recovery.jakob2019.LUT3D_Jakob2019.\ RGB_to_coefficients` method raised exception. @@ -337,7 +345,7 @@ def test_raise_exception_RGB_to_coefficients(self): pytest.raises(RuntimeError, LUT.RGB_to_coefficients, np.array([1, 2, 3, 4])) - def test_raise_exception_read(self): + def test_raise_exception_read(self) -> None: """ Test :func:`colour.recovery.jakob2019.LUT3D_Jakob2019.read` method raised exception. diff --git a/colour/recovery/tests/test_jiang2013.py b/colour/recovery/tests/test_jiang2013.py index c52a9606d..d08759c5a 100644 --- a/colour/recovery/tests/test_jiang2013.py +++ b/colour/recovery/tests/test_jiang2013.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.recovery.jiang2013` module.""" +from __future__ import annotations + import platform import numpy as np @@ -50,7 +52,7 @@ class TestPCA_Jiang2013: tests methods. """ - def test_PCA_Jiang2013(self): + def test_PCA_Jiang2013(self) -> None: """Test :func:`colour.recovery.jiang2013.PCA_Jiang2013` definition.""" if platform.system() in ("Windows", "Microsoft", "Linux"): @@ -61,7 +63,11 @@ def test_PCA_Jiang2013(self): camera: msds.copy().align(shape) for camera, msds in MSDS_CAMERA_SENSITIVITIES.items() } - w, v = PCA_Jiang2013(camera_sensitivities, 3, True) + w, v = PCA_Jiang2013( # pyright: ignore + camera_sensitivities, + 3, + additional_data=True, + ) np.testing.assert_allclose( np.abs(np.array(w)), @@ -218,12 +224,12 @@ class TestRGB_to_sd_camera_sensitivity_Jiang2013(FixtureJiang2013): definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" FixtureJiang2013.__init__(self) - def test_RGB_to_sd_camera_sensitivity_Jiang2013(self): + def test_RGB_to_sd_camera_sensitivity_Jiang2013(self) -> None: """ Test :func:`colour.recovery.jiang2013.\ RGB_to_sd_camera_sensitivity_Jiang2013` definition. @@ -284,12 +290,12 @@ class TestRGB_to_msds_camera_sensitivities_Jiang2013(FixtureJiang2013): RGB_to_msds_camera_sensitivities_Jiang2013` definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" FixtureJiang2013.__init__(self) - def test_RGB_to_msds_camera_sensitivities_Jiang2013(self): + def test_RGB_to_msds_camera_sensitivities_Jiang2013(self) -> None: """ Test :func:`colour.recovery.jiang2013.\ RGB_to_msds_camera_sensitivities_Jiang2013` definition. diff --git a/colour/recovery/tests/test_mallett2019.py b/colour/recovery/tests/test_mallett2019.py index 2603fd6ae..de8df56f8 100644 --- a/colour/recovery/tests/test_mallett2019.py +++ b/colour/recovery/tests/test_mallett2019.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.recovery.mallett2019` module.""" +from __future__ import annotations + import numpy as np import pytest @@ -43,10 +45,9 @@ class FixtureMallett2019: """A fixture for testing the :mod:`colour.recovery.mallett2019` module.""" - @pytest.fixture(autouse=True) - def setup_fixture_mallett_2019(self) -> None: - """Configure the class instance.""" - + def __init__(self) -> None: + self._basis = MSDS_BASIS_FUNCTIONS_sRGB_MALLETT2019 + self._RGB_colourspace = RGB_COLOURSPACE_sRGB self._cmfs = reshape_msds( MSDS_CMFS["CIE 1931 2 Degree Standard Observer"], SpectralShape(360, 780, 10), @@ -54,7 +55,13 @@ def setup_fixture_mallett_2019(self) -> None: self._sd_D65 = reshape_sd(SDS_ILLUMINANTS["D65"], self._cmfs.shape) self._xy_D65 = CCS_ILLUMINANTS["CIE 1931 2 Degree Standard Observer"]["D65"] - def check_basis_functions(self): + @pytest.fixture(autouse=True) + def setup_fixture_mallett_2019(self) -> None: + """Configure the class instance.""" + + self.__init__() + + def check_basis_functions(self) -> None: """ Test :func:`colour.recovery.RGB_to_sd_Mallett2019` definition or the more specialised :func:`colour.recovery.RGB_to_sd_Mallett2019` @@ -97,14 +104,14 @@ class TestSpectralPrimaryDecompositionMallett2019(FixtureMallett2019): spectral_primary_decomposition_Mallett2019` definition unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" FixtureMallett2019.__init__(self) self._RGB_colourspace = RGB_COLOURSPACE_PAL_SECAM - def test_spectral_primary_decomposition_Mallett2019(self): + def test_spectral_primary_decomposition_Mallett2019(self) -> None: """ Test :func:`colour.recovery.mallett2019.\ test_spectral_primary_decomposition_Mallett2019` definition. @@ -123,7 +130,7 @@ class TestRGB_to_sd_Mallett2019(FixtureMallett2019): unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" FixtureMallett2019.__init__(self) @@ -131,7 +138,7 @@ def setup_method(self): self._RGB_colourspace = RGB_COLOURSPACE_sRGB self._basis = MSDS_BASIS_FUNCTIONS_sRGB_MALLETT2019 - def test_RGB_to_sd_Mallett2019(self): + def test_RGB_to_sd_Mallett2019(self) -> None: """ Test :func:`colour.recovery.mallett2019.RGB_to_sd_Mallett2019` definition. diff --git a/colour/recovery/tests/test_meng2015.py b/colour/recovery/tests/test_meng2015.py index 7c9f625a2..b347f8047 100644 --- a/colour/recovery/tests/test_meng2015.py +++ b/colour/recovery/tests/test_meng2015.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.recovery.meng2015` module.""" +from __future__ import annotations + import numpy as np import pytest @@ -33,7 +35,7 @@ class TestXYZ_to_sd_Meng2015: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._cmfs = reshape_msds( @@ -43,7 +45,7 @@ def setup_method(self): self._sd_D65 = reshape_sd(SDS_ILLUMINANTS["D65"], self._cmfs.shape) self._sd_E = reshape_sd(SDS_ILLUMINANTS["E"], self._cmfs.shape) - def test_XYZ_to_sd_Meng2015(self): + def test_XYZ_to_sd_Meng2015(self) -> None: """Test :func:`colour.recovery.meng2015.XYZ_to_sd_Meng2015` definition.""" XYZ = np.array([0.20654008, 0.12197225, 0.05136952]) @@ -100,7 +102,7 @@ def test_XYZ_to_sd_Meng2015(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_XYZ_to_sd_Meng2015(self): + def test_raise_exception_XYZ_to_sd_Meng2015(self) -> None: """ Test :func:`colour.recovery.meng2015.XYZ_to_sd_Meng2015` definition raised exception. @@ -115,7 +117,7 @@ def test_raise_exception_XYZ_to_sd_Meng2015(self): }, ) - def test_domain_range_scale_XYZ_to_sd_Meng2015(self): + def test_domain_range_scale_XYZ_to_sd_Meng2015(self) -> None: """ Test :func:`colour.recovery.meng2015.XYZ_to_sd_Meng2015` definition domain and range scale support. diff --git a/colour/recovery/tests/test_otsu2018.py b/colour/recovery/tests/test_otsu2018.py index 127794f49..77a7e1ba2 100644 --- a/colour/recovery/tests/test_otsu2018.py +++ b/colour/recovery/tests/test_otsu2018.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.recovery.jakob2019` module.""" +from __future__ import annotations + import os import platform import shutil @@ -55,7 +57,7 @@ class TestDataset_Otsu2018: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._dataset = DATASET_REFERENCE_OTSU2018 @@ -66,12 +68,12 @@ def setup_method(self): self._path = os.path.join(self._temporary_directory, "Test_Otsu2018.npz") self._dataset.write(self._path) - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -84,7 +86,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(Dataset_Otsu2018) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -99,48 +101,51 @@ def test_required_methods(self): for method in required_methods: assert method in dir(Dataset_Otsu2018) - def test_shape(self): + def test_shape(self) -> None: """Test :attr:`colour.recovery.otsu2018.Dataset_Otsu2018.shape` property.""" assert self._dataset.shape == SPECTRAL_SHAPE_OTSU2018 - def test_basis_functions(self): + def test_basis_functions(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Dataset_Otsu2018.basis_functions` property. """ + assert self._dataset.basis_functions is not None assert self._dataset.basis_functions.shape == (8, 3, 36) - def test_means(self): + def test_means(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Dataset_Otsu2018.means` property. """ + assert self._dataset.means is not None assert self._dataset.means.shape == (8, 36) - def test_selector_array(self): + def test_selector_array(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Dataset_Otsu2018.selector_array` property. """ + assert self._dataset.selector_array is not None assert self._dataset.selector_array.shape == (7, 4) - def test__str__(self): + def test__str__(self) -> None: """Test :meth:`colour.recovery.otsu2018.Dataset_Otsu2018.__str__` method.""" assert str(self._dataset) == "Dataset_Otsu2018(8 basis functions)" assert str(Dataset_Otsu2018()) == "Dataset_Otsu2018()" - def test_select(self): + def test_select(self) -> None: """Test :meth:`colour.recovery.otsu2018.Dataset_Otsu2018.select` method.""" assert self._dataset.select(self._xy) == 6 - def test_raise_exception_select(self): + def test_raise_exception_select(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Dataset_Otsu2018.select` method raised exception. @@ -148,14 +153,14 @@ def test_raise_exception_select(self): pytest.raises(ValueError, Dataset_Otsu2018().select, np.array([0, 0])) - def test_cluster(self): + def test_cluster(self) -> None: """Test :meth:`colour.recovery.otsu2018.Dataset_Otsu2018.cluster` method.""" basis_functions, means = self._dataset.cluster(self._xy) assert basis_functions.shape == (3, 36) assert means.shape == (36,) - def test_raise_exception_cluster(self): + def test_raise_exception_cluster(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Dataset_Otsu2018.cluster` method raised exception. @@ -163,18 +168,21 @@ def test_raise_exception_cluster(self): pytest.raises(ValueError, Dataset_Otsu2018().cluster, np.array([0, 0])) - def test_read(self): + def test_read(self) -> None: """Test :meth:`colour.recovery.otsu2018.Dataset_Otsu2018.read` method.""" dataset = Dataset_Otsu2018() dataset.read(self._path) assert dataset.shape == SPECTRAL_SHAPE_OTSU2018 + assert dataset.basis_functions is not None assert dataset.basis_functions.shape == (8, 3, 36) + assert dataset.means is not None assert dataset.means.shape == (8, 36) + assert dataset.selector_array is not None assert dataset.selector_array.shape == (7, 4) - def test_write(self): + def test_write(self) -> None: """Test :meth:`colour.recovery.otsu2018.Dataset_Otsu2018.write` method.""" self._dataset.write(self._path) @@ -183,11 +191,14 @@ def test_write(self): dataset.read(self._path) assert dataset.shape == SPECTRAL_SHAPE_OTSU2018 + assert dataset.basis_functions is not None assert dataset.basis_functions.shape == (8, 3, 36) + assert dataset.means is not None assert dataset.means.shape == (8, 36) + assert dataset.selector_array is not None assert dataset.selector_array.shape == (7, 4) - def test_raise_exception_write(self): + def test_raise_exception_write(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Dataset_Otsu2018.write` method raised exception. @@ -202,7 +213,7 @@ class TestXYZ_to_sd_Otsu2018: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._shape = SPECTRAL_SHAPE_OTSU2018 @@ -210,7 +221,7 @@ def setup_method(self): self._XYZ_D65 = sd_to_XYZ(self._sd_D65) self._xy_D65 = XYZ_to_xy(self._XYZ_D65) - def test_XYZ_to_sd_Otsu2018(self): + def test_XYZ_to_sd_Otsu2018(self) -> None: """Test :func:`colour.recovery.otsu2018.XYZ_to_sd_Otsu2018` definition.""" # Tests the round-trip with values of a colour checker. @@ -231,7 +242,7 @@ def test_XYZ_to_sd_Otsu2018(self): delta_E = delta_E_CIE1976(Lab, recovered_Lab) assert delta_E < 1e-12 - def test_raise_exception_XYZ_to_sd_Otsu2018(self): + def test_raise_exception_XYZ_to_sd_Otsu2018(self) -> None: """ Test :func:`colour.recovery.otsu2018.XYZ_to_sd_Otsu2018` definition raised_exception. @@ -246,7 +257,7 @@ def test_raise_exception_XYZ_to_sd_Otsu2018(self): Dataset_Otsu2018(), ) - def test_domain_range_scale_XYZ_to_sd_Otsu2018(self): + def test_domain_range_scale_XYZ_to_sd_Otsu2018(self) -> None: """ Test :func:`colour.recovery.otsu2018.XYZ_to_sd_Otsu2018` definition domain and range scale support. @@ -279,7 +290,7 @@ class TestData_Otsu2018: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._shape = SPECTRAL_SHAPE_OTSU2018 @@ -296,7 +307,7 @@ def setup_method(self): self._data = Data_Otsu2018(self._reflectances, self._cmfs, self._sd_D65) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -310,7 +321,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(Data_Otsu2018) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -327,7 +338,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(Data_Otsu2018) - def test_reflectances(self): + def test_reflectances(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Data_Otsu2018.reflectances` property. @@ -335,12 +346,12 @@ def test_reflectances(self): assert self._data.reflectances is self._reflectances - def test_cmfs(self): + def test_cmfs(self) -> None: """Test :attr:`colour.recovery.otsu2018.Data_Otsu2018.cmfs` property.""" assert self._data.cmfs is self._cmfs - def test_illuminant(self): + def test_illuminant(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Data_Otsu2018.illuminant` property. @@ -348,7 +359,7 @@ def test_illuminant(self): assert self._data.illuminant is self._sd_D65 - def test_basis_functions(self): + def test_basis_functions(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Data_Otsu2018.basis_functions` property. @@ -360,9 +371,10 @@ def test_basis_functions(self): data.PCA() + assert data.basis_functions is not None assert data.basis_functions.shape == (3, 36) - def test_mean(self): + def test_mean(self) -> None: """Test :attr:`colour.recovery.otsu2018.Data_Otsu2018.mean` property.""" data = Data_Otsu2018(self._reflectances, self._cmfs, self._sd_D65) @@ -371,19 +383,20 @@ def test_mean(self): data.PCA() + assert data.mean is not None assert data.mean.shape == (36,) - def test__str__(self): + def test__str__(self) -> None: """Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.__str__` method.""" assert str(self._data) == "Data_Otsu2018(24 Reflectances)" - def test__len__(self): + def test__len__(self) -> None: """Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.__len__` method.""" assert len(self._data) == 24 - def test_origin(self): + def test_origin(self) -> None: """Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.origin` method.""" np.testing.assert_allclose( @@ -392,7 +405,7 @@ def test_origin(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_origin(self): + def test_raise_exception_origin(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.origin` method raised exception. @@ -405,14 +418,14 @@ def test_raise_exception_origin(self): 1, ) - def test_partition(self): + def test_partition(self) -> None: """Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.partition` method.""" partition = self._data.partition(PartitionAxis(4, 1)) assert len(partition) == 2 - def test_raise_exception_partition(self): + def test_raise_exception_partition(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.partition` method raised exception. @@ -424,7 +437,7 @@ def test_raise_exception_partition(self): PartitionAxis(4, 1), ) - def test_PCA(self): + def test_PCA(self) -> None: """Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.PCA` method.""" if platform.system() in ("Windows", "Microsoft", "Linux"): @@ -434,6 +447,8 @@ def test_PCA(self): data.PCA() + assert data.basis_functions is not None + np.testing.assert_allclose( np.abs(data.basis_functions), np.array( @@ -557,6 +572,8 @@ def test_PCA(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) + assert data.mean is not None + np.testing.assert_allclose( data.mean, np.array( @@ -602,7 +619,7 @@ def test_PCA(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_reconstruct(self): + def test_reconstruct(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.reconstruct` method. @@ -665,7 +682,7 @@ def test_reconstruct(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_reconstruct(self): + def test_raise_exception_reconstruct(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.reconstruct` method raised exception. @@ -677,7 +694,7 @@ def test_raise_exception_reconstruct(self): np.array([0, 0, 0]), ) - def test_reconstruction_error(self): + def test_reconstruction_error(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.\ reconstruction_error` method. @@ -691,7 +708,7 @@ def test_reconstruction_error(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_raise_exception_reconstruction_error(self): + def test_raise_exception_reconstruction_error(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Data_Otsu2018.\ reconstruction_error` method raised exception. @@ -709,7 +726,7 @@ class TestNode_Otsu2018: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._shape = SPECTRAL_SHAPE_OTSU2018 @@ -736,7 +753,7 @@ def setup_method(self): self._partition_axis = self._node_a.partition_axis - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("partition_axis", "row") @@ -744,7 +761,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(Node_Otsu2018) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -758,7 +775,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(Node_Otsu2018) - def test_partition_axis(self): + def test_partition_axis(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Node_Otsu2018.partition_axis` property. @@ -766,7 +783,7 @@ def test_partition_axis(self): assert self._node_a.partition_axis is self._partition_axis - def test_row(self): + def test_row(self) -> None: """Test :attr:`colour.recovery.otsu2018.Node_Otsu2018.row` property.""" assert self._node_a.row == ( @@ -776,7 +793,7 @@ def test_row(self): self._node_c, ) - def test_raise_exception_row(self): + def test_raise_exception_row(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Node_Otsu2018.row` property raised exception. @@ -784,7 +801,7 @@ def test_raise_exception_row(self): pytest.raises(ValueError, lambda: Node_Otsu2018().row) - def test_split(self): + def test_split(self) -> None: """Test :meth:`colour.recovery.otsu2018.Node_Otsu2018.split` method.""" node_a = Node_Otsu2018(self._tree, None) @@ -794,7 +811,7 @@ def test_split(self): assert len(node_a.children) == 2 - def test_minimise(self): + def test_minimise(self) -> None: """Test :meth:`colour.recovery.otsu2018.Node_Otsu2018.minimise` method.""" node = Node_Otsu2018(data=self._data_a) @@ -809,7 +826,7 @@ def test_minimise(self): partition_error, 2.0402980027, atol=TOLERANCE_ABSOLUTE_TESTS ) - def test_leaf_reconstruction_error(self): + def test_leaf_reconstruction_error(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Node_Otsu2018.\ leaf_reconstruction_error` method. @@ -821,7 +838,7 @@ def test_leaf_reconstruction_error(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_branch_reconstruction_error(self): + def test_branch_reconstruction_error(self) -> None: """ Test :meth:`colour.recovery.otsu2018.Node_Otsu2018.\ branch_reconstruction_error` method. @@ -840,7 +857,7 @@ class TestTree_Otsu2018: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._shape = SPECTRAL_SHAPE_OTSU2018 @@ -860,12 +877,12 @@ def setup_method(self): self._path = os.path.join(self._temporary_directory, "Test_Otsu2018.npz") - def teardown_method(self): + def teardown_method(self) -> None: """After tests actions.""" shutil.rmtree(self._temporary_directory) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("reflectances", "cmfs", "illuminant") @@ -873,7 +890,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(Tree_Otsu2018) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__", "__str__", "optimise", "to_dataset") @@ -881,7 +898,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(Tree_Otsu2018) - def test_reflectances(self): + def test_reflectances(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Tree_Otsu2018.reflectances` property. @@ -897,12 +914,12 @@ def test_reflectances(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_cmfs(self): + def test_cmfs(self) -> None: """Test :attr:`colour.recovery.otsu2018.Tree_Otsu2018.cmfs` property.""" assert self._tree.cmfs is self._cmfs - def test_illuminant(self): + def test_illuminant(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Tree_Otsu2018.illuminant` property. @@ -910,7 +927,7 @@ def test_illuminant(self): assert self._tree.illuminant is self._sd_D65 - def test_optimise(self): + def test_optimise(self) -> None: """Test :class:`colour.recovery.otsu2018.Tree_Otsu2018.optimise` method.""" node_tree = Tree_Otsu2018(self._reflectances, self._cmfs, self._sd_D65) @@ -941,7 +958,7 @@ def test_optimise(self): delta_E = delta_E_CIE1976(Lab, recovered_Lab) assert delta_E < 1e-12 - def test_to_dataset(self): + def test_to_dataset(self) -> None: """ Test :attr:`colour.recovery.otsu2018.Tree_Otsu2018.to_dataset` method. diff --git a/colour/recovery/tests/test_smits1999.py b/colour/recovery/tests/test_smits1999.py index 44394a2f4..48dc62ca5 100644 --- a/colour/recovery/tests/test_smits1999.py +++ b/colour/recovery/tests/test_smits1999.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.recovery.smits1999` module.""" +from __future__ import annotations + import numpy as np from colour.colorimetry import sd_to_XYZ_integration @@ -26,7 +28,7 @@ class TestRGB_to_sd_Smits1999: definition unit tests methods. """ - def test_RGB_to_sd_Smits1999(self): + def test_RGB_to_sd_Smits1999(self) -> None: """ Test :func:`colour.recovery.smits1999.RGB_to_sd_Smits1999` definition. @@ -152,7 +154,7 @@ def test_RGB_to_sd_Smits1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_domain_range_scale_RGB_to_sd_Smits1999(self): + def test_domain_range_scale_RGB_to_sd_Smits1999(self) -> None: """ Test :func:`colour.recovery.smits1999.RGB_to_sd_Smits1999` definition domain and range scale support. diff --git a/colour/temperature/ohno2013.py b/colour/temperature/ohno2013.py index a204cea2b..f0a4039bf 100644 --- a/colour/temperature/ohno2013.py +++ b/colour/temperature/ohno2013.py @@ -340,7 +340,7 @@ def XYZ_to_CCT_Ohno2013( start: float | None = None, end: float | None = None, spacing: float | None = None, -): +) -> NDArrayFloat: """ Return the correlated colour temperature :math:`T_{cp}` and :math:`\\Delta_{uv}` from given *CIE XYZ* tristimulus values, colour @@ -391,7 +391,7 @@ def XYZ_to_CCT_Ohno2013( def CCT_to_XYZ_Ohno2013( CCT_D_uv: ArrayLike, cmfs: MultiSpectralDistributions | None = None -): +) -> NDArrayFloat: """ Return the *CIE XYZ* tristimulus values from given correlated colour temperature :math:`T_{cp}`, :math:`\\Delta_{uv}` and colour matching diff --git a/colour/temperature/tests/test_cie_d.py b/colour/temperature/tests/test_cie_d.py index f20ff4606..6e8e47376 100644 --- a/colour/temperature/tests/test_cie_d.py +++ b/colour/temperature/tests/test_cie_d.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.temperature.cie_d` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXy_to_CCT_CIE_D: tests methods. """ - def test_xy_to_CCT_CIE_D(self): + def test_xy_to_CCT_CIE_D(self) -> None: """Test :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition.""" np.testing.assert_allclose( @@ -57,7 +59,7 @@ def test_xy_to_CCT_CIE_D(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_CCT_CIE_D(self): + def test_n_dimensional_xy_to_CCT_CIE_D(self) -> None: """ Test :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition n-dimensional arrays support. @@ -79,7 +81,7 @@ def test_n_dimensional_xy_to_CCT_CIE_D(self): ) @ignore_numpy_errors - def test_nan_xy_to_CCT_CIE_D(self): + def test_nan_xy_to_CCT_CIE_D(self) -> None: """ Test :func:`colour.temperature.cie_d.xy_to_CCT_CIE_D` definition nan support. @@ -96,7 +98,7 @@ class TestCCT_to_xy_CIE_D: unit tests methods. """ - def test_CCT_to_xy_CIE_D(self): + def test_CCT_to_xy_CIE_D(self) -> None: """Test :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition.""" np.testing.assert_allclose( @@ -117,7 +119,7 @@ def test_CCT_to_xy_CIE_D(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_xy_CIE_D(self): + def test_n_dimensional_CCT_to_xy_CIE_D(self) -> None: """ Test :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition n-dimensional arrays support. @@ -139,7 +141,7 @@ def test_n_dimensional_CCT_to_xy_CIE_D(self): ) @ignore_numpy_errors - def test_nan_CCT_to_xy_CIE_D(self): + def test_nan_CCT_to_xy_CIE_D(self) -> None: """ Test :func:`colour.temperature.cie_d.CCT_to_xy_CIE_D` definition nan support. diff --git a/colour/temperature/tests/test_hernandez1999.py b/colour/temperature/tests/test_hernandez1999.py index 3423a8de2..920f8c77f 100644 --- a/colour/temperature/tests/test_hernandez1999.py +++ b/colour/temperature/tests/test_hernandez1999.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.temperature.hernandez1999` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class Testxy_to_CCT_Hernandez1999: definition unit tests methods. """ - def test_xy_to_CCT_Hernandez1999(self): + def test_xy_to_CCT_Hernandez1999(self) -> None: """ Test :func:`colour.temperature.hernandez1999.xy_to_CCT_McCamy1992` definition. @@ -51,7 +53,7 @@ def test_xy_to_CCT_Hernandez1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_CCT_Hernandez1999(self): + def test_n_dimensional_xy_to_CCT_Hernandez1999(self) -> None: """ Test :func:`colour.temperature.hernandez1999.xy_to_CCT_Hernandez1999` definition n-dimensional arrays support. @@ -73,7 +75,7 @@ def test_n_dimensional_xy_to_CCT_Hernandez1999(self): ) @ignore_numpy_errors - def test_nan_xy_to_CCT_Hernandez1999(self): + def test_nan_xy_to_CCT_Hernandez1999(self) -> None: """ Test :func:`colour.temperature.hernandez1999.xy_to_CCT_Hernandez1999` definition nan support. @@ -90,7 +92,7 @@ class TestCCT_to_xy_Hernandez1999: definition unit tests methods. """ - def test_CCT_to_xy_Hernandez1999(self): + def test_CCT_to_xy_Hernandez1999(self) -> None: """ Test :func:`colour.temperature.hernandez1999.CCT_to_xy_Hernandez1999` definition. @@ -114,7 +116,7 @@ def test_CCT_to_xy_Hernandez1999(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_xy_Hernandez1999(self): + def test_n_dimensional_CCT_to_xy_Hernandez1999(self) -> None: """ Test :func:`colour.temperature.hernandez1999.CCT_to_xy_Hernandez1999` definition n-dimensional arrays support. @@ -136,7 +138,7 @@ def test_n_dimensional_CCT_to_xy_Hernandez1999(self): ) @ignore_numpy_errors - def test_nan_CCT_to_xy_Hernandez1999(self): + def test_nan_CCT_to_xy_Hernandez1999(self) -> None: """ Test :func:`colour.temperature.hernandez1999.CCT_to_xy_Hernandez1999` definition nan support. diff --git a/colour/temperature/tests/test_kang2002.py b/colour/temperature/tests/test_kang2002.py index 8a733a39f..fbc6fede8 100644 --- a/colour/temperature/tests/test_kang2002.py +++ b/colour/temperature/tests/test_kang2002.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.temperature.kang2002` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestXy_to_CCT_Kang2002: definition unit tests methods. """ - def test_xy_to_CCT_Kang2002(self): + def test_xy_to_CCT_Kang2002(self) -> None: """ Test :func:`colour.temperature.kang2002.xy_to_CCT_Kang2002` definition. @@ -60,7 +62,7 @@ def test_xy_to_CCT_Kang2002(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_CCT_Kang2002(self): + def test_n_dimensional_xy_to_CCT_Kang2002(self) -> None: """ Test :func:`colour.temperature.kang2002.xy_to_CCT_Kang2002` definition n-dimensional arrays support. @@ -82,7 +84,7 @@ def test_n_dimensional_xy_to_CCT_Kang2002(self): ) @ignore_numpy_errors - def test_nan_xy_to_CCT_Kang2002(self): + def test_nan_xy_to_CCT_Kang2002(self) -> None: """ Test :func:`colour.temperature.kang2002.xy_to_CCT_Kang2002` definition nan support. @@ -99,7 +101,7 @@ class TestCCT_to_xy_Kang2002: unit tests methods. """ - def test_CCT_to_xy_Kang2002(self): + def test_CCT_to_xy_Kang2002(self) -> None: """ Test :func:`colour.temperature.kang2002.CCT_to_xy_Kang2002` definition. @@ -123,7 +125,7 @@ def test_CCT_to_xy_Kang2002(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_xy_Kang2002(self): + def test_n_dimensional_CCT_to_xy_Kang2002(self) -> None: """ Test :func:`colour.temperature.kang2002.CCT_to_xy_Kang2002` definition n-dimensional arrays support. @@ -145,7 +147,7 @@ def test_n_dimensional_CCT_to_xy_Kang2002(self): ) @ignore_numpy_errors - def test_nan_CCT_to_xy_Kang2002(self): + def test_nan_CCT_to_xy_Kang2002(self) -> None: """ Test :func:`colour.temperature.kang2002.CCT_to_xy_Kang2002` definition nan support. diff --git a/colour/temperature/tests/test_krystek1985.py b/colour/temperature/tests/test_krystek1985.py index 671bd26a3..f50d58587 100644 --- a/colour/temperature/tests/test_krystek1985.py +++ b/colour/temperature/tests/test_krystek1985.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.temperature.krystek1985` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -26,7 +28,7 @@ class TestUv_to_CCT_Krystek1985: definition unit tests methods. """ - def test_uv_to_CCT_Krystek1985(self): + def test_uv_to_CCT_Krystek1985(self) -> None: """ Test :func:`colour.temperature.krystek1985.uv_to_CCT_Krystek1985` definition. @@ -59,7 +61,7 @@ def test_uv_to_CCT_Krystek1985(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_uv_to_CCT_Krystek1985(self): + def test_n_dimensional_uv_to_CCT_Krystek1985(self) -> None: """ Test :func:`colour.temperature.krystek1985.uv_to_CCT_Krystek1985` definition n-dimensional arrays support. @@ -81,7 +83,7 @@ def test_n_dimensional_uv_to_CCT_Krystek1985(self): ) @ignore_numpy_errors - def test_nan_uv_to_CCT_Krystek1985(self): + def test_nan_uv_to_CCT_Krystek1985(self) -> None: """ Test :func:`colour.temperature.krystek1985.uv_to_CCT_Krystek1985` definition nan support. @@ -98,7 +100,7 @@ class TestCCT_to_uv_Krystek1985: definition unit tests methods. """ - def test_CCT_to_uv_Krystek1985(self): + def test_CCT_to_uv_Krystek1985(self) -> None: """ Test :func:`colour.temperature.krystek1985.CCT_to_uv_Krystek1985` definition. @@ -122,7 +124,7 @@ def test_CCT_to_uv_Krystek1985(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_uv_Krystek1985(self): + def test_n_dimensional_CCT_to_uv_Krystek1985(self) -> None: """ Test :func:`colour.temperature.krystek1985.CCT_to_uv_Krystek1985` definition n-dimensional arrays support. @@ -144,7 +146,7 @@ def test_n_dimensional_CCT_to_uv_Krystek1985(self): ) @ignore_numpy_errors - def test_nan_CCT_to_uv_Krystek1985(self): + def test_nan_CCT_to_uv_Krystek1985(self) -> None: """ Test :func:`colour.temperature.krystek1985.CCT_to_uv_Krystek1985` definition nan support. diff --git a/colour/temperature/tests/test_mccamy1992.py b/colour/temperature/tests/test_mccamy1992.py index 421a32aef..1ba25fa1b 100644 --- a/colour/temperature/tests/test_mccamy1992.py +++ b/colour/temperature/tests/test_mccamy1992.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.temperature.mccamy1992` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class Testxy_to_CCT_McCamy1992: definition unit tests methods. """ - def test_xy_to_CCT_McCamy1992(self): + def test_xy_to_CCT_McCamy1992(self) -> None: """ Test :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992` definition. @@ -51,7 +53,7 @@ def test_xy_to_CCT_McCamy1992(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_xy_to_CCT_McCamy1992(self): + def test_n_dimensional_xy_to_CCT_McCamy1992(self) -> None: """ Test :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992` definition n-dimensional arrays support. @@ -73,7 +75,7 @@ def test_n_dimensional_xy_to_CCT_McCamy1992(self): ) @ignore_numpy_errors - def test_nan_xy_to_CCT_McCamy1992(self): + def test_nan_xy_to_CCT_McCamy1992(self) -> None: """ Test :func:`colour.temperature.mccamy1992.xy_to_CCT_McCamy1992` definition nan support. @@ -90,7 +92,7 @@ class TestCCT_to_xy_McCamy1992: definition unit tests methods. """ - def test_CCT_to_xy_McCamy1992(self): + def test_CCT_to_xy_McCamy1992(self) -> None: """ Test :func:`colour.temperature.mccamy1992.CCT_to_xy_McCamy1992` definition. @@ -114,7 +116,7 @@ def test_CCT_to_xy_McCamy1992(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_xy_McCamy1992(self): + def test_n_dimensional_CCT_to_xy_McCamy1992(self) -> None: """ Test :func:`colour.temperature.mccamy1992.CCT_to_xy_McCamy1992` definition n-dimensional arrays support. @@ -136,7 +138,7 @@ def test_n_dimensional_CCT_to_xy_McCamy1992(self): ) @ignore_numpy_errors - def test_nan_CCT_to_xy_McCamy1992(self): + def test_nan_CCT_to_xy_McCamy1992(self) -> None: """ Test :func:`colour.temperature.mccamy1992.CCT_to_xy_McCamy1992` definition nan support. diff --git a/colour/temperature/tests/test_ohno2013.py b/colour/temperature/tests/test_ohno2013.py index 06bfcd2b2..3315f7091 100644 --- a/colour/temperature/tests/test_ohno2013.py +++ b/colour/temperature/tests/test_ohno2013.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.temperature.ohno2013` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -39,7 +41,7 @@ class TestPlanckianTable: unit tests methods. """ - def test_planckian_table(self): + def test_planckian_table(self) -> None: """Test :func:`colour.temperature.ohno2013.planckian_table` definition.""" np.testing.assert_allclose( @@ -86,7 +88,7 @@ class TestUv_to_CCT_Ohno2013: unit tests methods. """ - def test_uv_to_CCT_Ohno2013(self): + def test_uv_to_CCT_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.uv_to_CCT_Ohno2013` definition. @@ -119,7 +121,7 @@ def test_uv_to_CCT_Ohno2013(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_uv_to_CCT_Ohno2013(self): + def test_n_dimensional_uv_to_CCT_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.uv_to_CCT_Ohno2013` definition n-dimensional arrays support. @@ -141,7 +143,7 @@ def test_n_dimensional_uv_to_CCT_Ohno2013(self): ) @ignore_numpy_errors - def test_nan_uv_to_CCT_Ohno2013(self): + def test_nan_uv_to_CCT_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.uv_to_CCT_Ohno2013` definition nan support. @@ -158,7 +160,7 @@ class TestCCT_to_uv_Ohno2013: unit tests methods. """ - def test_CCT_to_uv_Ohno2013(self): + def test_CCT_to_uv_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.CCT_to_uv_Ohno2013` definition. @@ -182,7 +184,7 @@ def test_CCT_to_uv_Ohno2013(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_uv_Ohno2013(self): + def test_n_dimensional_CCT_to_uv_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.CCT_to_uv_Ohno2013` definition n-dimensional arrays support. @@ -204,7 +206,7 @@ def test_n_dimensional_CCT_to_uv_Ohno2013(self): ) @ignore_numpy_errors - def test_nan_CCT_to_uv_Ohno2013(self): + def test_nan_CCT_to_uv_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.CCT_to_uv_Ohno2013` definition nan support. @@ -221,7 +223,7 @@ class Test_XYZ_to_CCT_Ohno2013: unit tests methods. """ - def test_XYZ_to_CCT_Ohno2013(self): + def test_XYZ_to_CCT_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.XYZ_to_CCT_Ohno2013` definition. """ @@ -232,7 +234,7 @@ def test_XYZ_to_CCT_Ohno2013(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_XYZ_to_CCT_Ohno2013(self): + def test_n_dimensional_XYZ_to_CCT_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.XYZ_to_CCT_Ohno2013` definition n-dimensional arrays support. @@ -254,7 +256,7 @@ def test_n_dimensional_XYZ_to_CCT_Ohno2013(self): ) @ignore_numpy_errors - def test_nan_XYZ_to_CCT_Ohno2013(self): + def test_nan_XYZ_to_CCT_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.XYZ_to_CCT_Ohno2013` definition nan support. @@ -271,7 +273,7 @@ class Test_CCT_to_XYZ_Ohno2013: unit tests methods. """ - def test_CCT_to_XYZ_Ohno2013(self): + def test_CCT_to_XYZ_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.CCT_to_XYZ_Ohno2013` definition. """ @@ -282,7 +284,7 @@ def test_CCT_to_XYZ_Ohno2013(self): atol=1e-6, ) - def test_n_dimensional_CCT_to_XYZ_Ohno2013(self): + def test_n_dimensional_CCT_to_XYZ_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.CCT_to_XYZ_Ohno2013` definition n-dimensional arrays support. @@ -304,7 +306,7 @@ def test_n_dimensional_CCT_to_XYZ_Ohno2013(self): ) @ignore_numpy_errors - def test_nan_CCT_to_uv_Ohno2013(self): + def test_nan_CCT_to_uv_Ohno2013(self) -> None: """ Test :func:`colour.temperature.ohno2013.CCT_to_uv_Ohno2013` definition nan support. diff --git a/colour/temperature/tests/test_planck1900.py b/colour/temperature/tests/test_planck1900.py index 6d567336b..cb22a9c51 100644 --- a/colour/temperature/tests/test_planck1900.py +++ b/colour/temperature/tests/test_planck1900.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.temperature.planck1900` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -27,7 +29,7 @@ class TestUv_to_CCT_Planck1900: definition unit tests methods. """ - def test_uv_to_CCT_Planck1900(self): + def test_uv_to_CCT_Planck1900(self) -> None: """ Test :func:`colour.temperature.planck1900.uv_to_CCT_Planck1900` definition. @@ -60,7 +62,7 @@ def test_uv_to_CCT_Planck1900(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_uv_to_CCT_Planck1900(self): + def test_n_dimensional_uv_to_CCT_Planck1900(self) -> None: """ Test :func:`colour.temperature.planck1900.uv_to_CCT_Planck1900` definition n-dimensional arrays support. @@ -82,7 +84,7 @@ def test_n_dimensional_uv_to_CCT_Planck1900(self): ) @ignore_numpy_errors - def test_nan_uv_to_CCT_Planck1900(self): + def test_nan_uv_to_CCT_Planck1900(self) -> None: """ Test :func:`colour.temperature.planck1900.uv_to_CCT_Planck1900` definition nan support. @@ -99,7 +101,7 @@ class TestCCT_to_uv_Planck1900: unit tests methods. """ - def test_CCT_to_uv_Planck1900(self): + def test_CCT_to_uv_Planck1900(self) -> None: """ Test :func:`colour.temperature.planck1900.CCT_to_uv_Planck1900` definition. @@ -123,7 +125,7 @@ def test_CCT_to_uv_Planck1900(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_uv_Planck1900(self): + def test_n_dimensional_CCT_to_uv_Planck1900(self) -> None: """ Test :func:`colour.temperature.planck1900.CCT_to_uv_Planck1900` definition n-dimensional arrays support. @@ -145,7 +147,7 @@ def test_n_dimensional_CCT_to_uv_Planck1900(self): ) @ignore_numpy_errors - def test_nan_CCT_to_uv_Planck1900(self): + def test_nan_CCT_to_uv_Planck1900(self) -> None: """ Test :func:`colour.temperature.planck1900.CCT_to_uv_Planck1900` definition nan support. diff --git a/colour/temperature/tests/test_robertson1968.py b/colour/temperature/tests/test_robertson1968.py index 88b4c38df..ea6aad7b0 100644 --- a/colour/temperature/tests/test_robertson1968.py +++ b/colour/temperature/tests/test_robertson1968.py @@ -139,7 +139,7 @@ class TestMired_to_CCT: definition unit tests methods. """ - def test_mired_to_CCT(self): + def test_mired_to_CCT(self) -> None: """ Test :func:`colour.temperature.robertson1968.mired_to_CCT` definition. @@ -159,7 +159,7 @@ def test_mired_to_CCT(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_mired_to_CCT(self): + def test_n_dimensional_mired_to_CCT(self) -> None: """ Test :func:`colour.temperature.robertson1968.mired_to_CCT` definition n-dimensional arrays support. @@ -181,7 +181,7 @@ def test_n_dimensional_mired_to_CCT(self): ) @ignore_numpy_errors - def test_nan_mired_to_CCT(self): + def test_nan_mired_to_CCT(self) -> None: """ Test :func:`colour.temperature.robertson1968.mired_to_CCT` definition nan support. @@ -198,7 +198,7 @@ class TestCCT_to_mired: definition unit tests methods. """ - def test_CCT_to_mired(self): + def test_CCT_to_mired(self) -> None: """ Test :func:`colour.temperature.robertson1968.CCT_to_mired` definition. @@ -218,7 +218,7 @@ def test_CCT_to_mired(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_mired(self): + def test_n_dimensional_CCT_to_mired(self) -> None: """ Test :func:`colour.temperature.robertson1968.CCT_to_mired` definition n-dimensional arrays support. @@ -240,7 +240,7 @@ def test_n_dimensional_CCT_to_mired(self): ) @ignore_numpy_errors - def test_nan_CCT_to_mired(self): + def test_nan_CCT_to_mired(self) -> None: """ Test :func:`colour.temperature.robertson1968.CCT_to_mired` definition nan support. @@ -257,7 +257,7 @@ class TestUv_to_CCT_Robertson1968: definition unit tests methods. """ - def test_uv_to_CCT_Robertson1968(self): + def test_uv_to_CCT_Robertson1968(self) -> None: """ Test :func:`colour.temperature.robertson1968.uv_to_CCT_Robertson1968` definition. @@ -266,7 +266,7 @@ def test_uv_to_CCT_Robertson1968(self): for key, value in TEMPERATURE_DUV_TO_UV.items(): np.testing.assert_allclose(uv_to_CCT_Robertson1968(value), key, atol=0.25) - def test_n_dimensional_uv_to_CCT_Robertson1968(self): + def test_n_dimensional_uv_to_CCT_Robertson1968(self) -> None: """ Test :func:`colour.temperature.robertson1968.uv_to_CCT_Robertson1968` definition n-dimensional arrays support. @@ -292,7 +292,7 @@ def test_n_dimensional_uv_to_CCT_Robertson1968(self): ) @ignore_numpy_errors - def test_nan_uv_to_CCT_Robertson1968(self): + def test_nan_uv_to_CCT_Robertson1968(self) -> None: """ Test :func:`colour.temperature.robertson1968.uv_to_CCT_Robertson1968` definition nan support. @@ -309,7 +309,7 @@ class TestCCT_to_uv_Robertson1968: definition unit tests methods. """ - def test_CCT_to_uv_Robertson1968(self): + def test_CCT_to_uv_Robertson1968(self) -> None: """ Test :func:`colour.temperature.robertson1968.CCT_to_uv_Robertson1968` definition. @@ -322,7 +322,7 @@ def test_CCT_to_uv_Robertson1968(self): atol=TOLERANCE_ABSOLUTE_TESTS, ) - def test_n_dimensional_CCT_to_uv_Robertson1968(self): + def test_n_dimensional_CCT_to_uv_Robertson1968(self) -> None: """ Test :func:`colour.temperature.robertson1968.CCT_to_uv_Robertson1968` definition n-dimensional arrays support. @@ -348,7 +348,7 @@ def test_n_dimensional_CCT_to_uv_Robertson1968(self): ) @ignore_numpy_errors - def test_nan_CCT_to_uv_Robertson1968(self): + def test_nan_CCT_to_uv_Robertson1968(self) -> None: """ Test :func:`colour.temperature.robertson1968.CCT_to_uv_Robertson1968` definition nan support. diff --git a/colour/utilities/__init__.py b/colour/utilities/__init__.py index 129815065..19b10f5a0 100644 --- a/colour/utilities/__init__.py +++ b/colour/utilities/__init__.py @@ -299,7 +299,7 @@ class utilities(ModuleAPI): """Define a class acting like the *utilities* 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) diff --git a/colour/utilities/array.py b/colour/utilities/array.py index 786b02a57..29cc38168 100644 --- a/colour/utilities/array.py +++ b/colour/utilities/array.py @@ -44,7 +44,7 @@ NDArrayFloat, NDArrayInt, Real, - Tuple, + Sequence, Type, cast, ) @@ -239,7 +239,9 @@ class MixinDataclassArray(MixinDataclassIterable): - :class:`colour.utilities.MixinDataclassFields` """ - def __array__(self, dtype: Type[DTypeReal] | None = None, copy=None) -> NDArray: + def __array__( + self, dtype: Type[DTypeReal] | None = None, copy: bool = True + ) -> NDArray: """ Implement support for :class:`dataclass`-like class conversion to :class:`numpy.ndarray` class. @@ -541,7 +543,7 @@ def arithmetical_operation( def as_array( - a: ArrayLike, + a: ArrayLike | KeysView | ValuesView, dtype: Type[DType] | None = None, ) -> NDArray: """ @@ -771,6 +773,7 @@ def as_int_scalar(a: ArrayLike, dtype: Type[DTypeInt] | None = None) -> int: attest(a.ndim == 0, f'"{a}" cannot be converted to "int" scalar!') + # TODO: Revisit when Numpy types are well established. return cast(int, as_int(a, dtype)) @@ -808,6 +811,7 @@ def as_float_scalar(a: ArrayLike, dtype: Type[DTypeFloat] | None = None) -> floa attest(a.ndim == 0, f'"{a}" cannot be converted to "float" scalar!') + # TODO: Revisit when Numpy types are well established. return cast(float, as_float(a, dtype)) @@ -952,7 +956,7 @@ def set_domain_range_scale( scale: ( Literal["ignore", "reference", "Ignore", "Reference", "1", "100"] | str ) = "reference", -): +) -> None: """ Set the current *Colour* domain-range scale. The following scales are available: @@ -1056,7 +1060,7 @@ def __enter__(self) -> domain_range_scale: return self - def __exit__(self, *args: Any): + def __exit__(self, *args: Any) -> None: """Set the previous domain-range scale upon exiting the context manager.""" set_domain_range_scale(self._previous_scale) @@ -1783,7 +1787,7 @@ def is_ndarray_copy_enabled() -> bool: return _NDARRAY_COPY_ENABLED -def set_ndarray_copy_enable(enable: bool): +def set_ndarray_copy_enable(enable: bool) -> None: """ Set *Colour* :class:`numpy.ndarray` copy enabled state. @@ -1832,7 +1836,7 @@ def __enter__(self) -> ndarray_copy_enable: return self - def __exit__(self, *args: Any): + def __exit__(self, *args: Any) -> None: """ Set the *Colour* :class:`numpy.ndarray` copy enabled state upon exiting the context manager. @@ -2512,7 +2516,7 @@ def ndarray_write(a: ArrayLike) -> Generator: def zeros( - shape: int | Tuple[int, ...], + shape: int | Sequence[int], dtype: Type[DTypeReal] | None = None, order: Literal["C", "F"] = "C", ) -> NDArray: @@ -2550,7 +2554,7 @@ def zeros( def ones( - shape: int | Tuple[int, ...], + shape: int | Sequence[int], dtype: Type[DTypeReal] | None = None, order: Literal["C", "F"] = "C", ) -> NDArray: @@ -2588,7 +2592,7 @@ def ones( def full( - shape: int | Tuple[int, ...], + shape: int | Sequence[int], fill_value: Real, dtype: Type[DTypeReal] | None = None, order: Literal["C", "F"] = "C", diff --git a/colour/utilities/common.py b/colour/utilities/common.py index a4cc7c132..064261ebb 100644 --- a/colour/utilities/common.py +++ b/colour/utilities/common.py @@ -110,7 +110,7 @@ def is_caching_enabled() -> bool: return _CACHING_ENABLED -def set_caching_enable(enable: bool): +def set_caching_enable(enable: bool) -> None: """ Set *Colour* caching enabled state. @@ -159,7 +159,7 @@ def __enter__(self) -> caching_enable: return self - def __exit__(self, *args: Any): + def __exit__(self, *args: Any) -> None: """ Set the *Colour* caching enabled state upon exiting the context manager. @@ -278,7 +278,7 @@ def register_cache(self, name: str) -> dict: return self._registry[name] - def unregister_cache(self, name: str): + def unregister_cache(self, name: str) -> None: """ Unregister cache with given name in the registry. @@ -312,7 +312,7 @@ def unregister_cache(self, name: str): del self._registry[name] - def clear_cache(self, name: str): + def clear_cache(self, name: str) -> None: """ Clear the cache with given name. @@ -335,7 +335,7 @@ def clear_cache(self, name: str): self._registry[name].clear() - def clear_all_caches(self): + def clear_all_caches(self) -> None: """ Clear all the caches in the registry. @@ -447,7 +447,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Any: return wrapper -def attest(condition: bool | DTypeBoolean, message: str = ""): +def attest(condition: bool | DTypeBoolean, message: str = "") -> None: """ Provide the `assert` statement functionality without being disabled by optimised Python execution. @@ -512,7 +512,7 @@ def __enter__(self) -> disable_multiprocessing: return self - def __exit__(self, *args: Any): + def __exit__(self, *args: Any) -> None: """ Enable *Colour* multiprocessing state upon exiting the context manager. @@ -535,7 +535,7 @@ def wrapper(*args: Any, **kwargs: Any) -> Any: return wrapper -def _initializer(kwargs: Any): +def _initializer(kwargs: Any) -> None: """ Initialize a multiprocessing pool. @@ -613,12 +613,17 @@ class _DummyPool: def __init__(self, *args: Any, **kwargs: Any) -> None: pass - def map(self, func, iterable, chunksize=None): # noqa: ARG002 + def map( + self, + func: Callable, + iterable: Sequence, + chunksize: int | None = None, # noqa: ARG002 + ) -> list[Any]: """Apply given function to each element of given iterable.""" return [func(a) for a in iterable] - def terminate(self): + def terminate(self) -> None: """Terminate the process.""" kwargs["initializer"] = _initializer diff --git a/colour/utilities/network.py b/colour/utilities/network.py index bdfe2523b..593ca5d18 100644 --- a/colour/utilities/network.py +++ b/colour/utilities/network.py @@ -38,6 +38,7 @@ Generator, List, Self, + Sequence, Tuple, Type, ) @@ -194,7 +195,7 @@ def name(self) -> str: return self._name @name.setter - def name(self, value: str): + def name(self, value: str) -> None: """Setter for the **self.name** property.""" attest( @@ -223,7 +224,7 @@ def parent(self) -> Self | None: return self._parent @parent.setter - def parent(self, value: Self | None): + def parent(self, value: Self | None) -> None: """Setter for the **self.parent** property.""" from colour.utilities import attest @@ -258,7 +259,7 @@ def children(self) -> List[Self]: return self._children @children.setter - def children(self, value: List[Self]): + def children(self, value: List[Self]) -> None: """Setter for the **self.children** property.""" from colour.utilities import attest @@ -342,7 +343,7 @@ def data(self) -> Any: return self._data @data.setter - def data(self, value: Any): + def data(self, value: Any) -> None: """Setter for the **self.data** property.""" self._data = value @@ -486,7 +487,7 @@ def walk_hierarchy(self, ascendants: bool = False) -> Generator: yield from node.walk_hierarchy(ascendants=ascendants) - def render(self, tab_level: int = 0): + def render(self, tab_level: int = 0) -> str: """ Render the current node and its children as a string. @@ -615,7 +616,7 @@ def name(self) -> str: return self._name @name.setter - def name(self, value: str): + def name(self, value: str) -> None: """Setter for the **self.name** property.""" attest( @@ -651,7 +652,7 @@ def value(self) -> Any: return self._value @value.setter - def value(self, value: Any): + def value(self, value: Any) -> None: """Setter for the **self.value** property.""" self._value = value @@ -704,7 +705,7 @@ def description(self) -> str | None: return self._description @description.setter - def description(self, value: str | None): + def description(self, value: str | None) -> None: """Setter for the **self.description** property.""" attest( @@ -729,7 +730,7 @@ def node(self) -> PortNode | None: return self._node @node.setter - def node(self, value: PortNode | None): + def node(self, value: PortNode | None) -> None: """Setter for the **self.node** property.""" attest( @@ -955,7 +956,7 @@ class PortNode(TreeNode, MixinLogging): Examples -------- >>> class NodeAdd(PortNode): - ... def __init__(self, *args, **kwargs): + ... def __init__(self, *args: Any, **kwargs: Any): ... super().__init__(*args, **kwargs) ... ... self.description = "Perform the addition of the two input port values." @@ -982,7 +983,7 @@ class PortNode(TreeNode, MixinLogging): 2 """ - def __init__(self, name: str | None = None, description: str | None = None): + def __init__(self, name: str | None = None, description: str | None = None) -> None: super().__init__(name) self._description = description self.description = optional(description, self._description) @@ -1036,7 +1037,7 @@ def dirty(self) -> bool: return self._dirty @dirty.setter - def dirty(self, value: bool): + def dirty(self, value: bool) -> None: """Setter for the **self.dirty** property.""" attest( @@ -1094,7 +1095,7 @@ def description(self) -> str | None: return self._description @description.setter - def description(self, value: str | None): + def description(self, value: str | None) -> None: """Setter for the **self.description** property.""" attest( @@ -1185,7 +1186,7 @@ def add_output_port( value: Any = None, description: str | None = None, port_type: Type[Port] = Port, - ) -> None: + ) -> Port: """ Add an output port with given name and value to the node. @@ -1484,7 +1485,7 @@ def process(self) -> None: Examples -------- >>> class NodeAdd(PortNode): - ... def __init__(self, *args, **kwargs): + ... def __init__(self, *args: Any, **kwargs: Any): ... super().__init__(*args, **kwargs) ... ... self.description = ( @@ -1572,7 +1573,7 @@ class PortGraph(PortNode): Examples -------- >>> class NodeAdd(PortNode): - ... def __init__(self, *args, **kwargs): + ... def __init__(self, *args: Any, **kwargs: Any): ... super().__init__(*args, **kwargs) ... ... self.description = "Perform the addition of the two input port values." @@ -1608,7 +1609,7 @@ class PortGraph(PortNode): 3 """ - def __init__(self, name: str | None = None, description: str | None = None): + def __init__(self, name: str | None = None, description: str | None = None) -> None: super().__init__(name, description) self._name: str = self.__class__.__name__ @@ -1834,7 +1835,7 @@ def walk_ports(self) -> Generator: yield node except nx.NetworkXUnfeasible as error: filename = "AGraph.png" - self.log( + self.log( # pyright: ignore f'A "NetworkX" error occurred, debug graph image has been ' f'saved to "{os.path.join(os.getcwd(), filename)}"!' ) @@ -1856,7 +1857,7 @@ def process(self, **kwargs: Dict) -> None: Examples -------- >>> class NodeAdd(PortNode): - ... def __init__(self, *args, **kwargs): + ... def __init__(self, *args: Any, **kwargs: Any): ... super().__init__(*args, **kwargs) ... ... self.description = ( @@ -2011,7 +2012,7 @@ def value(self) -> Any: """ @value.setter - def value(self, value: Any): + def value(self, value: Any) -> None: """Setter for the **self.value** property.""" @@ -2020,7 +2021,7 @@ class ExecutionNode(PortNode): Define a special node with execution input and output ports. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.add_input_port( @@ -2034,7 +2035,7 @@ def __init__(self, *args, **kwargs): class ControlFlowNode(ExecutionNode): """Define a class inherited by control flow nodes.""" - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) @@ -2061,7 +2062,7 @@ class For(ControlFlowNode): :class:`colour.utilities.PortGraph` class instance. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.add_input_port("array", [], "Array to loop onto") @@ -2111,7 +2112,7 @@ def process(self) -> None: _THREADING_LOCK = threading.Lock() -def _task_thread(args): +def _task_thread(args: Sequence) -> tuple[int, Any]: """ Define the default task for the :class:`colour.utilities.ParallelForThread` loop node @@ -2165,7 +2166,7 @@ class ParallelForThread(ControlFlowNode): instead. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.add_input_port("array", [], "Array to loop onto") @@ -2225,7 +2226,7 @@ def process(self) -> None: self.dirty = False -def _task_multiprocess(args): +def _task_multiprocess(args: Sequence) -> tuple[int, Any]: """ Define the default task for the :class:`colour.utilities.ParallelForMultiprocess` loop node @@ -2272,7 +2273,7 @@ class ParallelForMultiprocess(ControlFlowNode): :class:`colour.utilities.PortGraph` class instance. """ - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.add_input_port("array", [], "Array to loop onto") diff --git a/colour/utilities/structures.py b/colour/utilities/structures.py index 5c11ddd27..3194d167c 100644 --- a/colour/utilities/structures.py +++ b/colour/utilities/structures.py @@ -93,7 +93,7 @@ class Structure(dict): def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) - def __setattr__(self, name: str, value: Any): + def __setattr__(self, name: str, value: Any) -> None: """ Assign given value to the attribute with given name. @@ -107,7 +107,7 @@ def __setattr__(self, name: str, value: Any): self[name] = value - def __delattr__(self, name: str): + def __delattr__(self, name: str) -> None: """ Delete the attribute with given name. @@ -155,7 +155,7 @@ def __getattr__(self, name: str) -> Any: except KeyError as error: raise AttributeError(name) from error - def __setstate__(self, state): + def __setstate__(self, state: Any) -> None: """Set the object state when unpickling.""" # See https://github.com/scikit-learn/scikit-learn/issues/6196 for more # information. @@ -340,7 +340,7 @@ def __repr__(self) -> str: else: return f"{self.__class__.__name__}({dict(self.items())})" - def __setitem__(self, item: str | Any, value: Any): + def __setitem__(self, item: str | Any, value: Any) -> None: """ Set given item with given value in the delimiter and case-insensitive :class:`dict`-like object. @@ -396,7 +396,7 @@ def __getitem__(self, item: str | Any) -> Any: return self[dict(zip(self.canonical_keys(), self.keys()))[item]] - def __delitem__(self, item: str | Any): + def __delitem__(self, item: str | Any) -> None: """ Delete given item from the delimiter and case-insensitive :class:`dict`-like object. @@ -545,7 +545,7 @@ def __ne__(self, other: Any) -> bool: return not (self == other) @staticmethod - def _collision_warning(keys: list): + def _collision_warning(keys: list) -> None: """ Issue a runtime warning when given keys are colliding. diff --git a/colour/utilities/tests/test_array.py b/colour/utilities/tests/test_array.py index d6b29e402..e5fdcad14 100644 --- a/colour/utilities/tests/test_array.py +++ b/colour/utilities/tests/test_array.py @@ -14,7 +14,7 @@ DTYPE_INT_DEFAULT, TOLERANCE_ABSOLUTE_TESTS, ) -from colour.hints import NDArray, Type +from colour.hints import ArrayLike, DType, NDArray, NDArrayFloat, Type from colour.utilities import ( MixinDataclassArithmetic, MixinDataclassArray, @@ -131,7 +131,7 @@ class TestMixinDataclassFields(unittest.TestCase): tests methods. """ - def setUp(self): + def setUp(self) -> None: """Initialise the common tests attributes.""" @dataclass @@ -142,7 +142,7 @@ class Data(MixinDataclassFields): self._data: Data = Data(a="Foo", b="Bar", c="Baz") - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("fields",) @@ -150,7 +150,7 @@ def test_required_attributes(self): for method in required_attributes: assert method in dir(MixinDataclassFields) - def test_fields(self): + def test_fields(self) -> None: """ Test :meth:`colour.utilities.array.MixinDataclassIterable._fields` method. @@ -165,7 +165,7 @@ class TestMixinDataclassIterable(unittest.TestCase): tests methods. """ - def setUp(self): + def setUp(self) -> None: """Initialise the common tests attributes.""" @dataclass @@ -176,7 +176,7 @@ class Data(MixinDataclassIterable): self._data: Data = Data(a="Foo", b="Bar", c="Baz") - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -188,7 +188,7 @@ def test_required_attributes(self): for method in required_attributes: assert method in dir(MixinDataclassIterable) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__iter__",) @@ -196,7 +196,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(MixinDataclassIterable) - def test__iter__(self): + def test__iter__(self) -> None: """ Test :meth:`colour.utilities.array.MixinDataclassIterable.__iter__` method. @@ -206,7 +206,7 @@ def test__iter__(self): {"a": "Foo", "b": "Bar", "c": "Baz"} ) - def test_keys(self): + def test_keys(self) -> None: """ Test :meth:`colour.utilities.array.MixinDataclassIterable.keys` method. @@ -214,7 +214,7 @@ def test_keys(self): assert tuple(self._data.keys) == ("a", "b", "c") - def test_values(self): + def test_values(self) -> None: """ Test :meth:`colour.utilities.array.MixinDataclassIterable.values` method. @@ -222,7 +222,7 @@ def test_values(self): assert tuple(self._data.values) == ("Foo", "Bar", "Baz") - def test_items(self): + def test_items(self) -> None: """ Test :meth:`colour.utilities.array.MixinDataclassIterable.items` method. @@ -237,7 +237,7 @@ class TestMixinDataclassArray(unittest.TestCase): tests methods. """ - def setUp(self): + def setUp(self) -> None: """Initialise the common tests attributes.""" @dataclass @@ -265,7 +265,7 @@ class Data(MixinDataclassArray): ] ) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__array__",) @@ -273,7 +273,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(MixinDataclassArray) - def test__array__(self): + def test__array__(self) -> None: """ Test :meth:`colour.utilities.array.MixinDataclassArray.__array__` method. @@ -290,7 +290,7 @@ class TestMixinDataclassArithmetic(unittest.TestCase): tests methods. """ - def setUp(self): + def setUp(self) -> None: """Initialise the common tests attributes.""" @dataclass @@ -319,7 +319,7 @@ class Data(MixinDataclassArithmetic): ] ) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -339,7 +339,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(MixinDataclassArithmetic) - def test_arithmetical_operation(self): + def test_arithmetical_operation(self) -> None: """ Test :meth:`colour.utilities.array.MixinDataclassArithmetic.\ arithmetical_operation` method. @@ -475,7 +475,7 @@ class TestAsArray(unittest.TestCase): methods. """ - def test_as_array(self): + def test_as_array(self) -> None: """Test :func:`colour.utilities.array.as_array` definition.""" np.testing.assert_equal(as_array([1, 2, 3]), np.array([1, 2, 3])) @@ -495,7 +495,7 @@ class TestAsInt(unittest.TestCase): methods. """ - def test_as_int(self): + def test_as_int(self) -> None: """Test :func:`colour.utilities.array.as_int` definition.""" assert as_int(1) == 1 @@ -519,7 +519,7 @@ class TestAsFloat(unittest.TestCase): methods. """ - def test_as_float(self): + def test_as_float(self) -> None: """Test :func:`colour.utilities.array.as_float` definition.""" assert as_float(1) == 1.0 @@ -545,7 +545,7 @@ class TestAsIntArray(unittest.TestCase): methods. """ - def test_as_int_array(self): + def test_as_int_array(self) -> None: """Test :func:`colour.utilities.array.as_int_array` definition.""" np.testing.assert_equal(as_int_array([1.0, 2.0, 3.0]), np.array([1, 2, 3])) @@ -559,7 +559,7 @@ class TestAsFloatArray(unittest.TestCase): methods. """ - def test_as_float_array(self): + def test_as_float_array(self) -> None: """Test :func:`colour.utilities.array.as_float_array` definition.""" np.testing.assert_equal(as_float_array([1, 2, 3]), np.array([1, 2, 3])) @@ -573,12 +573,12 @@ class TestAsIntScalar(unittest.TestCase): methods. """ - def test_as_int_scalar(self): + def test_as_int_scalar(self) -> None: """Test :func:`colour.utilities.array.as_int_scalar` definition.""" assert as_int_scalar(1.0) == 1 - assert as_int_scalar(1.0).dtype == DTYPE_INT_DEFAULT + assert as_int_scalar(1.0).dtype == DTYPE_INT_DEFAULT # pyright: ignore class TestAsFloatScalar(unittest.TestCase): @@ -587,12 +587,12 @@ class TestAsFloatScalar(unittest.TestCase): tests methods. """ - def test_as_float_scalar(self): + def test_as_float_scalar(self) -> None: """Test :func:`colour.utilities.array.as_float_scalar` definition.""" assert as_float_scalar(1) == 1.0 - assert as_float_scalar(1).dtype == DTYPE_FLOAT_DEFAULT + assert as_float_scalar(1).dtype == DTYPE_FLOAT_DEFAULT # pyright: ignore class TestSetDefaultIntegerDtype(unittest.TestCase): @@ -601,7 +601,7 @@ class TestSetDefaultIntegerDtype(unittest.TestCase): tests methods. """ - def test_set_default_int_dtype(self): + def test_set_default_int_dtype(self) -> None: """ Test :func:`colour.utilities.array.set_default_int_dtype` definition. """ @@ -616,7 +616,7 @@ def test_set_default_int_dtype(self): assert as_int_array(np.ones(3)).dtype == np.int64 - def tearDown(self): + def tearDown(self) -> None: """After tests actions.""" set_default_int_dtype(np.int64) @@ -628,7 +628,7 @@ class TestSetDefaultFloatDtype(unittest.TestCase): tests methods. """ - def test_set_default_float_dtype(self): + def test_set_default_float_dtype(self) -> None: """ Test :func:`colour.utilities.array.set_default_float_dtype` definition. @@ -647,7 +647,7 @@ def test_set_default_float_dtype(self): finally: set_default_float_dtype(np.float64) - def test_set_default_float_dtype_enforcement(self): + def test_set_default_float_dtype_enforcement(self) -> None: """ Test whether :func:`colour.utilities.array.set_default_float_dtype` effect is applied through most of *Colour* public API. @@ -728,7 +728,7 @@ def test_set_default_float_dtype_enforcement(self): ): a = np.array([(0.25, 0.5), (0.25, 0.5)]) - def dtype_getter(x): + def dtype_getter(x: NDArray) -> DType: """Dtype getter callable.""" for specification in ( @@ -744,9 +744,9 @@ def dtype_getter(x): "ZCAM", ): if target.endswith(specification): # noqa: B023 - return getattr(x, fields(x)[0].name).dtype + return getattr(x, fields(x)[0].name).dtype # pyright: ignore - return x.dtype + return x.dtype # pyright: ignore assert dtype_getter(convert(a, source, target)) == dtype finally: @@ -759,7 +759,7 @@ class TestGetDomainRangeScale(unittest.TestCase): unit tests methods. """ - def test_get_domain_range_scale(self): + def test_get_domain_range_scale(self) -> None: """ Test :func:`colour.utilities.common.get_domain_range_scale` definition. @@ -781,7 +781,7 @@ class TestSetDomainRangeScale(unittest.TestCase): unit tests methods. """ - def test_set_domain_range_scale(self): + def test_set_domain_range_scale(self) -> None: """ Test :func:`colour.utilities.common.set_domain_range_scale` definition. @@ -809,7 +809,7 @@ class TestDomainRangeScale(unittest.TestCase): unit tests methods. """ - def test_domain_range_scale(self): + def test_domain_range_scale(self) -> None: """ Test :func:`colour.utilities.common.domain_range_scale` definition. @@ -832,7 +832,7 @@ def test_domain_range_scale(self): assert get_domain_range_scale() == "reference" - def fn_a(a): + def fn_a(a: ArrayLike) -> NDArrayFloat: """Change the domain-range scale for unit testing.""" b = to_domain_10(a) @@ -860,7 +860,7 @@ def fn_a(a): assert get_domain_range_scale() == "reference" @domain_range_scale("1") - def fn_b(a): + def fn_b(a: ArrayLike) -> NDArrayFloat: """Change the domain-range scale for unit testing.""" b = to_domain_10(a) @@ -878,7 +878,7 @@ class TestToDomain1(unittest.TestCase): tests methods. """ - def test_to_domain_1(self): + def test_to_domain_1(self) -> None: """Test :func:`colour.utilities.common.to_domain_1` definition.""" with domain_range_scale("Reference"): @@ -903,7 +903,7 @@ class TestToDomain10(unittest.TestCase): tests methods. """ - def test_to_domain_10(self): + def test_to_domain_10(self) -> None: """Test :func:`colour.utilities.common.to_domain_10` definition.""" with domain_range_scale("Reference"): @@ -928,7 +928,7 @@ class TestToDomain100(unittest.TestCase): tests methods. """ - def test_to_domain_100(self): + def test_to_domain_100(self) -> None: """Test :func:`colour.utilities.common.to_domain_100` definition.""" with domain_range_scale("Reference"): @@ -953,7 +953,7 @@ class TestToDomainDegrees(unittest.TestCase): tests methods. """ - def test_to_domain_degrees(self): + def test_to_domain_degrees(self) -> None: """Test :func:`colour.utilities.common.to_domain_degrees` definition.""" with domain_range_scale("Reference"): @@ -978,7 +978,7 @@ class TestToDomainInt(unittest.TestCase): tests methods. """ - def test_to_domain_int(self): + def test_to_domain_int(self) -> None: """Test :func:`colour.utilities.common.to_domain_int` definition.""" with domain_range_scale("Reference"): @@ -1003,7 +1003,7 @@ class TestFromRange1(unittest.TestCase): tests methods. """ - def test_from_range_1(self): + def test_from_range_1(self) -> None: """Test :func:`colour.utilities.common.from_range_1` definition.""" with domain_range_scale("Reference"): @@ -1025,7 +1025,7 @@ class TestFromRange10(unittest.TestCase): tests methods. """ - def test_from_range_10(self): + def test_from_range_10(self) -> None: """Test :func:`colour.utilities.common.from_range_10` definition.""" with domain_range_scale("Reference"): @@ -1047,7 +1047,7 @@ class TestFromRange100(unittest.TestCase): tests methods. """ - def test_from_range_100(self): + def test_from_range_100(self) -> None: """Test :func:`colour.utilities.common.from_range_100` definition.""" with domain_range_scale("Reference"): @@ -1069,7 +1069,7 @@ class TestFromRangeDegrees(unittest.TestCase): tests methods. """ - def test_from_range_degrees(self): + def test_from_range_degrees(self) -> None: """Test :func:`colour.utilities.common.from_range_degrees` definition.""" with domain_range_scale("Reference"): @@ -1091,7 +1091,7 @@ class TestFromRangeInt(unittest.TestCase): tests methods. """ - def test_from_range_int(self): + def test_from_range_int(self) -> None: """Test :func:`colour.utilities.common.from_range_int` definition.""" with domain_range_scale("Reference"): @@ -1116,7 +1116,7 @@ class TestIsNdarrayCopyEnabled(unittest.TestCase): unit tests methods. """ - def test_is_ndarray_copy_enabled(self): + def test_is_ndarray_copy_enabled(self) -> None: """ Test :func:`colour.utilities.array.is_ndarray_copy_enabled` definition. """ @@ -1134,7 +1134,7 @@ class TestSetNdarrayCopyEnabled(unittest.TestCase): unit tests methods. """ - def test_set_ndarray_copy_enable(self): + def test_set_ndarray_copy_enable(self) -> None: """ Test :func:`colour.utilities.array.set_ndarray_copy_enable` definition. """ @@ -1154,7 +1154,7 @@ class TestNdarrayCopyEnable(unittest.TestCase): tests methods. """ - def test_ndarray_copy_enable(self): + def test_ndarray_copy_enable(self) -> None: """ Test :func:`colour.utilities.array.ndarray_copy_enable` definition. """ @@ -1166,7 +1166,7 @@ def test_ndarray_copy_enable(self): assert not is_ndarray_copy_enabled() @ndarray_copy_enable(True) - def fn_a(): + def fn_a() -> None: """:func:`ndarray_copy_enable` unit tests :func:`fn_a` definition.""" assert is_ndarray_copy_enabled() @@ -1174,7 +1174,7 @@ def fn_a(): fn_a() @ndarray_copy_enable(False) - def fn_b(): + def fn_b() -> None: """:func:`ndarray_copy_enable` unit tests :func:`fn_b` definition.""" assert not is_ndarray_copy_enabled() @@ -1188,7 +1188,7 @@ class TestNdarrayCopy(unittest.TestCase): tests methods. """ - def test_ndarray_copy(self): + def test_ndarray_copy(self) -> None: """Test :func:`colour.utilities.array.ndarray_copy` definition.""" a = np.linspace(0, 1, 10) @@ -1205,7 +1205,7 @@ class TestClosestIndexes(unittest.TestCase): tests methods. """ - def test_closest_indexes(self): + def test_closest_indexes(self) -> None: """Test :func:`colour.utilities.array.closest_indexes` definition.""" a = np.array( @@ -1237,7 +1237,7 @@ class TestClosest(unittest.TestCase): methods. """ - def test_closest(self): + def test_closest(self) -> None: """Test :func:`colour.utilities.array.closest` definition.""" a = np.array( @@ -1270,7 +1270,7 @@ class TestInterval(unittest.TestCase): methods. """ - def test_interval(self): + def test_interval(self) -> None: """Test :func:`colour.utilities.array.interval` definition.""" np.testing.assert_array_equal(interval(range(0, 10, 2)), np.array([2])) @@ -1298,7 +1298,7 @@ class TestIsUniform(unittest.TestCase): methods. """ - def test_is_uniform(self): + def test_is_uniform(self) -> None: """Test :func:`colour.utilities.array.is_uniform` definition.""" assert is_uniform(range(0, 10, 2)) @@ -1312,7 +1312,7 @@ class TestInArray(unittest.TestCase): methods. """ - def test_in_array(self): + def test_in_array(self) -> None: """Test :func:`colour.utilities.array.in_array` definition.""" assert np.array_equal( @@ -1330,7 +1330,7 @@ def test_in_array(self): np.array([[True], [True]]), ) - def test_n_dimensional_in_array(self): + def test_n_dimensional_in_array(self) -> None: """ Test :func:`colour.utilities.array.in_array` definition n-dimensional support. @@ -1358,7 +1358,7 @@ class TestTstack(unittest.TestCase): methods. """ - def test_tstack(self): + def test_tstack(self) -> None: """Test :func:`colour.utilities.array.tstack` definition.""" a = 0 @@ -1443,7 +1443,7 @@ class TestTsplit(unittest.TestCase): methods. """ - def test_tsplit(self): + def test_tsplit(self) -> None: """Test :func:`colour.utilities.array.tsplit` definition.""" a = np.array([0, 0, 0]) @@ -1565,7 +1565,7 @@ class TestRowAsDiagonal(unittest.TestCase): tests methods. """ - def test_row_as_diagonal(self): + def test_row_as_diagonal(self) -> None: """Test :func:`colour.utilities.array.row_as_diagonal` definition.""" np.testing.assert_allclose( @@ -1619,7 +1619,7 @@ class TestOrient(unittest.TestCase): methods. """ - def test_orient(self): + def test_orient(self) -> None: """Test :func:`colour.utilities.array.orient` definition.""" a = np.tile(np.arange(5), (5, 1)) @@ -1698,7 +1698,7 @@ class TestCentroid(unittest.TestCase): methods. """ - def test_centroid(self): + def test_centroid(self) -> None: """Test :func:`colour.utilities.array.centroid` definition.""" a = np.arange(5) @@ -1720,7 +1720,7 @@ class TestFillNan(unittest.TestCase): methods. """ - def test_fill_nan(self): + def test_fill_nan(self) -> None: """Test :func:`colour.utilities.array.fill_nan` definition.""" a = np.array([0.1, 0.2, np.nan, 0.4, 0.5]) @@ -1743,14 +1743,14 @@ class TestHasNanOnly(unittest.TestCase): methods. """ - def test_has_only_nan(self): + def test_has_only_nan(self) -> None: """Test :func:`colour.utilities.array.has_only_nan` definition.""" - assert has_only_nan(None) + assert has_only_nan(None) # pyright: ignore - assert has_only_nan([None, None]) + assert has_only_nan([None, None]) # pyright: ignore - assert not has_only_nan([True, None]) + assert not has_only_nan([True, None]) # pyright: ignore assert not has_only_nan([0.1, np.nan, 0.3]) @@ -1761,7 +1761,7 @@ class TestNdarrayWrite(unittest.TestCase): methods. """ - def test_ndarray_write(self): + def test_ndarray_write(self) -> None: """Test :func:`colour.utilities.array.ndarray_write` definition.""" a = np.linspace(0, 1, 10) @@ -1780,7 +1780,7 @@ class TestZeros(unittest.TestCase): methods. """ - def test_zeros(self): + def test_zeros(self) -> None: """Test :func:`colour.utilities.array.zeros` definition.""" np.testing.assert_equal(zeros(3), np.zeros(3)) @@ -1792,7 +1792,7 @@ class TestOnes(unittest.TestCase): methods. """ - def test_ones(self): + def test_ones(self) -> None: """Test :func:`colour.utilities.array.ones` definition.""" np.testing.assert_equal(ones(3), np.ones(3)) @@ -1804,7 +1804,7 @@ class TestFull(unittest.TestCase): methods. """ - def test_full(self): + def test_full(self) -> None: """Test :func:`colour.utilities.array.full` definition.""" np.testing.assert_equal(full(3, 0.5), np.full(3, 0.5)) @@ -1816,7 +1816,7 @@ class TestIndexAlongLastAxis(unittest.TestCase): unit tests methods. """ - def test_index_along_last_axis(self): + def test_index_along_last_axis(self) -> None: """Test :func:`colour.utilities.array.index_along_last_axis` definition.""" a = np.array( [ @@ -1866,7 +1866,7 @@ def test_index_along_last_axis(self): ), ) - def test_compare_with_argmin_argmax(self): + def test_compare_with_argmin_argmax(self) -> None: """ Test :func:`colour.utilities.array.index_along_last_axis` definition by comparison with :func:`argmin` and :func:`argmax`. @@ -1882,7 +1882,7 @@ def test_compare_with_argmin_argmax(self): index_along_last_axis(a, np.argmax(a, axis=-1)), np.max(a, axis=-1) ) - def test_exceptions(self): + def test_exceptions(self) -> None: """ Test :func:`colour.utilities.array.index_along_last_axis` definition handling of invalid inputs. @@ -1912,7 +1912,7 @@ class TestFormatArrayAsRow(unittest.TestCase): tests methods. """ - def test_format_array_as_row(self): + def test_format_array_as_row(self) -> None: """Test :func:`colour.utilities.array.format_array_as_row` definition.""" assert format_array_as_row([1.25, 2.5, 3.75]) == "1.2500000 2.5000000 3.7500000" diff --git a/colour/utilities/tests/test_callback.py b/colour/utilities/tests/test_callback.py index 9fde9a0ad..dba6a2f15 100644 --- a/colour/utilities/tests/test_callback.py +++ b/colour/utilities/tests/test_callback.py @@ -22,20 +22,22 @@ class TestMixinCallback: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" class WithCallback(MixinCallback): """Test :class:`MixinCallback` class.""" - def __init__(self): + def __init__(self) -> None: super().__init__() self.attribute_a = "a" self._with_callback = WithCallback() - def _on_attribute_a_changed(self, name: str, value: str) -> str: + def _on_attribute_a_changed( + self: TestMixinCallback, name: str, value: str + ) -> str: """Transform *self._attribute_a* to uppercase.""" value = value.upper() @@ -49,7 +51,7 @@ def _on_attribute_a_changed(self, name: str, value: str) -> str: self._on_attribute_a_changed = _on_attribute_a_changed - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("callbacks",) @@ -57,7 +59,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(MixinCallback) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -69,7 +71,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(MixinCallback) - def test_register_callback(self): + def test_register_callback(self) -> None: """ Test :class:`colour.utilities.callback.MixinCallback.register_callback` method. @@ -85,7 +87,7 @@ def test_register_callback(self): assert self._with_callback.attribute_a == "A" assert len(self._with_callback.callbacks) == 1 - def test_unregister_callback(self): + def test_unregister_callback(self) -> None: """ Test :class:`colour.utilities.callback.MixinCallback.unregister_callback` method. diff --git a/colour/utilities/tests/test_common.py b/colour/utilities/tests/test_common.py index 04038ffb6..eec5be2ee 100644 --- a/colour/utilities/tests/test_common.py +++ b/colour/utilities/tests/test_common.py @@ -65,7 +65,7 @@ class TestIsCachingEnabled: tests methods. """ - def test_is_caching_enabled(self): + def test_is_caching_enabled(self) -> None: """Test :func:`colour.utilities.common.is_caching_enabled` definition.""" with caching_enable(True): @@ -81,7 +81,7 @@ class TestSetCachingEnabled: tests methods. """ - def test_set_caching_enable(self): + def test_set_caching_enable(self) -> None: """Test :func:`colour.utilities.common.set_caching_enable` definition.""" with caching_enable(is_caching_enabled()): @@ -99,7 +99,7 @@ class TestCachingEnable: tests methods. """ - def test_caching_enable(self): + def test_caching_enable(self) -> None: """Test :func:`colour.utilities.common.caching_enable` definition.""" with caching_enable(True): @@ -109,7 +109,7 @@ def test_caching_enable(self): assert not is_caching_enabled() @caching_enable(True) - def fn_a(): + def fn_a() -> None: """:func:`caching_enable` unit tests :func:`fn_a` definition.""" assert is_caching_enabled() @@ -117,7 +117,7 @@ def fn_a(): fn_a() @caching_enable(False) - def fn_b(): + def fn_b() -> None: """:func:`caching_enable` unit tests :func:`fn_b` definition.""" assert not is_caching_enabled() @@ -132,7 +132,7 @@ class TestCacheRegistry: """ @staticmethod - def _default_test_cache_registry(): + def _default_test_cache_registry() -> CacheRegistry: """Create a default test cache registry.""" cache_registry = CacheRegistry() @@ -144,7 +144,7 @@ def _default_test_cache_registry(): return cache_registry - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("registry",) @@ -152,7 +152,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(CacheRegistry) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -167,13 +167,13 @@ def test_required_methods(self): for method in required_methods: assert method in dir(CacheRegistry) - def test__str__(self): + def test__str__(self) -> None: """Test :class:`colour.utilities.common.CacheRegistry.__str__` method.""" cache_registry = self._default_test_cache_registry() assert str(cache_registry) == "{'Cache A': '1 item(s)', 'Cache B': '2 item(s)'}" - def test_register_cache(self): + def test_register_cache(self) -> None: """ Test :class:`colour.utilities.common.CacheRegistry.register_cache` method. @@ -185,7 +185,7 @@ def test_register_cache(self): cache_b = cache_registry.register_cache("Cache B") assert cache_registry.registry == {"Cache A": cache_a, "Cache B": cache_b} - def test_unregister_cache(self): + def test_unregister_cache(self) -> None: """ Test :class:`colour.utilities.common.CacheRegistry.unregister_cache` method. @@ -196,7 +196,7 @@ def test_unregister_cache(self): assert "Cache A" not in cache_registry.registry assert "Cache B" in cache_registry.registry - def test_clear_cache(self): + def test_clear_cache(self) -> None: """ Test :class:`colour.utilities.common.CacheRegistry.clear_cache` method. @@ -209,7 +209,7 @@ def test_clear_cache(self): "Cache B": {"John": "Doe", "Luke": "Skywalker"}, } - def test_clear_all_caches(self): + def test_clear_all_caches(self) -> None: """ Test :class:`colour.utilities.common.CacheRegistry.clear_all_caches` method. @@ -226,7 +226,7 @@ class TestAttest: tests methods. """ - def test_attest(self): + def test_attest(self) -> None: """Test :func:`colour.utilities.common.attest` definition.""" assert attest(True, "") is None @@ -240,7 +240,7 @@ class TestBatch: methods. """ - def test_batch(self): + def test_batch(self) -> None: """Test :func:`colour.utilities.common.batch` definition.""" assert list(batch(tuple(range(10)), 3)) == [ @@ -266,7 +266,7 @@ def test_batch(self): ] -def _add(a: Real, b: Real): +def _add(a: Real, b: Real) -> Real: """ Add two numbers. @@ -297,7 +297,7 @@ class TestMultiprocessingPool: unit tests methods. """ - def test_multiprocessing_pool(self): + def test_multiprocessing_pool(self) -> None: """Test :func:`colour.utilities.common.multiprocessing_pool` definition.""" with multiprocessing_pool() as pool: @@ -321,7 +321,7 @@ class TestIsIterable: methods. """ - def test_is_iterable(self): + def test_is_iterable(self) -> None: """Test :func:`colour.utilities.common.is_iterable` definition.""" assert is_iterable("") @@ -351,7 +351,7 @@ class TestIsNumeric: methods. """ - def test_is_numeric(self): + def test_is_numeric(self) -> None: """Test :func:`colour.utilities.common.is_numeric` definition.""" assert is_numeric(1) @@ -371,7 +371,7 @@ class TestIsInteger: tests methods. """ - def test_is_integer(self): + def test_is_integer(self) -> None: """Test :func:`colour.utilities.common.is_integer` definition.""" assert is_integer(1) @@ -387,7 +387,7 @@ class TestIsSibling: methods. """ - def test_is_sibling(self): + def test_is_sibling(self) -> None: """Test :func:`colour.utilities.common.is_sibling` definition.""" class Element: @@ -419,7 +419,7 @@ class TestFilterKwargs: tests methods. """ - def test_filter_kwargs(self): + def test_filter_kwargs(self) -> None: """Test :func:`colour.utilities.common.filter_kwargs` definition.""" def fn_a(a: Any) -> Any: @@ -452,7 +452,7 @@ class TestFilterMapping: tests methods. """ - def test_filter_mapping(self): + def test_filter_mapping(self) -> None: """Test :func:`colour.utilities.common.filter_mapping` definition.""" class Element: @@ -494,7 +494,7 @@ class TestFirstItem: tests methods. """ - def test_first_item(self): + def test_first_item(self) -> None: """Test :func:`colour.utilities.common.first_item` definition.""" assert first_item(range(10)) == 0 @@ -511,7 +511,7 @@ class TestValidateMethod: tests methods. """ - def test_validate_method(self): + def test_validate_method(self) -> None: """Test :func:`colour.utilities.common.validate_method` definition.""" assert validate_method("Valid", ("Valid", "Yes", "Ok")) == "valid" @@ -520,7 +520,7 @@ def test_validate_method(self): == "Valid" ) - def test_raise_exception_validate_method(self): + def test_raise_exception_validate_method(self) -> None: """ Test :func:`colour.utilities.common.validate_method` definition raised exception. @@ -535,7 +535,7 @@ class TestOptional: tests methods. """ - def test_optional(self): + def test_optional(self) -> None: """Test :func:`colour.utilities.common.optional` definition.""" assert optional("Foo", "Bar") == "Foo" @@ -549,7 +549,7 @@ class TestSlugify: methods. """ - def test_slugify(self): + def test_slugify(self) -> None: """Test :func:`colour.utilities.common.slugify` definition.""" assert ( @@ -584,7 +584,7 @@ class TestIntDigest: methods. """ - def test_int_digest(self): + def test_int_digest(self) -> None: """Test :func:`colour.utilities.common.int_digest` definition.""" assert int_digest("Foo") == 7467386374397815550 diff --git a/colour/utilities/tests/test_deprecated.py b/colour/utilities/tests/test_deprecated.py index 88c1b4819..6101abd6d 100644 --- a/colour/utilities/tests/test_deprecated.py +++ b/colour/utilities/tests/test_deprecated.py @@ -1,5 +1,7 @@ """Define the unit tests helper module for the deprecation management.""" +from __future__ import annotations + import contextlib import sys @@ -14,7 +16,7 @@ class deprecated(ModuleAPI): """Define a class acting like the *deprecated* 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) diff --git a/colour/utilities/tests/test_deprecation.py b/colour/utilities/tests/test_deprecation.py index 4e88eca40..5871becb1 100644 --- a/colour/utilities/tests/test_deprecation.py +++ b/colour/utilities/tests/test_deprecation.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.utilities.deprecation` module.""" +from __future__ import annotations + import sys import pytest @@ -53,7 +55,7 @@ class TestObjectRenamed: tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -61,7 +63,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ObjectRenamed) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.ObjectRenamed.__str__` method. @@ -77,7 +79,7 @@ class TestObjectRemoved: tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -85,7 +87,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ObjectRemoved) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.ObjectRemoved.__str__` method. @@ -100,7 +102,7 @@ class TestObjectFutureRename: tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -108,7 +110,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ObjectFutureRename) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.ObjectFutureRename.__str__` method. @@ -124,7 +126,7 @@ class TestObjectFutureRemove: tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -132,7 +134,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ObjectFutureRemove) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.ObjectFutureRemove.__str__` method. @@ -151,7 +153,7 @@ class TestObjectFutureAccessChange: class unit tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -159,7 +161,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ObjectFutureAccessChange) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.\ ObjectFutureAccessChange.__str__` method. @@ -175,7 +177,7 @@ class TestObjectFutureAccessRemove: class unit tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -183,7 +185,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ObjectFutureAccessRemove) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.\ ObjectFutureAccessRemove.__str__` method. @@ -202,7 +204,7 @@ class TestArgumentRenamed: tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -210,7 +212,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ArgumentRenamed) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.ArgumentRenamed.__str__` method. @@ -226,7 +228,7 @@ class TestArgumentRemoved: tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -234,7 +236,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ArgumentRemoved) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.ArgumentRemoved.__str__` method. @@ -249,7 +251,7 @@ class TestArgumentFutureRename: unit tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -257,7 +259,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ArgumentFutureRename) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.\ ArgumentFutureRename.__str__` method. @@ -273,7 +275,7 @@ class TestArgumentFutureRemove: unit tests methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__str__",) @@ -281,7 +283,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ArgumentFutureRemove) - def test__str__(self): + def test__str__(self) -> None: """ Test :meth:`colour.utilities.deprecation.\ ArgumentFutureRemove.__str__` method. @@ -300,7 +302,7 @@ class TestModuleAPI: methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__init__", "__getattr__", "__dir__") @@ -308,7 +310,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(ModuleAPI) - def test__getattr__(self): + def test__getattr__(self) -> None: """ Test :meth:`colour.utilities.deprecation.ModuleAPI.__getattr__` method. @@ -318,16 +320,16 @@ def test__getattr__(self): assert colour.utilities.tests.test_deprecated.NAME is None - def assert_warns(): + def assert_warns() -> None: """Help to test the runtime warning.""" - colour.utilities.tests.test_deprecated.OLD_NAME # noqa: B018 + colour.utilities.tests.test_deprecated.OLD_NAME # noqa: B018 # pyright: ignore pytest.warns(ColourUsageWarning, assert_warns) del sys.modules["colour.utilities.tests.test_deprecated"] - def test_raise_exception__getattr__(self): + def test_raise_exception__getattr__(self) -> None: """ Test :func:`colour.utilities.deprecation.ModuleAPI.__getattr__` method raised exception. @@ -351,7 +353,7 @@ class TestGetAttribute: tests methods. """ - def test_get_attribute(self): + def test_get_attribute(self) -> None: """Test :func:`colour.utilities.deprecation.get_attribute` definition.""" from colour import adaptation @@ -383,7 +385,7 @@ class TestBuildAPIChanges: unit tests methods. """ - def test_build_API_changes(self): + def test_build_API_changes(self) -> None: """ Test :func:`colour.utilities.deprecation.build_API_changes` definition. @@ -449,7 +451,7 @@ class TestHandleArgumentsDeprecation: definition unit tests methods. """ - def test_handle_arguments_deprecation(self): + def test_handle_arguments_deprecation(self) -> None: """ Test :func:`colour.utilities.deprecation.handle_arguments_deprecation` definition. diff --git a/colour/utilities/tests/test_documentation.py b/colour/utilities/tests/test_documentation.py index ca0e08c2a..5256d62fe 100644 --- a/colour/utilities/tests/test_documentation.py +++ b/colour/utilities/tests/test_documentation.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.utilities.documentation` module.""" +from __future__ import annotations + import os from colour.utilities.documentation import is_documentation_building @@ -22,7 +24,7 @@ class TestIsDocumentationBuilding: definition unit tests methods. """ - def test_is_documentation_building(self): + def test_is_documentation_building(self) -> None: """ Test :func:`colour.utilities.documentation.is_documentation_building` definition. diff --git a/colour/utilities/tests/test_metrics.py b/colour/utilities/tests/test_metrics.py index e2b575967..48ac77ee6 100644 --- a/colour/utilities/tests/test_metrics.py +++ b/colour/utilities/tests/test_metrics.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.utilities.metrics` module.""" +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -24,7 +26,7 @@ class TestMetricMse: methods. """ - def test_metric_mse(self): + def test_metric_mse(self) -> None: """Test :func:`colour.utilities.metrics.metric_mse` definition.""" a = np.array([0.48222001, 0.31654775, 0.22070353]) @@ -51,7 +53,7 @@ class TestMetricPsnr: methods. """ - def test_metric_psnr(self): + def test_metric_psnr(self) -> None: """Test :func:`colour.utilities.metrics.metric_psnr` definition.""" a = np.array([0.48222001, 0.31654775, 0.22070353]) diff --git a/colour/utilities/tests/test_network.py b/colour/utilities/tests/test_network.py index 72b911de9..2586dfc05 100644 --- a/colour/utilities/tests/test_network.py +++ b/colour/utilities/tests/test_network.py @@ -1,9 +1,12 @@ """Define the unit tests for the :mod:`colour.utilities.network` module.""" +from __future__ import annotations + import re import numpy as np +from colour.hints import Any from colour.utilities import ( ExecutionNode, For, @@ -40,7 +43,7 @@ class TestTreeNode: methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._data = {"John": "Doe"} @@ -56,7 +59,7 @@ def setup_method(self): self._tree = self._node_a - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -73,7 +76,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(TreeNode) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -91,29 +94,29 @@ def test_required_methods(self): for method in required_methods: assert method in dir(TreeNode) - def test_name(self): + def test_name(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.name` property.""" assert self._tree.name == "Node A" assert "Node#" in TreeNode().name - def test_parent(self): + def test_parent(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.parent` property.""" assert self._node_b.parent is self._node_a assert self._node_h.parent is self._node_g - def test_children(self): + def test_children(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.children` property.""" assert self._node_a.children == [self._node_b, self._node_c] - def test_id(self): + def test_id(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.id` property.""" assert isinstance(self._node_a.id, int) - def test_root(self): + def test_root(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.root` property.""" assert self._node_a.root is self._node_a @@ -121,37 +124,37 @@ def test_root(self): assert self._node_g.root is self._node_a assert self._node_h.root is self._node_a - def test_leaves(self): + def test_leaves(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.leaves` property.""" assert list(self._node_h.leaves) == [self._node_h] assert list(self._node_a.leaves) == [self._node_h, self._node_e, self._node_c] - def test_siblings(self): + def test_siblings(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.siblings` property.""" assert list(self._node_a.siblings) == [] assert list(self._node_b.siblings) == [self._node_c] - def test_data(self): + def test_data(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.data` property.""" assert self._node_a.data is self._data - def test__str__(self): + def test__str__(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.__str__` method.""" assert "TreeNode#" in str(self._node_a) assert "{'John': 'Doe'})" in str(self._node_a) - def test__len__(self): + def test__len__(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.__len__` method.""" assert len(self._node_a) == 7 - def test_is_root(self): + def test_is_root(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.is_root` method.""" assert self._node_a.is_root() @@ -159,7 +162,7 @@ def test_is_root(self): assert not self._node_c.is_root() assert not self._node_h.is_root() - def test_is_inner(self): + def test_is_inner(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.is_inner` method.""" assert not self._node_a.is_inner() @@ -167,7 +170,7 @@ def test_is_inner(self): assert not self._node_c.is_inner() assert not self._node_h.is_inner() - def test_is_leaf(self): + def test_is_leaf(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.is_leaf` method.""" assert not self._node_a.is_leaf() @@ -175,7 +178,7 @@ def test_is_leaf(self): assert self._node_c.is_leaf() assert self._node_h.is_leaf() - def test_walk_hierarchy(self): + def test_walk_hierarchy(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.walk_hierarchy` method.""" assert list(self._node_a.walk_hierarchy()) == [ @@ -196,7 +199,7 @@ def test_walk_hierarchy(self): self._node_a, ] - def test_render(self): + def test_render(self) -> None: """Test :attr:`colour.utilities.network.TreeNode.render` method.""" assert isinstance(self._node_a.render(), str) @@ -207,9 +210,7 @@ class TestPort: Define :class:`colour.utilities.network.Port` class unit tests methods. """ - def setup_method(self): - """Initialise the common tests attributes.""" - + def __init__(self) -> None: class Node(PortNode): ... self._node_a = Node("Node A") @@ -235,7 +236,12 @@ class Node(PortNode): ... self._port_output_node_b, ] - def test_required_attributes(self): + def setup_method(self) -> None: + """Initialise the common tests attributes.""" + + self.__init__() + + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -249,7 +255,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(Port) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -265,7 +271,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(Port) - def test_name(self): + def test_name(self) -> None: """Test :attr:`colour.utilities.network.Port.name` property.""" assert self._port_a_node_a.name == "a" @@ -275,7 +281,7 @@ def test_name(self): assert self._port_b_node_b.name == "b" assert self._port_output_node_b.name == "output" - def test_value(self): + def test_value(self) -> None: """Test :attr:`colour.utilities.network.Port.value` property.""" assert self._port_a_node_a.value == 1 @@ -289,13 +295,17 @@ def test_value(self): self._port_output_node_a.connect(self._port_b_node_b) self._port_output_node_a.value = 2 + assert self._port_output_node_a.node is not None assert self._port_output_node_a.node.dirty is True + assert self._port_a_node_b.node is not None assert self._port_a_node_b.node.dirty is True assert self._port_a_node_b.value == 2 assert self._port_b_node_b.value == 2 self._port_a_node_b.value = 3 + assert self._port_a_node_b.node is not None assert self._port_a_node_b.node.dirty is True + assert self._port_output_node_a.node is not None assert self._port_output_node_a.node.dirty is True assert self._port_output_node_a.value == 3 assert self._port_b_node_b.value == 3 @@ -304,6 +314,7 @@ def test_value(self): self._port_output_node_a.value = 2 self._port_output_node_a.node.process() + assert self._port_output_node_a.node is not None assert self._port_output_node_a.node.dirty is False assert self._port_a_node_b.node.dirty is True assert self._port_a_node_b.value == 3 @@ -311,7 +322,7 @@ def test_value(self): self._port_output_node_a.disconnect(self._port_b_node_b) - def test_description(self): + def test_description(self) -> None: """Test :attr:`colour.utilities.network.Port.description` property.""" assert self._port_a_node_a.description == "Port A" @@ -321,7 +332,7 @@ def test_description(self): assert self._port_b_node_b.description is None assert self._port_output_node_b.description == "Output" - def test_node(self): + def test_node(self) -> None: """Test :attr:`colour.utilities.network.Port.node` property.""" assert self._port_a_node_a.node is self._node_a @@ -331,7 +342,7 @@ def test_node(self): assert port.node is None - def test_connections(self): + def test_connections(self) -> None: """Test :attr:`colour.utilities.network.Port.connections` property.""" for port in self._ports: @@ -350,7 +361,7 @@ def test_connections(self): for port in self._ports: assert len(port.connections) == 0 - def test___str__(self): + def test___str__(self) -> None: """Test :meth:`colour.utilities.network.Port.__str__` method.""" assert str(self._port_a_node_a) == "Node A.a (<- [])" @@ -378,7 +389,7 @@ def test___str__(self): self._port_output_node_a.disconnect(self._port_a_node_b) self._port_output_node_a.disconnect(self._port_b_node_b) - def test_is_input_port(self): + def test_is_input_port(self) -> None: """Test :meth:`colour.utilities.network.Port.is_input_port` method.""" assert self._port_a_node_a.is_input_port() is True @@ -389,7 +400,7 @@ def test_is_input_port(self): assert self._port_b_node_b.is_input_port() is True assert self._port_output_node_b.is_input_port() is False - def test_is_output_port(self): + def test_is_output_port(self) -> None: """Test :meth:`colour.utilities.network.Port.is_output_port` method.""" assert self._port_a_node_a.is_output_port() is False @@ -400,17 +411,17 @@ def test_is_output_port(self): assert self._port_b_node_b.is_output_port() is False assert self._port_output_node_b.is_output_port() is True - def test_connect(self): + def test_connect(self) -> None: """Test :meth:`colour.utilities.network.Port.connect` method.""" self.test_connections() - def test_disconnect(self): + def test_disconnect(self) -> None: """Test :meth:`colour.utilities.network.Port.disconnect` method.""" self.test_connections() - def test_to_graphviz(self): + def test_to_graphviz(self) -> None: """Test :meth:`colour.utilities.network.Port.test_to_graphviz` method.""" assert self._port_a_node_a.to_graphviz() == " a" @@ -423,7 +434,7 @@ def test_to_graphviz(self): class _NodeAdd(ExecutionNode): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.description = "Perform the addition of the two input port values." @@ -432,7 +443,7 @@ def __init__(self, *args, **kwargs): self.add_input_port("b") self.add_output_port("output") - def process(self): + def process(self) -> None: a = self.get_input("a") b = self.get_input("b") @@ -445,7 +456,7 @@ def process(self): class _NodeMultiply(ExecutionNode): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.description = "Perform the multiplication of the two input port values." @@ -454,7 +465,7 @@ def __init__(self, *args, **kwargs): self.add_input_port("b") self.add_output_port("output") - def process(self): + def process(self) -> None: a = self.get_input("a") b = self.get_input("b") @@ -471,7 +482,7 @@ class TestPortNode: Define :class:`colour.utilities.network.PortNode` class unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._add_node_1 = _NodeAdd("Node Add 1") @@ -480,7 +491,7 @@ def setup_method(self): self._nodes = [self._add_node_1, self._multiply_node_1, self._add_node_2] - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ( @@ -494,7 +505,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(PortNode) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -516,7 +527,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(PortNode) - def test_input_ports(self): + def test_input_ports(self) -> None: """Test :attr:`colour.utilities.network.PortNode.input_ports` property.""" for name in ("a", "b"): @@ -524,7 +535,7 @@ def test_input_ports(self): assert name in self._multiply_node_1.input_ports assert name in self._add_node_2.input_ports - def test_output_ports(self): + def test_output_ports(self) -> None: """Test :attr:`colour.utilities.network.PortNode.output_ports` property.""" for name in ("output",): @@ -532,7 +543,7 @@ def test_output_ports(self): assert name in self._multiply_node_1.output_ports assert name in self._add_node_2.output_ports - def test_dirty(self): + def test_dirty(self) -> None: """Test :attr:`colour.utilities.network.PortNode.dirty` property.""" assert self._add_node_1.dirty is True @@ -573,7 +584,7 @@ def test_dirty(self): assert self._multiply_node_1.dirty is True assert self._add_node_2.dirty is True - def test_edges(self): + def test_edges(self) -> None: """Test :attr:`colour.utilities.network.PortNode.edges` property.""" assert self._add_node_1.edges == ({}, {}) @@ -623,7 +634,7 @@ def test_edges(self): assert self._multiply_node_1.edges == ({}, {}) assert self._add_node_2.edges == ({}, {}) - def test_description(self): + def test_description(self) -> None: """Test :attr:`colour.utilities.network.PortNode.description` property.""" assert ( @@ -639,7 +650,7 @@ def test_description(self): == "Perform the addition of the two input port values." ) - def test_add_input_port(self): + def test_add_input_port(self) -> None: """Test :meth:`colour.utilities.network.PortNode.add_input_port` method.""" node = PortNode() @@ -648,7 +659,7 @@ def test_add_input_port(self): assert node.input_ports["a"].value == 1 assert node.input_ports["a"].description == 'Input Port "a"' - def test_remove_input_port(self): + def test_remove_input_port(self) -> None: """Test :meth:`colour.utilities.network.PortNode.remove_input_port` method.""" node = PortNode() @@ -657,7 +668,7 @@ def test_remove_input_port(self): assert len(node.input_ports) == 0 - def test_add_output_port(self): + def test_add_output_port(self) -> None: """Test :meth:`colour.utilities.network.PortNode.add_output_port` method.""" node = PortNode() @@ -666,7 +677,7 @@ def test_add_output_port(self): assert node.output_ports["output"].value == 1 assert node.output_ports["output"].description == 'Output Port "output"' - def test_remove_output_port(self): + def test_remove_output_port(self) -> None: """Test :meth:`colour.utilities.network.PortNode.remove_output_port` method.""" node = PortNode() @@ -675,7 +686,7 @@ def test_remove_output_port(self): assert len(node.input_ports) == 0 - def test_get_input(self): + def test_get_input(self) -> None: """Test :meth:`colour.utilities.network.PortNode.get_input` method.""" node = PortNode() @@ -683,7 +694,7 @@ def test_get_input(self): assert node.get_input("a") == 1 - def test_set_input(self): + def test_set_input(self) -> None: """Test :meth:`colour.utilities.network.PortNode.set_input` method.""" node = PortNode() @@ -695,7 +706,7 @@ def test_set_input(self): assert node.input_ports["a"].value == 2 - def test_get_output(self): + def test_get_output(self) -> None: """Test :meth:`colour.utilities.network.PortNode.get_output` method.""" node = PortNode() @@ -703,7 +714,7 @@ def test_get_output(self): assert node.get_output("output") == 1 - def test_set_output(self): + def test_set_output(self) -> None: """Test :meth:`colour.utilities.network.PortNode.set_output` method.""" node = PortNode() @@ -715,17 +726,17 @@ def test_set_output(self): assert node.output_ports["output"].value == 2 - def test_connect(self): + def test_connect(self) -> None: """Test :meth:`colour.utilities.network.PortNode.connect` method.""" self.test_edges() - def test_disconnect(self): + def test_disconnect(self) -> None: """Test :meth:`colour.utilities.network.PortNode.disconnect` method.""" self.test_edges() - def test_process(self): + def test_process(self) -> None: """Test :meth:`colour.utilities.network.PortNode.process` method.""" self._add_node_1.connect("output", self._multiply_node_1, "a") @@ -747,7 +758,7 @@ def test_process(self): self._add_node_1.disconnect("output", self._multiply_node_1, "a") self._multiply_node_1.disconnect("output", self._add_node_2, "a") - def test_to_graphviz(self): + def test_to_graphviz(self) -> None: """Test :meth:`colour.utilities.network.PortNode.to_graphviz` method.""" assert ( @@ -772,7 +783,7 @@ class TestPortGraph: Define :class:`colour.utilities.network.PortGraph` class unit tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._add_node_1 = _NodeAdd("Node Add 1") @@ -798,7 +809,7 @@ def setup_method(self): for node in self._nodes.values(): self._graph.add_node(node) - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("nodes",) @@ -806,7 +817,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(PortGraph) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -822,17 +833,17 @@ def test_required_methods(self): for method in required_methods: assert method in dir(PortGraph) - def test_nodes(self): + def test_nodes(self) -> None: """Test :attr:`colour.utilities.network.PortGraph.nodes` property.""" assert self._graph.nodes == self._nodes - def test___str__(self): + def test___str__(self) -> None: """Test :meth:`colour.utilities.network.PortGraph.__str__` method.""" assert str(self._graph) == "PortGraph(3)" - def test_add_node(self): + def test_add_node(self) -> None: """Test :meth:`colour.utilities.network.PortGraph.add_node` method.""" for node in self._nodes.values(): @@ -845,24 +856,24 @@ def test_add_node(self): assert len(self._graph.nodes) == 3 - def test_remove_node(self): + def test_remove_node(self) -> None: """Test :meth:`colour.utilities.network.PortGraph.remove_node` method.""" self.test_add_node() - def test_walk_ports(self): + def test_walk_ports(self) -> None: """Test :meth:`colour.utilities.network.PortGraph.walk_ports` method.""" assert list(self._graph.walk_ports()) == list(self._nodes.values()) - def test_process(self): + def test_process(self) -> None: """Test :meth:`colour.utilities.network.PortGraph.process` method.""" self._graph.process() assert self._add_node_2.get_output("output") == 5 - def test_to_graphviz(self): + def test_to_graphviz(self) -> None: """Test :meth:`colour.utilities.network.PortGraph.to_graphviz` method.""" if not is_pydot_installed(): @@ -874,7 +885,7 @@ def test_to_graphviz(self): class _AddItem(ExecutionNode): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.description = "Add the item with input key and value to the input mapping." @@ -883,7 +894,7 @@ def __init__(self, *args, **kwargs): self.add_input_port("value") self.add_input_port("mapping", {}) - def process(self): + def process(self) -> None: """ Process the node. """ @@ -900,7 +911,7 @@ def process(self): class _NodeSumMappingValues(ExecutionNode): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.description = "Sum the input mapping values." @@ -908,7 +919,7 @@ def __init__(self, *args, **kwargs): self.add_input_port("mapping", {}) self.add_output_port("summation") - def process(self): + def process(self) -> None: mapping = self.get_input("mapping") if len(mapping) == 0: return @@ -919,7 +930,7 @@ def process(self): class _SubGraph1(ExecutionNode, PortGraph): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.add_input_port("input") @@ -970,7 +981,7 @@ def __init__(self, *args, **kwargs): self.connect("input", self.nodes["Add Item"], "key") self.nodes["Add Item"].connect("mapping", self, "output") - def process(self, **kwargs) -> None: + def process(self, **kwargs: Any) -> None: self.nodes["Add 1"].set_input("a", 1) self.nodes["Multiply 1"].set_input("b", 2) self.nodes["Add 2"].set_input("b", 3) @@ -983,7 +994,7 @@ class TestFor: Define :class:`colour.utilities.network.For` class unit tests methods. """ - def test_For(self): + def test_For(self) -> None: """Test :class:`colour.utilities.network.For` class.""" sum_mapping_values = _NodeSumMappingValues() @@ -1002,7 +1013,7 @@ def test_For(self): class _NodeSumArray(ExecutionNode): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.description = "Sum the input array." @@ -1010,7 +1021,7 @@ def __init__(self, *args, **kwargs): self.add_input_port("array", []) self.add_output_port("summation") - def process(self): + def process(self) -> None: array = self.get_input("array") if len(array) == 0: return @@ -1021,7 +1032,7 @@ def process(self): class _SubGraph2(ExecutionNode, PortGraph): - def __init__(self, *args, **kwargs): + def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.add_input_port("input") @@ -1062,7 +1073,7 @@ def __init__(self, *args, **kwargs): self.connect("input", self.nodes["Add 1"], "b") self.nodes["Add 2"].connect("output", self, "output") - def process(self, **kwargs) -> None: + def process(self, **kwargs: Any) -> None: self.nodes["Add 1"].set_input("a", 1) self.nodes["Multiply 1"].set_input("b", 2) self.nodes["Add 2"].set_input("b", 3) @@ -1076,7 +1087,7 @@ class TestParallelForThread: methods. """ - def test_ParallelForThread(self): + def test_ParallelForThread(self) -> None: """Test :class:`colour.utilities.network.ParallelForThread` class.""" sum_array = _NodeSumArray() @@ -1100,7 +1111,7 @@ class TestParallelForMultiProcess: tests methods. """ - def test_ParallelForMultiProcess(self): + def test_ParallelForMultiProcess(self) -> None: """Test :class:`colour.utilities.network.ParallelForMultiProcess` class.""" sum_array = _NodeSumArray() diff --git a/colour/utilities/tests/test_structures.py b/colour/utilities/tests/test_structures.py index 114054520..fb0ea1d17 100644 --- a/colour/utilities/tests/test_structures.py +++ b/colour/utilities/tests/test_structures.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.utilities.structures` module.""" +from __future__ import annotations + import operator import pickle @@ -35,7 +37,7 @@ class TestStructure: tests methods. """ - def test_Structure(self): + def test_Structure(self) -> None: """Test :class:`colour.utilities.structures.Structure` class.""" structure = Structure(John="Doe", Jane="Doe") @@ -68,7 +70,7 @@ def test_Structure(self): assert structure.John == "Doe" assert structure["John"] == "Doe" - def test_pickling(self): + def test_pickling(self) -> None: """ Test whether :class:`colour.utilities.structures.Structure` class can be pickled. @@ -93,7 +95,7 @@ class TestLookup: methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("keys_from_value", "first_key_from_value") @@ -101,7 +103,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(Lookup) - def test_keys_from_value(self): + def test_keys_from_value(self) -> None: """ Test :meth:`colour.utilities.structures.Lookup.keys_from_value` method. @@ -115,7 +117,7 @@ def test_keys_from_value(self): ) assert sorted(lookup.keys_from_value(np.array([0, 1, 2]))) == ["A", "B"] - def test_first_key_from_value(self): + def test_first_key_from_value(self) -> None: """ Test :meth:`colour.utilities.structures.\ Lookup.first_key_from_value` method. @@ -129,7 +131,7 @@ def test_first_key_from_value(self): ) assert lookup.first_key_from_value(np.array([0, 1, 2])) == "A" - def test_raise_exception_first_key_from_value(self): + def test_raise_exception_first_key_from_value(self) -> None: """ Test :meth:`colour.utilities.structures.\ Lookup.first_key_from_value` method raised exception. @@ -144,7 +146,7 @@ class TestCanonicalMapping: unit tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = ("data",) @@ -152,7 +154,7 @@ def test_required_attributes(self): for attribute in required_attributes: assert attribute in dir(CanonicalMapping) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ( @@ -178,7 +180,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(CanonicalMapping) - def test_data(self): + def test_data(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.data` property. @@ -189,7 +191,7 @@ def test_data(self): "Jane": "Doe", } - def test__repr__(self): + def test__repr__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.__repr__` method. @@ -200,7 +202,7 @@ def test__repr__(self): mapping["John"] = "Doe" assert repr(mapping) == "CanonicalMapping({'John': 'Doe'})" - def test__setitem__(self): + def test__setitem__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ __setitem__` method. @@ -212,7 +214,7 @@ def test__setitem__(self): assert mapping["John"] == "Doe" assert mapping["john"] == "Doe" - def test__getitem__(self): + def test__getitem__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ __getitem__` method. @@ -238,7 +240,7 @@ def test__getitem__(self): assert mapping["mccamy1992"] == 1 assert mapping["hernandez1999"] == 2 - def test__delitem__(self): + def test__delitem__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ __delitem__` method. @@ -281,7 +283,7 @@ def test__delitem__(self): assert len(mapping) == 0 - def test__contains__(self): + def test__contains__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ __contains__` method. @@ -303,7 +305,7 @@ def test__contains__(self): assert "mccamy1992" in mapping assert "hernandez1999" in mapping - def test__iter__(self): + def test__iter__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.__iter__` method. @@ -312,7 +314,7 @@ def test__iter__(self): mapping = CanonicalMapping(John="Doe", Jane="Doe") assert sorted(item for item in mapping) == ["Jane", "John"] - def test__len__(self): + def test__len__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.__len__` method. @@ -322,7 +324,7 @@ def test__len__(self): assert len(CanonicalMapping(John="Doe", Jane="Doe")) == 2 - def test__eq__(self): + def test__eq__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.__eq__` method. @@ -336,7 +338,7 @@ def test__eq__(self): assert mapping2 != mapping3 - def test_raise_exception__eq__(self): + def test_raise_exception__eq__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.__eq__` method raised exception. @@ -349,7 +351,7 @@ def test_raise_exception__eq__(self): ["John", "Doe", "Jane", "Doe"], ) - def test__ne__(self): + def test__ne__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.__ne__` method. @@ -360,7 +362,7 @@ def test__ne__(self): assert mapping1 != mapping2 - def test_raise_exception__ne__(self): + def test_raise_exception__ne__(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.__ne__` method raised exception. @@ -373,7 +375,7 @@ def test_raise_exception__ne__(self): ["John", "Doe", "Jane", "Doe"], ) - def test_copy(self): + def test_copy(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.copy` method. @@ -386,7 +388,7 @@ def test_copy(self): assert id(mapping1) != id(mapping2) - def test_lower_keys(self): + def test_lower_keys(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ lower_keys` method. @@ -400,7 +402,7 @@ def test_lower_keys(self): pytest.warns(ColourUsageWarning, lambda: list(mapping.lower_keys())) - def test_lower_items(self): + def test_lower_items(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ lower_items` method. @@ -413,7 +415,7 @@ def test_lower_items(self): ("john", "Doe"), ] - def test_slugified_keys(self): + def test_slugified_keys(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ slugified_keys` method. @@ -430,7 +432,7 @@ def test_slugified_keys(self): pytest.warns(ColourUsageWarning, lambda: list(mapping.slugified_keys())) - def test_slugified_items(self): + def test_slugified_items(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ slugified_items` method. @@ -442,7 +444,7 @@ def test_slugified_items(self): ("mccamy-1992", 1), ] - def test_canonical_keys(self): + def test_canonical_keys(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ canonical_keys` method. @@ -459,7 +461,7 @@ def test_canonical_keys(self): pytest.warns(ColourUsageWarning, lambda: list(mapping.canonical_keys())) - def test_canonical_items(self): + def test_canonical_items(self) -> None: """ Test :meth:`colour.utilities.structures.CanonicalMapping.\ canonical_items` method. @@ -478,7 +480,7 @@ class TestLazyCanonicalMapping: unit tests methods. """ - def test_required_attributes(self): + def test_required_attributes(self) -> None: """Test the presence of required attributes.""" required_attributes = () @@ -486,7 +488,7 @@ def test_required_attributes(self): for attribute in required_attributes: # pragma: no cover assert attribute in dir(LazyCanonicalMapping) - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("__getitem__",) @@ -494,7 +496,7 @@ def test_required_methods(self): for method in required_methods: assert method in dir(LazyCanonicalMapping) - def test__getitem__(self): + def test__getitem__(self) -> None: """ Test :meth:`colour.utilities.structures.LazyCanonicalMapping.\ __getitem__` method. diff --git a/colour/utilities/tests/test_verbose.py b/colour/utilities/tests/test_verbose.py index 23125f279..76e5cfbdc 100644 --- a/colour/utilities/tests/test_verbose.py +++ b/colour/utilities/tests/test_verbose.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.utilities.verbose` module.""" +from __future__ import annotations + import os import sys import textwrap @@ -41,7 +43,7 @@ class TestMixinLogging: methods. """ - def test_required_methods(self): + def test_required_methods(self) -> None: """Test the presence of required methods.""" required_methods = ("log",) @@ -56,18 +58,18 @@ class TestShowWarning: methods. """ - def test_show_warning(self): + def test_show_warning(self) -> None: """Test :func:`colour.utilities.verbose.show_warning` definition.""" - show_warning("This is a unit test warning!", Warning, None, None) + show_warning("This is a unit test warning!", Warning, __file__, 0) with open(os.devnull) as dev_null: - show_warning("This is a unit test warning!", Warning, None, None, dev_null) + show_warning("This is a unit test warning!", Warning, __file__, 0, dev_null) stderr = sys.stderr try: sys.stderr = None - show_warning("This is a unit test warning!", Warning, None, None) + show_warning("This is a unit test warning!", Warning, __file__, 0) finally: sys.stderr = stderr @@ -78,7 +80,7 @@ class TestAsBool: methods. """ - def test_as_bool(self): + def test_as_bool(self) -> None: """Test :func:`colour.utilities.common.as_bool` definition.""" assert as_bool("1") @@ -102,7 +104,7 @@ class TestSuppressWarnings: tests methods. """ - def test_suppress_warnings(self): + def test_suppress_warnings(self) -> None: """Test :func:`colour.utilities.verbose.suppress_warnings` definition.""" with suppress_warnings(): @@ -115,7 +117,7 @@ class TestSuppressStdout: tests methods. """ - def test_suppress_stdout(self): + def test_suppress_stdout(self) -> None: """Test :func:`colour.utilities.verbose.suppress_stdout` definition.""" with suppress_stdout(): @@ -128,7 +130,7 @@ class TestDescribeEnvironment: unit tests methods. """ - def test_describe_environment(self): + def test_describe_environment(self) -> None: """Test :func:`colour.utilities.verbose.describe_environment` definition.""" environment = describe_environment() @@ -165,7 +167,7 @@ class TestMultilineStr: tests methods. """ - def test_multiline_str(self): + def test_multiline_str(self) -> None: """Test :func:`colour.utilities.verbose.multiline_str` definition.""" class Data: @@ -233,7 +235,7 @@ class TestMultilineRepr: tests methods. """ - def test_multiline_repr(self): + def test_multiline_repr(self) -> None: """Test :func:`colour.utilities.verbose.multiline_repr` definition.""" class Data: diff --git a/colour/utilities/verbose.py b/colour/utilities/verbose.py index edd710beb..c90260823 100644 --- a/colour/utilities/verbose.py +++ b/colour/utilities/verbose.py @@ -150,7 +150,7 @@ def message_box( width: int = 79, padding: int = 3, print_callable: Callable = print, -): +) -> None: """ Print a message inside a box. @@ -200,7 +200,7 @@ def message_box( ideal_width = width - padding * 2 - 2 - def inner(text): + def inner(text: str) -> str: """Format and pads inner text for the message box.""" return ( @@ -301,7 +301,7 @@ def show_warning( warnings.showwarning = show_warning # pragma: no cover -def warning(*args: Any, **kwargs: Any): +def warning(*args: Any, **kwargs: Any) -> None: """ Issue a warning. @@ -322,7 +322,7 @@ def warning(*args: Any, **kwargs: Any): warn(*args, **kwargs) # noqa: B028 -def runtime_warning(*args: Any, **kwargs: Any): +def runtime_warning(*args: Any, **kwargs: Any) -> None: """ Issue a runtime warning. @@ -343,7 +343,7 @@ def runtime_warning(*args: Any, **kwargs: Any): warning(*args, **kwargs) -def usage_warning(*args: Any, **kwargs: Any): +def usage_warning(*args: Any, **kwargs: Any) -> None: """ Issue a usage warning. @@ -369,7 +369,7 @@ def filter_warnings( colour_usage_warnings: bool | LiteralWarning | None = None, colour_warnings: bool | LiteralWarning | None = None, python_warnings: bool | LiteralWarning | None = None, -): +) -> None: """ Filter *Colour* and also optionally overall Python warnings. @@ -595,7 +595,7 @@ def __enter__(self) -> suppress_stdout: return self - def __exit__(self, *args: Any): + def __exit__(self, *args: Any) -> None: """Restore the standard output upon exiting the context manager.""" sys.stdout.close() @@ -1167,4 +1167,4 @@ def _format(attribute: dict) -> str: representation.append(f"{'':{justify}}{_format(attribute)}") - return "{})".format(",\n".join(representation)) # noqa: flynt + return "{})".format(",\n".join(representation)) diff --git a/colour/volume/tests/test_macadam_limits.py b/colour/volume/tests/test_macadam_limits.py index eb4fbefcf..924190469 100644 --- a/colour/volume/tests/test_macadam_limits.py +++ b/colour/volume/tests/test_macadam_limits.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.volume.macadam_limits` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -25,7 +27,7 @@ class TestIsWithinMacadamLimits: definition unit tests methods. """ - def test_is_within_macadam_limits(self): + def test_is_within_macadam_limits(self) -> None: """ Test :func:`colour.volume.macadam_limits.is_within_macadam_limits` definition. @@ -39,7 +41,7 @@ def test_is_within_macadam_limits(self): assert not is_within_macadam_limits(np.array([0.0025, 0.0088, 0.0340]), "C") - def test_n_dimensional_is_within_macadam_limits(self): + def test_n_dimensional_is_within_macadam_limits(self) -> None: """ Test :func:`colour.volume.macadam_limits.is_within_macadam_limits` definition n-dimensional arrays support. @@ -57,7 +59,7 @@ def test_n_dimensional_is_within_macadam_limits(self): np.testing.assert_allclose(is_within_macadam_limits(a, "A"), b) @ignore_numpy_errors - def test_nan_is_within_macadam_limits(self): + def test_nan_is_within_macadam_limits(self) -> None: """ Test :func:`colour.volume.macadam_limits.is_within_macadam_limits` definition nan support. diff --git a/colour/volume/tests/test_mesh.py b/colour/volume/tests/test_mesh.py index c28c90055..14e7ad873 100644 --- a/colour/volume/tests/test_mesh.py +++ b/colour/volume/tests/test_mesh.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.volume.mesh` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -26,7 +28,7 @@ class TestIsWithinMeshVolume: tests methods. """ - def setup_method(self): + def setup_method(self) -> None: """Initialise the common tests attributes.""" self._mesh = np.array( @@ -39,7 +41,7 @@ def setup_method(self): ] ) - def test_is_within_mesh_volume(self): + def test_is_within_mesh_volume(self) -> None: """Test :func:`colour.volume.mesh.is_within_mesh_volume` definition.""" assert is_within_mesh_volume(np.array([0.0005, 0.0031, 0.0010]), self._mesh) @@ -50,7 +52,7 @@ def test_is_within_mesh_volume(self): assert not is_within_mesh_volume(np.array([0.4325, 0.3788, 0.1034]), self._mesh) - def test_n_dimensional_is_within_mesh_volume(self): + def test_n_dimensional_is_within_mesh_volume(self) -> None: """ Test :func:`colour.volume.mesh.is_within_mesh_volume` definition n-dimensional arrays support. @@ -76,7 +78,7 @@ def test_n_dimensional_is_within_mesh_volume(self): ) @ignore_numpy_errors - def test_nan_is_within_mesh_volume(self): + def test_nan_is_within_mesh_volume(self) -> None: """ Test :func:`colour.volume.mesh.is_within_mesh_volume` definition nan support. diff --git a/colour/volume/tests/test_pointer_gamut.py b/colour/volume/tests/test_pointer_gamut.py index f9e4be108..d4b495455 100644 --- a/colour/volume/tests/test_pointer_gamut.py +++ b/colour/volume/tests/test_pointer_gamut.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.volume.pointer_gamut` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -25,7 +27,7 @@ class TestIsWithinPointerGamut: definition unit tests methods. """ - def test_is_within_pointer_gamut(self): + def test_is_within_pointer_gamut(self) -> None: """ Test :func:`colour.volume.pointer_gamut.is_within_pointer_gamut` definition. @@ -39,7 +41,7 @@ def test_is_within_pointer_gamut(self): assert not is_within_pointer_gamut(np.array([0.0025, 0.0088, 0.0340])) - def test_n_dimensional_is_within_pointer_gamut(self): + def test_n_dimensional_is_within_pointer_gamut(self) -> None: """ Test :func:`colour.volume.pointer_gamut.is_within_pointer_gamut` definition n-dimensional arrays support. @@ -57,7 +59,7 @@ def test_n_dimensional_is_within_pointer_gamut(self): np.testing.assert_allclose(is_within_pointer_gamut(a), b) @ignore_numpy_errors - def test_nan_is_within_pointer_gamut(self): + def test_nan_is_within_pointer_gamut(self) -> None: """ Test :func:`colour.volume.pointer_gamut.is_within_pointer_gamut` definition nan support. diff --git a/colour/volume/tests/test_rgb.py b/colour/volume/tests/test_rgb.py index 23726aa9f..99ea152af 100644 --- a/colour/volume/tests/test_rgb.py +++ b/colour/volume/tests/test_rgb.py @@ -18,6 +18,8 @@ reproducibility-of-python-pseudo-random-numbers-across-systems-and-versions """ +from __future__ import annotations + import numpy as np from colour.constants import TOLERANCE_ABSOLUTE_TESTS @@ -58,7 +60,7 @@ class TestRGB_colourspaceLimits: tests methods. """ - def test_RGB_colourspace_limits(self): + def test_RGB_colourspace_limits(self) -> None: """Test :func:`colour.volume.rgb.RGB_colourspace_limits` definition.""" np.testing.assert_allclose( @@ -109,7 +111,7 @@ class TestRGB_colourspaceVolumeMonteCarlo: """ @disable_multiprocessing() - def test_RGB_colourspace_volume_MonteCarlo(self): + def test_RGB_colourspace_volume_MonteCarlo(self) -> None: """ Test :func:`colour.volume.rgb.RGB_colourspace_volume_MonteCarlo` definition. @@ -118,7 +120,7 @@ def test_RGB_colourspace_volume_MonteCarlo(self): np.testing.assert_allclose( RGB_colourspace_volume_MonteCarlo( RGB_COLOURSPACE_BT709, - 10e3, + int(10e3), random_state=np.random.RandomState(2), ) * 1e-6, @@ -137,7 +139,7 @@ class TestRGB_colourspace_volume_coverage_MonteCarlo: :cite:`Laurent2012a` """ - def test_RGB_colourspace_volume_coverage_MonteCarlo(self): + def test_RGB_colourspace_volume_coverage_MonteCarlo(self) -> None: """ Test :func:`colour.volume.rgb.\ RGB_colourspace_volume_coverage_MonteCarlo` definition. @@ -147,7 +149,7 @@ def test_RGB_colourspace_volume_coverage_MonteCarlo(self): RGB_colourspace_volume_coverage_MonteCarlo( RGB_COLOURSPACE_BT709, is_within_pointer_gamut, - 10e3, + int(10e3), random_state=np.random.RandomState(2), ), 81.044349070100140, @@ -166,7 +168,7 @@ class TestRGB_colourspacePointerGamutCoverageMonteCarlo: :cite:`Laurent2012a` """ - def test_RGB_colourspace_pointer_gamut_coverage_MonteCarlo(self): + def test_RGB_colourspace_pointer_gamut_coverage_MonteCarlo(self) -> None: """ Test :func:`colour.volume.rgb.\ RGB_colourspace_pointer_gamut_coverage_MonteCarlo` definition. @@ -175,7 +177,7 @@ def test_RGB_colourspace_pointer_gamut_coverage_MonteCarlo(self): np.testing.assert_allclose( RGB_colourspace_pointer_gamut_coverage_MonteCarlo( RGB_COLOURSPACE_BT709, - 10e3, + int(10e3), random_state=np.random.RandomState(2), ), 81.044349070100140, @@ -194,7 +196,7 @@ class TestRGB_colourspaceVisibleSpectrumCoverageMonteCarlo: :cite:`Laurent2012a` """ - def test_RGB_colourspace_visible_spectrum_coverage_MonteCarlo(self): + def test_RGB_colourspace_visible_spectrum_coverage_MonteCarlo(self) -> None: """ Test :func:`colour.volume.rgb.\ RGB_colourspace_visible_spectrum_coverage_MonteCarlo` definition. @@ -203,7 +205,7 @@ def test_RGB_colourspace_visible_spectrum_coverage_MonteCarlo(self): np.testing.assert_allclose( RGB_colourspace_visible_spectrum_coverage_MonteCarlo( RGB_COLOURSPACE_BT709, - 10e3, + int(10e3), random_state=np.random.RandomState(2), ), 46.931407942238266, diff --git a/colour/volume/tests/test_spectrum.py b/colour/volume/tests/test_spectrum.py index ad967148a..8b2aff87e 100644 --- a/colour/volume/tests/test_spectrum.py +++ b/colour/volume/tests/test_spectrum.py @@ -1,5 +1,7 @@ """Define the unit tests for the :mod:`colour.volume.spectrum` module.""" +from __future__ import annotations + from itertools import product import numpy as np @@ -38,7 +40,7 @@ class TestGeneratePulseWaves: definition unit tests methods. """ - def test_generate_pulse_waves(self): + def test_generate_pulse_waves(self) -> None: """ Test :func:`colour.volume.spectrum.generate_pulse_waves` definition. @@ -136,7 +138,7 @@ class TestXYZOuterSurface: definition unit tests methods. """ - def test_XYZ_outer_surface(self): + def test_XYZ_outer_surface(self) -> None: """ Test :func:`colour.volume.spectrum.XYZ_outer_surface` definition. @@ -195,7 +197,7 @@ class TestIsWithinVisibleSpectrum: definition unit tests methods. """ - def test_is_within_visible_spectrum(self): + def test_is_within_visible_spectrum(self) -> None: """ Test :func:`colour.volume.spectrum.is_within_visible_spectrum` definition. @@ -209,7 +211,7 @@ def test_is_within_visible_spectrum(self): assert not is_within_visible_spectrum(np.array([0.0025, 0.0088, 0.0340])) - def test_n_dimensional_is_within_visible_spectrum(self): + def test_n_dimensional_is_within_visible_spectrum(self) -> None: """ Test :func:`colour.volume.spectrum.is_within_visible_spectrum` definition n-dimensional arrays support. @@ -227,7 +229,7 @@ def test_n_dimensional_is_within_visible_spectrum(self): np.testing.assert_allclose(is_within_visible_spectrum(a), b) @ignore_numpy_errors - def test_nan_is_within_visible_spectrum(self): + def test_nan_is_within_visible_spectrum(self) -> None: """ Test :func:`colour.volume.spectrum.is_within_visible_spectrum` definition nan support. diff --git a/docs/colour.hints.rst b/docs/colour.hints.rst index 5771b9b9a..2a3dc3d80 100644 --- a/docs/colour.hints.rst +++ b/docs/colour.hints.rst @@ -21,6 +21,7 @@ Annotation Type Hints List Literal Mapping + NoReturn NewType Protocol Sequence diff --git a/pyproject.toml b/pyproject.toml index a678f5306..7e956d2cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -151,7 +151,7 @@ line-length = 88 select = [ "A", # flake8-builtins "ARG", # flake8-unused-arguments - # "ANN", # flake8-annotations + "ANN", # flake8-annotations "B", # flake8-bugbear # "BLE", # flake8-blind-except "C4", # flake8-comprehensions @@ -192,6 +192,7 @@ select = [ "YTT", # flake8-2020 ] ignore = [ + "ANN401", "B008", "B905", "D104", diff --git a/tasks.py b/tasks.py index 868a83db7..ab41cbbf1 100644 --- a/tasks.py +++ b/tasks.py @@ -68,7 +68,7 @@ @task -def literalise(ctx: Context): +def literalise(ctx: Context) -> None: """ Write various literals in the `colour.hints` module. @@ -91,7 +91,7 @@ def clean( docs: bool = True, bytecode: bool = False, pytest: bool = True, -): +) -> None: """ Clean the project. @@ -131,7 +131,7 @@ def formatting( ctx: Context, asciify: bool = True, bibtex: bool = True, -): +) -> None: """ Convert unicode characters to ASCII and cleanup the *BibTeX* file. @@ -174,7 +174,7 @@ def quality( ctx: Context, pyright: bool = True, rstlint: bool = True, -): +) -> None: """ Check the codebase with *Pyright* and lints various *restructuredText* files with *rst-lint*. @@ -199,7 +199,7 @@ def quality( @task -def precommit(ctx: Context): +def precommit(ctx: Context) -> None: """ Run the "pre-commit" hooks on the codebase. @@ -214,7 +214,7 @@ def precommit(ctx: Context): @task -def tests(ctx: Context): +def tests(ctx: Context) -> None: """ Run the unit tests with *Pytest*. @@ -235,7 +235,7 @@ def tests(ctx: Context): @task -def examples(ctx: Context, plots: bool = False): +def examples(ctx: Context, plots: bool = False) -> None: """ Run the examples. @@ -266,7 +266,7 @@ def examples(ctx: Context, plots: bool = False): @task(formatting, quality, precommit, tests, examples) -def preflight(ctx: Context): # noqa: ARG001 +def preflight(ctx: Context) -> None: # noqa: ARG001 """ Perform the preflight tasks, i.e., *formatting*, *tests*, *quality*, and *examples*. @@ -286,7 +286,7 @@ def docs( plots: bool = True, html: bool = True, pdf: bool = True, -): +) -> None: """ Build the documentation. @@ -318,7 +318,7 @@ def docs( @task -def todo(ctx: Context): +def todo(ctx: Context) -> None: """ Export the TODO items. @@ -335,7 +335,7 @@ def todo(ctx: Context): @task -def requirements(ctx: Context): +def requirements(ctx: Context) -> None: """ Export the *requirements.txt* file. @@ -356,7 +356,7 @@ def requirements(ctx: Context): @task(literalise, clean, preflight, docs, todo, requirements) -def build(ctx: Context): +def build(ctx: Context) -> None: """ Build the project and runs dependency tasks, i.e., *docs*, *todo*, and *preflight*. @@ -399,7 +399,7 @@ def build(ctx: Context): @task -def virtualise(ctx: Context, tests: bool = True): +def virtualise(ctx: Context, tests: bool = True) -> None: """ Create a virtual environment for the project build. @@ -432,7 +432,7 @@ def virtualise(ctx: Context, tests: bool = True): @task -def tag(ctx: Context): +def tag(ctx: Context) -> None: """ Tag the repository according to defined version using *git-flow*. @@ -485,7 +485,7 @@ def tag(ctx: Context): @task(build) -def release(ctx: Context): +def release(ctx: Context) -> None: """ Release the project to *Pypi* with *Twine*. @@ -502,7 +502,7 @@ def release(ctx: Context): @task -def sha256(ctx: Context): +def sha256(ctx: Context) -> None: """ Compute the project *Pypi* package *sha256* with *OpenSSL*. diff --git a/utilities/export_todo.py b/utilities/export_todo.py index 8d18eb915..0f587b659 100755 --- a/utilities/export_todo.py +++ b/utilities/export_todo.py @@ -93,7 +93,7 @@ def extract_todo_items(root_directory: str) -> dict: return todo_items -def export_todo_items(todo_items: dict, file_path: str): +def export_todo_items(todo_items: dict, file_path: str) -> None: """ Export TODO items to given file. diff --git a/utilities/generate_plots.py b/utilities/generate_plots.py index 20467ecc7..feda11eba 100755 --- a/utilities/generate_plots.py +++ b/utilities/generate_plots.py @@ -141,7 +141,7 @@ ] -def generate_documentation_plots(output_directory: str): +def generate_documentation_plots(output_directory: str) -> None: """ Generate documentation plots. diff --git a/utilities/literalise.py b/utilities/literalise.py index c2b44f977..d6ebc9080 100755 --- a/utilities/literalise.py +++ b/utilities/literalise.py @@ -33,7 +33,7 @@ ) -def literalise(path_module_hints: str = PATH_MODULE_HINTS): +def literalise(path_module_hints: str = PATH_MODULE_HINTS) -> None: """ Write various literals in the `colour.hints` module. diff --git a/utilities/mock_for_colour.py b/utilities/mock_for_colour.py index cd744a631..82868a29d 100644 --- a/utilities/mock_for_colour.py +++ b/utilities/mock_for_colour.py @@ -22,7 +22,7 @@ ] -def mock_scipy_for_colour(): +def mock_scipy_for_colour() -> None: """Mock *Scipy* for *Colour*.""" import sys diff --git a/utilities/unicode_to_ascii.py b/utilities/unicode_to_ascii.py index 7bfbf7c76..7dc0be459 100755 --- a/utilities/unicode_to_ascii.py +++ b/utilities/unicode_to_ascii.py @@ -31,7 +31,7 @@ } -def unicode_to_ascii(root_directory: str): +def unicode_to_ascii(root_directory: str) -> None: """ Recursively convert from unicode to ASCII *.py*, *.bib* and *.rst* files in given directory.