This file is indexed.

/usr/lib/python3/dist-packages/pyutilib/misc/tests/test_singleton.py is in python3-pyutilib 5.3.5-1.

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
#
# Unit Tests for util/singleton
#
#

import os
from os.path import abspath, dirname
currdir = dirname(abspath(__file__))+os.sep
import pyutilib.th as unittest
import pyutilib.misc


class A(pyutilib.misc.MonoState):

    def __init__(self):
        self.state = True

class B(pyutilib.misc.Singleton):

    def __init__(self):
        self.state = True


class SingletonDebug(unittest.TestCase):

    def test_A(self):
        """Verify that MonoState generates one global state"""
        a1 = A()
        a2 = A()
        self.assertNotEqual(a1,a2)
        self.assertEqual(a1.__dict__,a2.__dict__)

    def test_B(self):
        """Verify that Singleton generates one instance"""
        b1 = B()
        b2 = B()
        self.assertEqual(b1,b2)


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