This file is indexed.

/usr/lib/python2.7/dist-packages/pymc/tests/test_utils.py is in python-pymc 2.2+ds-1.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
42
43
44
45
46
47
48
49
50
from pymc import *
from numpy import *
from numpy.testing import *
import nose
import sys
from pymc import utils

from pymc import six
xrange = six.moves.xrange

class test_logp_of_set(TestCase):
    A = Normal('A',0,1)
    B = Gamma('B',1,1)
    C = Lambda('C',lambda b=B: sqrt(b))
    D = Gamma('D',C,1)
    @stochastic
    def E(x=1,value=3):
        if value != 3:
            raise RuntimeError
        else:
            return 0.
    E.value = 2

    def test_logp(self):
        self.B.rand()
        lp1 = utils.logp_of_set(set([self.A,self.B,self.D]))
        assert_almost_equal(lp1, self.A.logp+self.B.logp+self.D.logp, 10)

    def test_ZeroProb(self):
        self.B.value = -1
        for i in xrange(1000):
            try:
                utils.logp_of_set(set([self.A,self.B,self.D, self.E]))
            except:
                cls,  inst, tb = sys.exc_info()
                assert(cls is ZeroProbability)

    def test_other_err(self):
        self.B.rand()
        for i in xrange(1000):
            try:
                utils.logp_of_set(set([self.A,self.B,self.D,self.E]))
            except:
                cls,  inst, tb = sys.exc_info()
                assert(cls is RuntimeError)


if __name__ == '__main__':
    C =nose.config.Config(verbosity=1)
    nose.runmodule(config=C)