Code Duplication    Length = 19-22 lines in 3 locations

tests/hamcrest_unit_test/core/isinstanceof_test.py 1 location

@@ 21-42 (lines=22) @@
18
__license__ = "BSD, see License.txt"
19
20
21
class IsInstanceOfTest(MatcherTest):
22
23
    def testEvaluatesToTrueIfArgumentIsInstanceOfASpecificClass(self):
24
        self.assert_matches('same class', instance_of(int), 1)
25
26
        self.assert_does_not_match('different class', instance_of(int), 'hi')
27
        self.assert_does_not_match('None', instance_of(int), None)
28
29
    def testMatcherCreationRequiresType(self):
30
        self.assertRaises(TypeError, instance_of, 'not a type')
31
32
    def testHasAReadableDescription(self):
33
        self.assert_description('an instance of int', instance_of(int));
34
35
    def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
36
        self.assert_no_mismatch_description(instance_of(int), 3)
37
38
    def testMismatchDescriptionShowsActualArgument(self):
39
        self.assert_mismatch_description("was 'bad'", instance_of(int), 'bad')
40
41
    def testDescribeMismatch(self):
42
        self.assert_describe_mismatch("was 'bad'", instance_of(int), 'bad')
43
44
45
if sys.version_info < (3,):

tests/hamcrest_unit_test/core/isnone_test.py 2 locations

@@ 37-55 (lines=19) @@
34
        self.assert_describe_mismatch("was 'bad'", none(), 'bad')
35
36
37
class NotNoneTest(MatcherTest):
38
39
    def testEvaluatesToTrueIfArgumentIsNotNone(self):
40
        self.assert_matches('not None', not_none(), object())
41
42
    def testEvaluatesToFalseIfArgumentIsNone(self):
43
        self.assert_does_not_match('None', not_none(), None)
44
45
    def testHasAReadableDescription(self):
46
        self.assert_description('not None', not_none());
47
48
    def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
49
        self.assert_no_mismatch_description(not_none(), 'hi')
50
51
    def testMismatchDescriptionShowsActualArgument(self):
52
        self.assert_mismatch_description("was <None>", not_none(), None)
53
54
    def testDescribeMismatch(self):
55
        self.assert_describe_mismatch("was <None>", not_none(), None)
56
57
58
if __name__ == '__main__':
@@ 16-34 (lines=19) @@
13
__license__ = "BSD, see License.txt"
14
15
16
class IsNoneTest(MatcherTest):
17
18
    def testEvaluatesToTrueIfArgumentIsNone(self):
19
        self.assert_matches('None', none(), None)
20
21
    def testEvaluatesToFalseIfArgumentIsNotNone(self):
22
        self.assert_does_not_match('not None', none(), object())
23
24
    def testHasAReadableDescription(self):
25
        self.assert_description('None', none());
26
27
    def testSuccessfulMatchDoesNotGenerateMismatchDescription(self):
28
        self.assert_no_mismatch_description(none(), None)
29
30
    def testMismatchDescriptionShowsActualArgument(self):
31
        self.assert_mismatch_description("was 'bad'", none(), 'bad')
32
33
    def testDescribeMismatch(self):
34
        self.assert_describe_mismatch("was 'bad'", none(), 'bad')
35
36
37
class NotNoneTest(MatcherTest):