testHasAReadableDescription()   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
if __name__ == '__main__':
2
    import sys
3
    sys.path.insert(0, '..')
4
    sys.path.insert(0, '../..')
5
6
from hamcrest.core.core.isnot import *
7
8
from hamcrest.core.core.isequal import equal_to
9
from hamcrest_unit_test.matcher_test import MatcherTest
10
import unittest
11
12
__author__ = "Jon Reid"
13
__copyright__ = "Copyright 2011 hamcrest.org"
14
__license__ = "BSD, see License.txt"
15
16
17
class IsNotTest(MatcherTest):
18
19
    def testEvaluatesToTheTheLogicalNegationOfAnotherMatcher(self):
20
        self.assert_matches('invert mismatch', is_not(equal_to('A')), 'B')
21
        self.assert_does_not_match('invert match', is_not(equal_to('A')), 'A')
22
23
    def testProvidesConvenientShortcutForNotEqualTo(self):
24
        self.assert_matches('invert mismatch', is_not('A'), 'B');
25
        self.assert_does_not_match('invert match', is_not('A'), 'A');
26
27
    def testProvidesConvenientShortcutForNotInstanceOf(self):
28
        self.assert_matches('invert mismatch', is_not(str), 1);
29
        self.assert_does_not_match('invert match', is_not(str), 'A');
30
31
    def testHasAReadableDescription(self):
32
        self.assert_description("not 'A'", is_not('A'));
33
34
    def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
35
        self.assert_no_mismatch_description(is_not('A'), 'B')
36
37
    def testMismatchDescriptionShowsActualArgument(self):
38
        self.assert_mismatch_description("was 'A'", is_not('A'), 'A')
39
40
    def testDescribeMismatch(self):
41
        self.assert_describe_mismatch("was 'A'", is_not('A'), 'A')
42
43
44
if __name__ == '__main__':
45
    unittest.main()
46