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

IsAnything.__init__()   A

Complexity

Conditions 2

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
1
from hamcrest.core.base_matcher import BaseMatcher
2
3
__author__ = "Jon Reid"
4
__copyright__ = "Copyright 2011 hamcrest.org"
5
__license__ = "BSD, see License.txt"
6
7
8
class IsAnything(BaseMatcher):
9
10
    def __init__(self, description):
11
        self.description = description
12
        if not description:
13
            self.description = 'ANYTHING'
14
15
    def _matches(self, item):
16
        return True
17
18
    def describe_to(self, description):
19
        description.append_text(self.description)
20
21
22
def anything(description=None):
23
    """Matches anything.
24
25
    :param description: Optional string used to describe this matcher.
26
27
    This matcher always evaluates to ``True``. Specify this in composite
28
    matchers when the value of a particular element is unimportant.
29
30
    """
31
    return IsAnything(description)
32