This file is indexed.

/usr/lib/python2.7/dist-packages/dicom/test/warncheck.py is in python-dicom 0.9.9-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# warncheck.py
#
import warnings
import unittest
from dicom.test.version_dep import capture_warnings


def assertWarns(self, warn_msg, function, *func_args, **func_kwargs):
    """
    Check that the function generates the expected warning
    with the arguments given.

    warn_msg -- part of the warning string, any warnings should contain this
    function -- the function to call (expected to issue a warning)
    func_args -- positional arguments to the function
    func_kwargs -- keyword arguments to the function

    Return the function return value.
    """
    result, all_warnings = capture_warnings(function, *func_args,
                                            **func_kwargs)

    msg = "Expected one warning; got {0:d}"
    self.assertTrue(len(all_warnings) == 1, msg.format(len(all_warnings)))
    msg = "Expected warning message '{0:s}...'; got '{1:s}'"
    self.assertTrue(warn_msg in all_warnings[0],
                    msg.format(warn_msg, all_warnings[0]))
    return result


def test_warning(the_warning):
    if the_warning:
        warnings.warn(the_warning)


class WarnTests(unittest.TestCase):
    def testWarn(self):
        """Test that assertWarns works as expected"""
        assertWarns(self, "Look", test_warning, "Look out")


if __name__ == "__main__":
    unittest.main()