This file is indexed.

/usr/lib/python2.7/dist-packages/transaction/tests/test_savepoint.py is in python-transaction 1.4.3-3.

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
##############################################################################
#
# Copyright (c) 2004 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.
#
##############################################################################
import unittest


class SavepointTests(unittest.TestCase):

    def testRollbackRollsbackDataManagersThatJoinedLater(self):
        # A savepoint needs to not just rollback it's savepoints, but needs
        # to # rollback savepoints for data managers that joined savepoints
        # after the savepoint:
        import transaction
        from transaction.tests import savepointsample
        dm = savepointsample.SampleSavepointDataManager()
        dm['name'] = 'bob'
        sp1 = transaction.savepoint()
        dm['job'] = 'geek'
        sp2 = transaction.savepoint()
        dm['salary'] = 'fun'
        dm2 = savepointsample.SampleSavepointDataManager()
        dm2['name'] = 'sally'

        self.assertTrue('name' in dm)
        self.assertTrue('job' in dm)
        self.assertTrue('salary' in dm)
        self.assertTrue('name' in dm2)

        sp1.rollback()

        self.assertTrue('name' in dm)
        self.assertFalse('job' in dm)
        self.assertFalse('salary' in dm)
        self.assertFalse('name' in dm2)

    def test_commit_after_rollback_for_dm_that_joins_after_savepoint(self):
        # There was a problem handling data managers that joined after a
        # savepoint.  If the savepoint was rolled back and then changes
        # made, the dm would end up being joined twice, leading to extra
        # tpc calls and pain.
        import transaction
        from transaction.tests import savepointsample
        sp = transaction.savepoint()
        dm = savepointsample.SampleSavepointDataManager()
        dm['name'] = 'bob'
        sp.rollback()
        dm['name'] = 'Bob'
        transaction.commit()
        self.assertEqual(dm['name'], 'Bob')



def test_suite():
    return unittest.TestSuite((
            unittest.makeSuite(SavepointTests),
        ))