Completed
Pull Request — master (#71)
by
unknown
01:30
created

tests.hamcrest_unit_test.core.IsNotTest   A

Complexity

Total Complexity 7

Size/Duplication

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A IsNotTest.testProvidesConvenientShortcutForNotInstanceOf() 3 3 1
A IsNotTest.testHasAReadableDescription() 2 2 1
A IsNotTest.testEvaluatesToTheTheLogicalNegationOfAnotherMatcher() 3 3 1
A IsNotTest.testMismatchDescriptionShowsActualArgument() 2 2 1
A IsNotTest.testSuccessfulMatchDoesNotGenerateMismatchDescription() 2 2 1
A IsNotTest.testDescribeMismatch() 2 2 1
A IsNotTest.testProvidesConvenientShortcutForNotEqualTo() 3 3 1
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 View Code Duplication
class IsNotTest(MatcherTest):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
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