Completed
Pull Request — master (#79)
by
unknown
30s
created

src.hamcrest.core.core.IsNone   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 7
Duplicated Lines 0 %
Metric Value
dl 0
loc 7
rs 10
wmc 2

2 Methods

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