This file is indexed.

/usr/lib/python3/dist-packages/pydap/tests/test_responses_lib.py is in python3-pydap 3.2.2+ds1-1ubuntu1.

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
"""Test the base functions for handlers."""

from webob import Request
from pydap.model import DatasetType
import pydap.responses
from pydap.responses.lib import BaseResponse, load_responses
from pydap.tests.datasets import VerySimpleSequence
import unittest


class TestLoadResponse(unittest.TestCase):

    """Test that responses are loaded correctly."""

    def setUp(self):
        """Load all available responses.

        At least the DDS, DAS, DODS, HTML, ASC and version responses should be
        loaded, since they are included in Pydap. Other third-party responses
        may also be present.

        """
        self.responses = load_responses()

    def test_responses_das(self):
        """Test that the DAS response is loaded."""
        self.assertIs(
            self.responses["das"], pydap.responses.das.DASResponse)

    def test_responses_dds(self):
        """Test that the DDS response is loaded."""
        self.assertIs(
            self.responses["dds"], pydap.responses.dds.DDSResponse)

    def test_responses_dods(self):
        """Test that the DODS response is loaded."""
        self.assertIs(
            self.responses["dods"], pydap.responses.dods.DODSResponse)

    def test_responses_html(self):
        """Test that the HTML response is loaded."""
        self.assertIs(
            self.responses["html"], pydap.responses.html.HTMLResponse)

    def test_responses_ascii(self):
        """Test that the ASCII response is loaded."""
        self.assertIs(
            self.responses["ascii"], pydap.responses.ascii.ASCIIResponse)
        self.assertIs(
            self.responses["asc"], pydap.responses.ascii.ASCIIResponse)

    def test_responses_ver(self):
        """Test that the version response is loaded."""
        self.assertIs(
            self.responses["ver"], pydap.responses.version.VersionResponse)


class TestBaseResponse(unittest.TestCase):

    """Test the response super class."""

    def setUp(self):
        """Instantiate a response."""
        self.response = BaseResponse(VerySimpleSequence)

    def test_call(self):
        """Test calling the WSGI app."""
        req = Request.blank('/')
        res = req.get_response(self.response)
        self.assertEqual(res.status, "200 OK")

        # note that the iterable returned by our WSGI app is the object itself:
        self.assertIs(res.app_iter, self.response)

    def test_serialization(self):
        """Test the serialization code."""
        req = Request.blank('/')
        res = req.get_response(self.response)

        # get a dataset when we pass ``DatsetType``
        self.assertIs(
            res.app_iter.x_wsgiorg_parsed_response(DatasetType),
            VerySimpleSequence)

        # when we pass something the method should return None
        self.assertIsNone(res.app_iter.x_wsgiorg_parsed_response("dataset"))

    def test_iter(self):
        """Test that calling the base class directly raises an exception."""
        with self.assertRaises(NotImplementedError):
            iter(self.response)