Skip to content

Commit

Permalink
Use np.testing.assert_allclose in `colour.colour.models.rgb.transfe…
Browse files Browse the repository at this point in the history
…r_functions.tests.test_apple_log_profile` module.
  • Loading branch information
KelSolaar committed Jan 6, 2024
1 parent 0d73093 commit fd6d7ea
Showing 1 changed file with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,22 @@ def test_log_encoding_AppleLogProfile(self):
log_encoding_AppleLogProfile` definition.
"""

self.assertAlmostEqual(
log_encoding_AppleLogProfile(0.0), 0.150476452300913, places=7
np.testing.assert_allclose(
log_encoding_AppleLogProfile(0.0),
0.150476452300913,
atol=TOLERANCE_ABSOLUTE_TESTS,
)

self.assertAlmostEqual(
log_encoding_AppleLogProfile(0.18), 0.488272458526868, places=7
np.testing.assert_allclose(
log_encoding_AppleLogProfile(0.18),
0.488272458526868,
atol=TOLERANCE_ABSOLUTE_TESTS,
)

self.assertAlmostEqual(
log_encoding_AppleLogProfile(1.0), 0.694552983055191, places=7
np.testing.assert_allclose(
log_encoding_AppleLogProfile(1.0),
0.694552983055191,
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_log_encoding_DLog(self):
Expand Down Expand Up @@ -120,16 +126,22 @@ def test_log_decoding_AppleLogProfile(self):
log_decoding_AppleLogProfile` definition.
"""

self.assertAlmostEqual(
log_decoding_AppleLogProfile(0.150476452300913), 0.0, places=7
np.testing.assert_allclose(
log_decoding_AppleLogProfile(0.150476452300913),
0.0,
atol=TOLERANCE_ABSOLUTE_TESTS,
)

self.assertAlmostEqual(
log_decoding_AppleLogProfile(0.488272458526868), 0.18, places=6
np.testing.assert_allclose(
log_decoding_AppleLogProfile(0.488272458526868),
0.18,
atol=TOLERANCE_ABSOLUTE_TESTS,
)

self.assertAlmostEqual(
log_decoding_AppleLogProfile(0.694552983055191), 1.0, places=6
np.testing.assert_allclose(
log_decoding_AppleLogProfile(0.694552983055191),
1.0,
atol=TOLERANCE_ABSOLUTE_TESTS,
)

def test_n_dimensional_log_decoding_DLog(self):
Expand Down

0 comments on commit fd6d7ea

Please sign in to comment.