src.hamcrest.core.core.IsAnything._matches()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 2
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