1
|
|
|
__author__ = "Jon Reid" |
2
|
|
|
__copyright__ = "Copyright 2011 hamcrest.org" |
3
|
|
|
__license__ = "BSD, see License.txt" |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
class Description(object): |
7
|
|
|
"""A description of a :py:class:`~hamcrest.core.matcher.Matcher`. |
8
|
|
|
|
9
|
|
|
A :py:class:`~hamcrest.core.matcher.Matcher` will describe itself to a |
10
|
|
|
description which can later be used for reporting. |
11
|
|
|
|
12
|
|
|
""" |
13
|
|
|
|
14
|
|
|
def append_text(self, text): |
15
|
|
|
"""Appends some plain text to the description. |
16
|
|
|
|
17
|
|
|
:returns: ``self``, for chaining |
18
|
|
|
|
19
|
|
|
""" |
20
|
|
|
raise NotImplementedError('append_text') |
21
|
|
|
|
22
|
|
|
def append_description_of(self, value): |
23
|
|
|
"""Appends description of given value to this description. |
24
|
|
|
|
25
|
|
|
If the value implements |
26
|
|
|
:py:meth:`~hamcrest.core.selfdescribing.SelfDescribing.describe_to`, |
27
|
|
|
then it will be used. |
28
|
|
|
|
29
|
|
|
:returns: ``self``, for chaining |
30
|
|
|
|
31
|
|
|
""" |
32
|
|
|
raise NotImplementedError('append_description_of') |
33
|
|
|
|
34
|
|
|
def append_value(self, value): |
35
|
|
|
"""Appends an arbitary value to the description. |
36
|
|
|
|
37
|
|
|
**Deprecated:** Call |
38
|
|
|
:py:meth:`~hamcrest.core.description.Description.append_description_of` |
39
|
|
|
instead. |
40
|
|
|
|
41
|
|
|
:returns: ``self``, for chaining |
42
|
|
|
|
43
|
|
|
""" |
44
|
|
|
raise NotImplementedError('append_value') |
45
|
|
|
|
46
|
|
|
def append_list(self, start, separator, end, list): |
47
|
|
|
"""Appends a list of objects to the description. |
48
|
|
|
|
49
|
|
|
:param start: String that will begin the list description. |
50
|
|
|
:param separator: String that will separate each object in the |
51
|
|
|
description. |
52
|
|
|
:param end: String that will end the list description. |
53
|
|
|
:param list: List of objects to be described. |
54
|
|
|
|
55
|
|
|
:returns: ``self``, for chaining |
56
|
|
|
|
57
|
|
|
""" |
58
|
|
|
raise NotImplementedError('append_list') |
59
|
|
|
|