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

src.hamcrest.core.core.IsAnything   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 12
Duplicated Lines 0 %
Metric Value
dl 0
loc 12
rs 10
wmc 4

3 Methods

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