This file is indexed.

/usr/share/pyshared/zope/container/testing.py is in python-zope.container 3.12.0-0ubuntu2.

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
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Unit test logic for setting up and tearing down basic infrastructure
"""
from zope import component
from zope.component.testing import PlacelessSetup as CAPlacelessSetup
from zope.component.eventtesting import PlacelessSetup as EventPlacelessSetup

from zope.traversing.interfaces import ITraversable, IContainmentRoot
import zope.traversing.testing
import zope.interface

from zope.container.interfaces import IWriteContainer, INameChooser
from zope.container.contained import NameChooser
from zope.container.interfaces import ISimpleReadContainer
from zope.container.traversal import ContainerTraversable
from zope.container.sample import SampleContainer

# XXX we would like to swap the names of the *PlacelessSetup classes
# in here as that would seem to follow the convention better, but
# unfortunately that would break compatibility with zope.app.testing
# (which expects this PlacelessSetup) so it will have to wait.

class PlacelessSetup(object):

    def setUp(self):
        component.provideAdapter(NameChooser, (IWriteContainer,), INameChooser)

class ContainerPlacelessSetup(CAPlacelessSetup,
                              EventPlacelessSetup,
                              PlacelessSetup):

    def setUp(self, doctesttest=None):
        CAPlacelessSetup.setUp(self)
        EventPlacelessSetup.setUp(self)
        PlacelessSetup.setUp(self)

ps = ContainerPlacelessSetup()
setUp = ps.setUp

def tearDown():
    tearDown_ = ps.tearDown
    def tearDown(doctesttest=None):
        tearDown_()
    return tearDown

tearDown = tearDown()

del ps

class ContainerPlacefulSetup(ContainerPlacelessSetup):
    def setUp(self, doctesttest=None):
        ContainerPlacelessSetup.setUp(self, doctesttest)
        zope.traversing.testing.setUp()
        component.provideAdapter(ContainerTraversable,
                                 (ISimpleReadContainer,), ITraversable)

    def tearDown(self, docttesttest=None):
        ContainerPlacelessSetup.tearDown(self)


    def buildFolders(self):
        root = self.rootFolder = SampleContainer()
        zope.interface.directlyProvides(root, IContainmentRoot)
        root[u'folder1'] = SampleContainer()
        root[u'folder1'][u'folder1_1'] = SampleContainer()
        root[u'folder1'][u'folder1_1'][u'folder1_1_1'] = SampleContainer()
        root[u'folder2'] = SampleContainer()
        root[u'folder2'][u'folder2_1'] = SampleContainer()
        root[u'folder2'][u'folder2_1'][u'folder2_1_1'] = SampleContainer()