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

src.hamcrest.core.SelfDescribingValue   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %
Metric Value
dl 0
loc 18
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A SelfDescribingValue.describe_to() 0 3 1
A SelfDescribingValue.__init__() 0 4 1
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