This file is indexed.

/usr/lib/python2.7/dist-packages/vtk/test/BlackBox.py is in python-vtk6 6.3.0+dfsg1-11build1.

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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
from vtk.util import vtkMethodParser


class Tester:
    def __init__(self, debug=0):
        self.setDebug(debug)
        self.parser = vtkMethodParser.VtkDirMethodParser()
        self.obj = None

    def setDebug(self, val):
        """Sets debug value of the vtkMethodParser.  1 is verbose and
        0 is not.  0 is default."""
        vtkMethodParser.DEBUG = val

    def testParse(self, obj):
        """ Testing if the object is parseable."""
        self.parser.parse_methods(obj)
        self.obj = obj

    def testGetSet(self, obj, excluded_methods=[]):
        """ Testing Get/Set methods."""
        if obj != self.obj:
            self.testParse(obj)
        methods = self.parser.get_set_methods()
        toggle = map(lambda x: x[:-2], self.parser.toggle_methods())
        methods.extend(toggle)
        for method in methods:
            if method in excluded_methods:
                continue
            setm = "Set%s"%method
            getm = "Get%s"%method
            val = eval("obj.%s()"%getm)
            try:
                apply(eval("obj.%s"%setm), val)
            except TypeError:
                apply(eval("obj.%s"%setm), (val,))

            val1 = eval("obj.%s()"%getm)

            if val1 != val:
                name = obj.GetClassName()
                msg = "Failed test for %(name)s.Get/Set%(method)s\n"\
                      "Before Set, value = %(val)s; "\
                      "After Set, value = %(val1)s"%locals()
                raise AssertionError, msg

    def testBoolean(self, obj, excluded_methods=[]):
        """ Testing boolean (On/Off) methods."""
        if obj != self.obj:
            self.testParse(obj)
        methods = self.parser.toggle_methods()
        for method1 in methods:
            method = method1[:-2]

            if method in excluded_methods:
                continue

            getm = "Get%s"%method

            orig_val = eval("obj.%s()"%getm)

            # Turn on
            eval("obj.%sOn()"%method)
            val = eval("obj.%s()"%getm)

            if val != 1:
                name = obj.GetClassName()
                msg = "Failed test for %(name)s.%(method)sOn\n"\
                      "Result not equal to 1 "%locals()
                raise AssertionError, msg

            # Turn on
            eval("obj.%sOff()"%method)
            val = eval("obj.%s()"%getm)

            if val != 0:
                name = obj.GetClassName()
                msg = "Failed test for %(name)s.%(method)sOff\n"\
                      "Result not equal to 0 "%locals()
                raise AssertionError, msg

            # set the value back to the original value.
            eval("obj.Set%s(orig_val)"%method)


    def test(self, obj):
        """Test the given vtk object."""

        # first try parsing the object.
        self.testParse(obj)

        # test the get/set methods
        self.testGetSet(obj)

        # test the boolean methods
        self.testBoolean(obj)