src.hamcrest.core.core.IsNone.describe_to()   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 __future__ import absolute_import
2
__author__ = "Jon Reid"
3
__copyright__ = "Copyright 2011 hamcrest.org"
4
__license__ = "BSD, see License.txt"
5
6
from hamcrest.core.base_matcher import BaseMatcher
7
from .isnot import is_not
8
9
10
class IsNone(BaseMatcher):
11
12
    def _matches(self, item):
13
        return item is None
14
15
    def describe_to(self, description):
16
        description.append_text('None')
17
18
19
def none():
20
    """Matches if object is ``None``."""
21
    return IsNone()
22
23
24
def not_none():
25
    """Matches if object is not ``None``."""
26
    return is_not(none())
27