Пример #1
0
    def test_is_applicable(self):

        with self.assertRaises(TypeError) as context:
            IgnoreResultAction.is_applicable('str', {}, {})

        self.assertEqual(
            IgnoreResultAction.is_applicable(
                Result.from_values('origin', 'msg', "file doesn't exist", 2),
                {},
                {}
            ),
            "The result is associated with source code that doesn't "
            'seem to exist.'
        )

        self.assertEqual(
            IgnoreResultAction.is_applicable(
                Result('', ''),
                {},
                {}
            ),
            'The result is not associated with any source code.'
        )

        with make_temp() as f_a:
            self.assertTrue(IgnoreResultAction.is_applicable(
                Result.from_values('origin', 'msg', f_a, 2), {}, {}))
Пример #2
0
 def test_is_applicable(self):
     self.assertFalse(IgnoreResultAction.is_applicable('str', {}, {}))
     self.assertFalse(IgnoreResultAction.is_applicable(
         Result.from_values('origin', 'msg', "file doesn't exist", 2),
         {}, {}))
     with make_temp() as f_a:
         self.assertTrue(IgnoreResultAction.is_applicable(
             Result.from_values('origin', 'msg', f_a, 2), {}, {}))
Пример #3
0
 def test_is_applicable(self):
     self.assertFalse(IgnoreResultAction.is_applicable('str', {}, {}))
     self.assertFalse(
         IgnoreResultAction.is_applicable(
             Result.from_values('origin', 'msg', "file doesn't exist", 2),
             {}, {}))
     with make_temp() as f_a:
         self.assertTrue(
             IgnoreResultAction.is_applicable(
                 Result.from_values('origin', 'msg', f_a, 2), {}, {}))
Пример #4
0
    def test_is_applicable(self):
        prior_ignore = ('IgnoreResultAction')
        associated_result = Result.from_values('origin', 'msg',
                                               "file doesn't exist", 2)

        with self.assertRaises(TypeError) as context:
            IgnoreResultAction.is_applicable('str', {}, {})
        with self.assertRaises(TypeError) as context:
            IgnoreResultAction.is_applicable('str', {}, {}, prior_ignore)

        self.assertEqual(
            IgnoreResultAction.is_applicable(associated_result, {}, {}),
            "The result is associated with source code that doesn't "
            'seem to exist.')

        self.assertEqual(
            IgnoreResultAction.is_applicable(
                associated_result,
                {},
                {},
                prior_ignore),
            'An ignore comment was already added for this result.')

        self.assertEqual(
            IgnoreResultAction.is_applicable(
                Result('', ''),
                {},
                {},
                prior_ignore),
            'An ignore comment was already added for this result.')

        self.assertEqual(
            IgnoreResultAction.is_applicable(
                Result('', ''),
                {},
                {}
            ),
            'The result is not associated with any source code.'
        )

        with make_temp() as f_a:
            result = Result.from_values('origin', 'msg', f_a, 2)
            self.assertTrue(IgnoreResultAction.is_applicable(result, {}, {}))
            self.assertEqual(
                IgnoreResultAction.is_applicable(
                    result,
                    {},
                    {},
                    prior_ignore),
                'An ignore comment was already added for this result.')
    def test_is_applicable(self):

        with self.assertRaises(TypeError) as context:
            IgnoreResultAction.is_applicable('str', {}, {})

        self.assertEqual(
            IgnoreResultAction.is_applicable(
                Result.from_values('origin', 'msg', "file doesn't exist", 2),
                {}, {}),
            "The result is associated with source code that doesn't "
            'seem to exist.')

        self.assertEqual(
            IgnoreResultAction.is_applicable(Result('', ''), {}, {}),
            'The result is not associated with any source code.')

        with make_temp() as f_a:
            self.assertTrue(
                IgnoreResultAction.is_applicable(
                    Result.from_values('origin', 'msg', f_a, 2), {}, {}))