Skip to content

Commit

Permalink
Drop unittest usage in favour of pytest.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed May 20, 2024
1 parent 9622b90 commit 2f6f20f
Show file tree
Hide file tree
Showing 18 changed files with 224 additions and 348 deletions.
12 changes: 3 additions & 9 deletions colour_hdri/calibration/tests/test_absolute_luminance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# !/usr/bin/env python
"""
Define the unit tests for the
:mod:`colour_hdri.calibration.absolute_luminance` module.
Expand All @@ -7,7 +6,6 @@
from __future__ import annotations

import os
import unittest

import numpy as np
from colour import read_image
Expand Down Expand Up @@ -42,7 +40,7 @@
)


class TestUpperHemisphereIlluminanceLagarde2016(unittest.TestCase):
class TestUpperHemisphereIlluminanceLagarde2016:
"""
Define :func:`colour_hdri.calibration.absolute_luminance.\
upper_hemisphere_illuminance_Lagarde2016` definition unit tests methods.
Expand Down Expand Up @@ -73,7 +71,7 @@ def test_upper_hemisphere_illuminance_Lagarde2016(self):
)


class TestUpperHemisphereIlluminanceWeightsLagarde2016(unittest.TestCase):
class TestUpperHemisphereIlluminanceWeightsLagarde2016:
"""
Define :func:`colour_hdri.calibration.absolute_luminance.\
upper_hemisphere_illuminance_weights_Lagarde2016` definition unit tests
Expand Down Expand Up @@ -130,7 +128,7 @@ def test_upper_hemisphere_illuminance_weights_Lagarde2016(self):
)


class TestAbsoluteLuminanceCalibrationLagarde2016(unittest.TestCase):
class TestAbsoluteLuminanceCalibrationLagarde2016:
"""
Define :func:`colour_hdri.calibration.absolute_luminance.\
absolute_luminance_calibration_Lagarde2016` definition unit tests methods.
Expand Down Expand Up @@ -171,7 +169,3 @@ def test_absolute_luminance_calibration_Lagarde2016(self):
rtol=0.0000001,
atol=0.0000001,
)


if __name__ == "__main__":
unittest.main()
10 changes: 2 additions & 8 deletions colour_hdri/calibration/tests/test_debevec1997.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# !/usr/bin/env python
"""
Define the unit tests for the :mod:`colour_hdri.calibration.debevec1997`
module.
Expand All @@ -7,7 +6,6 @@
from __future__ import annotations

import os
import unittest

import numpy as np
from colour.hints import List
Expand Down Expand Up @@ -45,7 +43,7 @@
IMAGES_JPG: List[str] = filter_files(ROOT_RESOURCES_FROBISHER_001, ("jpg",))


class TestGSolve(unittest.TestCase):
class TestGSolve:
"""
Define :func:`colour_hdri.calibration.debevec1997.g_solve` definition
unit tests methods.
Expand Down Expand Up @@ -87,7 +85,7 @@ def test_g_solve(self):
)


class TestCameraResponseFunctionsDebevec1997(unittest.TestCase):
class TestCameraResponseFunctionsDebevec1997:
"""
Define :func:`colour_hdri.calibration.debevec1997.\
camera_response_functions_Debevec1997` definition unit tests methods.
Expand All @@ -110,7 +108,3 @@ def test_camera_response_function_Debevec1997(self):
),
atol=0.00001,
)


if __name__ == "__main__":
unittest.main()
30 changes: 12 additions & 18 deletions colour_hdri/distortion/tests/test_vignette.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# !/usr/bin/env python
"""
Define the unit tests for the :mod:`colour_hdri.distortion.vignette` module.
"""

from __future__ import annotations

import os
import unittest

import numpy as np
from colour.constants import TOLERANCE_ABSOLUTE_TESTS
Expand Down Expand Up @@ -55,7 +53,7 @@
)


class TestApplyRadialGradient(unittest.TestCase):
class TestApplyRadialGradient:
"""
Define :func:`colour_hdri.distortion.vignette.apply_radial_gradient`
definition unit tests methods.
Expand Down Expand Up @@ -122,7 +120,7 @@ def test_apply_radial_gradient(self):
)


class TestParabolic2DFunction(unittest.TestCase):
class TestParabolic2DFunction:
"""
Define :func:`colour_hdri.distortion.vignette.parabolic_2D_function`
definition unit tests methods.
Expand Down Expand Up @@ -194,7 +192,7 @@ def test_parabolic_2D_function(self):
)


class TestHyperbolicCosine2DFunction(unittest.TestCase):
class TestHyperbolicCosine2DFunction:
"""
Define :func:`colour_hdri.distortion.vignette.hyperbolic_cosine_2D_function`
definition unit tests methods.
Expand Down Expand Up @@ -266,7 +264,7 @@ def test_hyperbolic_cosine_2D_function(self):
)


class TestVignettePrincipalPoint(unittest.TestCase):
class TestVignettePrincipalPoint:
"""
Define :func:`colour_hdri.distortion.vignette.vignette_principal_point`
definition unit tests methods.
Expand All @@ -285,7 +283,7 @@ def test_vignette_principal_point(self):
)


class TestCharacteriseVignette2DFunction(unittest.TestCase):
class TestCharacteriseVignette2DFunction:
"""
Define :func:`colour_hdri.distortion.vignette.\
characterise_vignette_2D_function` definition unit tests methods.
Expand Down Expand Up @@ -378,7 +376,7 @@ def test_characterise_vignette_2D_function(self):
)


class TestCorrectVignette2DFunction(unittest.TestCase):
class TestCorrectVignette2DFunction:
"""
Define :func:`colour_hdri.distortion.vignette.correct_vignette_2D_function`
definition unit tests methods.
Expand Down Expand Up @@ -508,7 +506,7 @@ def test_correct_vignette_2D_function(self):
)


class TestCharacteriseVignetteBivariateSpline(unittest.TestCase):
class TestCharacteriseVignetteBivariateSpline:
"""
Define :func:`colour_hdri.distortion.vignette.\
characterise_vignette_bivariate_spline` definition unit tests methods.
Expand Down Expand Up @@ -541,7 +539,7 @@ def test_characterise_vignette_bivariate_spline(self):
)


class TestCorrectVignetteBivariateSpline(unittest.TestCase):
class TestCorrectVignetteBivariateSpline:
"""
Define :func:`colour_hdri.distortion.vignette.\
correct_vignette_bivariate_spline` definition unit tests methods.
Expand Down Expand Up @@ -611,7 +609,7 @@ def test_correct_vignette_bivariate_spline(self):
)


class TestRadialSamplingFunction(unittest.TestCase):
class TestRadialSamplingFunction:
"""
Define :func:`colour_hdri.distortion.vignette.radial_sampling_function`
definition unit tests methods.
Expand Down Expand Up @@ -822,7 +820,7 @@ def test_radial_sampling_function(self):
)


class TestVignetteSamplingCoordinates(unittest.TestCase):
class TestVignetteSamplingCoordinates:
"""
Define :func:`colour_hdri.distortion.vignette.vignette_sampling_coordinates`
definition unit tests methods.
Expand Down Expand Up @@ -1009,7 +1007,7 @@ def test_vignette_sampling_coordinates(self):
)


class TestCharacteriseVignetteRBF(unittest.TestCase):
class TestCharacteriseVignetteRBF:
"""
Define :func:`colour_hdri.distortion.vignette.characterise_vignette_RBF`
definition unit tests methods.
Expand Down Expand Up @@ -1211,7 +1209,7 @@ def test_characterise_vignette_RBF(self):
)


class TestCorrectVignetteRBF(unittest.TestCase):
class TestCorrectVignetteRBF:
"""
Define :func:`colour_hdri.distortion.vignette.correct_vignette_RBF`
definition unit tests methods.
Expand Down Expand Up @@ -1279,7 +1277,3 @@ def test_correct_vignette_RBF(self):
),
atol=TOLERANCE_ABSOLUTE_TESTS,
)


if __name__ == "__main__":
unittest.main()
16 changes: 5 additions & 11 deletions colour_hdri/exposure/tests/test_common.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# !/usr/bin/env python
"""Define the unit tests for the :mod:`colour_hdri.exposure.common` module."""

import unittest

import numpy as np
from colour.constants import TOLERANCE_ABSOLUTE_TESTS
Expand Down Expand Up @@ -29,7 +27,7 @@
]


class TestAverageLuminance(unittest.TestCase):
class TestAverageLuminance:
"""
Define :func:`colour_hdri.exposure.common.average_luminance` definition
unit tests methods.
Expand All @@ -49,7 +47,7 @@ def test_average_luminance(self):
)


class TestAverageIlluminance(unittest.TestCase):
class TestAverageIlluminance:
"""
Define :func:`colour_hdri.exposure.common.average_illuminance` definition
unit tests methods.
Expand All @@ -72,7 +70,7 @@ def test_average_illuminance(self):
)


class TestLuminanceToExposureValue(unittest.TestCase):
class TestLuminanceToExposureValue:
"""
Define :func:`colour_hdri.exposure.common.luminance_to_exposure_value`
definition unit tests methods.
Expand All @@ -95,7 +93,7 @@ def test_luminance_to_exposure_value(self):
)


class TestIlluminanceToExposureValue(unittest.TestCase):
class TestIlluminanceToExposureValue:
"""
Define :func:`colour_hdri.exposure.common.illuminance_to_exposure_value`
definition unit tests methods.
Expand All @@ -118,7 +116,7 @@ def test_illuminance_to_exposure_value(self):
)


class TestAdjustExposure(unittest.TestCase):
class TestAdjustExposure:
"""
Define :func:`colour_hdri.exposure.common.adjust_exposure` definition
unit tests methods.
Expand All @@ -132,7 +130,3 @@ def test_adjust_exposure(self):
np.array([0.5, 1.0, 1.5, 2.0]),
atol=TOLERANCE_ABSOLUTE_TESTS,
)


if __name__ == "__main__":
unittest.main()
20 changes: 7 additions & 13 deletions colour_hdri/exposure/tests/test_dsc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# !/usr/bin/env python
"""Define the unit tests for the :mod:`colour_hdri.exposure.dsc` module."""

import unittest

import numpy as np
from colour.constants import TOLERANCE_ABSOLUTE_TESTS
Expand Down Expand Up @@ -34,7 +32,7 @@
]


class TestQFactor(unittest.TestCase):
class TestQFactor:
"""
Define :func:`colour_hdri.exposure.dsc.q_factor` definition
unit tests methods.
Expand All @@ -54,7 +52,7 @@ def test_q_factor(self):
)


class TestFocalPlaneExposure(unittest.TestCase):
class TestFocalPlaneExposure:
"""
Define :func:`colour_hdri.exposure.dsc.focal_plane_exposure` definition
unit tests methods.
Expand All @@ -80,7 +78,7 @@ def test_focal_plane_exposure(self):
)


class TestArithmeticMeanFocalPlaneExposure(unittest.TestCase):
class TestArithmeticMeanFocalPlaneExposure:
"""
Define :func:`colour_hdri.exposure.dsc.\
arithmetic_mean_focal_plane_exposure` definition unit tests methods.
Expand All @@ -103,7 +101,7 @@ def test_arithmetic_mean_focal_plane_exposure(self):
)


class TestSaturationBasedSpeedFocalPlaneExposure(unittest.TestCase):
class TestSaturationBasedSpeedFocalPlaneExposure:
"""
Define :func:`colour_hdri.exposure.dsc.\
saturation_based_speed_focal_plane_exposure` definition unit tests methods.
Expand Down Expand Up @@ -133,7 +131,7 @@ def test_saturation_based_speed_focal_plane_exposure(self):
)


class TestExposureIndexValues(unittest.TestCase):
class TestExposureIndexValues:
"""
Define :func:`colour_hdri.exposure.dsc.exposure_index_values` definition
unit tests methods.
Expand All @@ -152,7 +150,7 @@ def test_exposure_index_values(self):
)


class TestExposureValue100(unittest.TestCase):
class TestExposureValue100:
"""
Define :func:`colour_hdri.exposure.dsc.exposure_value_100` definition
unit tests methods.
Expand All @@ -175,7 +173,7 @@ def test_exposure_value_100(self):
)


class TestPhotometricExposureScaleFactorLagarde2014(unittest.TestCase):
class TestPhotometricExposureScaleFactorLagarde2014:
"""
Define :func:`colour_hdri.exposure.dsc.\
photometric_exposure_scale_factor_Lagarde2014` definition unit tests
Expand All @@ -198,7 +196,3 @@ def test_photometric_exposure_scale_factor_Lagarde2014(self):
np.array([0.00005221, 0.00037884, 0.00135554]),
atol=TOLERANCE_ABSOLUTE_TESTS,
)


if __name__ == "__main__":
unittest.main()
8 changes: 1 addition & 7 deletions colour_hdri/generation/tests/test_hdri.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# !/usr/bin/env python
"""Define the unit tests for the :mod:`colour_hdri.generation.radiance` module."""

from __future__ import annotations

import os
import unittest

import numpy as np
from colour import RGB_COLOURSPACES
Expand Down Expand Up @@ -38,7 +36,7 @@
IMAGES_JPG: List[str] = filter_files(ROOT_RESOURCES_FROBISHER_001, ("jpg",))


class TestImageStackToHDRI(unittest.TestCase):
class TestImageStackToHDRI:
"""
Define :func:`colour_hdri.generation.radiance.image_stack_to_HDRI`
definition unit tests methods.
Expand Down Expand Up @@ -84,7 +82,3 @@ def test_image_stack_to_HDRI(self):
rtol=0.0001,
atol=0.0001,
)


if __name__ == "__main__":
unittest.main()
Loading

0 comments on commit 2f6f20f

Please sign in to comment.