Coverage for colour/continuous/tests/test_abstract.py: 67%
18 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-16 23:01 +1300
« prev ^ index » next coverage.py v7.11.0, created at 2025-11-16 23:01 +1300
1"""Define the unit tests for the :mod:`colour.continuous.abstract` module."""
3from __future__ import annotations
5from colour.continuous import AbstractContinuousFunction
7__author__ = "Colour Developers"
8__copyright__ = "Copyright 2013 Colour Developers"
9__license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"
10__maintainer__ = "Colour Developers"
11__email__ = "colour-developers@colour-science.org"
12__status__ = "Production"
14__all__ = [
15 "AbstractTestContinuousFunction",
16]
19class AbstractTestContinuousFunction:
20 """
21 Define :class:`colour.continuous.abstract.AbstractContinuousFunction`
22 class unit tests methods.
23 """
25 def test_required_attributes(self) -> None:
26 """Test the presence of required attributes."""
28 required_attributes = (
29 "name",
30 "domain",
31 "range",
32 "interpolator",
33 "interpolator_kwargs",
34 "extrapolator",
35 "extrapolator_kwargs",
36 "function",
37 )
39 for attribute in required_attributes:
40 assert attribute in dir(AbstractContinuousFunction)
42 def test_required_methods(self) -> None:
43 """Test the presence of required methods."""
45 required_methods = (
46 "__init__",
47 "__str__",
48 "__repr__",
49 "__hash__",
50 "__getitem__",
51 "__setitem__",
52 "__contains__",
53 "__iter__",
54 "__len__",
55 "__eq__",
56 "__ne__",
57 "__iadd__",
58 "__add__",
59 "__isub__",
60 "__sub__",
61 "__imul__",
62 "__mul__",
63 "__idiv__",
64 "__div__",
65 "__ipow__",
66 "__pow__",
67 "arithmetical_operation",
68 "fill_nan",
69 "domain_distance",
70 "is_uniform",
71 "copy",
72 )
74 for method in required_methods:
75 assert method in dir(AbstractContinuousFunction)