Completed
Pull Request — master (#75)
by Cézar
01:32
created

SelfDescribingValue.__init__()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 4
rs 10
1
from hamcrest.core.selfdescribing import SelfDescribing
2
3
import warnings
4
5
__author__ = "Jon Reid"
6
__copyright__ = "Copyright 2011 hamcrest.org"
7
__license__ = "BSD, see License.txt"
8
9
10
class SelfDescribingValue(SelfDescribing):
11
    """Wrap any value in a ``SelfDescribingValue`` to satisfy the
12
    :py:class:`~hamcrest.core.selfdescribing.SelfDescribing` interface.
13
14
    **Deprecated:** No need for this class now that
15
    :py:meth:`~hamcrest.core.description.Description.append_description_of`
16
    handles any type of value.
17
18
    """
19
20
    def __init__(self, value):
21
        warnings.warn('SelfDescribingValue no longer needed',
22
                      DeprecationWarning)
23
        self.value = value
24
25
    def describe_to(self, description):
26
        """Generates a description of the value."""
27
        description.append_value(self.value)
28