This file is indexed.

/usr/lib/python3/dist-packages/pydap/tests/test_responses_ascii.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
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
"""Test ASCII response."""

import sys

from webtest import TestApp as App
from webob.headers import ResponseHeaders

from pydap.lib import __version__
from pydap.handlers.lib import BaseHandler
from pydap.tests.datasets import SimpleSequence, SimpleGrid
from pydap.responses.ascii import ascii

import unittest


class TestASCIIResponseSequence(unittest.TestCase):

    """Test ASCII response from a sequence."""

    def setUp(self):
        """Create a simple WSGI app for testing."""
        app = App(BaseHandler(SimpleSequence))
        self.res = app.get('/.asc')

    def test_dispatcher(self):
        """Test the single dispatcher."""
        with self.assertRaises(StopIteration):
            ascii(None)

    def test_status(self):
        """Test the status code."""
        self.assertEqual(self.res.status, "200 OK")

    def test_content_type(self):
        """Test the content type."""
        self.assertEqual(self.res.content_type, "text/plain")

    def test_charset(self):
        """Test the charset."""
        self.assertEqual(self.res.charset, "ascii")

    def test_headers(self):
        """Test headers from the response."""
        print(self.res.text)
        self.assertEqual(
            self.res.headers,
            ResponseHeaders([
                ('XDODS-Server', 'pydap/' + __version__),
                ('Content-description', 'dods_ascii'),
                ('Content-type', 'text/plain; charset=ascii'),
                ('Content-Length', '440')]))

    def test_body(self):
        """Test the generated ASCII response."""
        self.assertEqual(self.res.text, """Dataset {
    Sequence {
        String id;
        Int32 lon;
        Int32 lat;
        Int32 depth;
        Int32 time;
        Int32 temperature;
        Int32 salinity;
        Int32 pressure;
    } cast;
} SimpleSequence;
---------------------------------------------
cast.id, cast.lon, cast.lat, cast.depth, cast.time, cast.temperature, cast.salinity, cast.pressure
"1", 100, -10, 0, -1, 21, 35, 0
"2", 200, 10, 500, 1, 15, 35, 100

""")


class TestASCIIResponseGrid(unittest.TestCase):

    """Test ASCII response from a grid."""

    def test_body(self):
        """Test the generated ASCII response."""
        app = App(BaseHandler(SimpleGrid))
        res = app.get('/.asc')
        self.assertEqual(res.text, """Dataset {
    Grid {
        Array:
            Int32 SimpleGrid[y = 2][x = 3];
        Maps:
            Int32 x[x = 3];
            Int32 y[y = 2];
    } SimpleGrid;
    Int32 x[x = 3];
    Int32 y[y = 2];
} SimpleGrid;
---------------------------------------------
SimpleGrid.SimpleGrid
[0][0] 0
[0][1] 1
[0][2] 2
[1][0] 3
[1][1] 4
[1][2] 5

SimpleGrid.x
[0] 0
[1] 1
[2] 2

SimpleGrid.y
[0] 0
[1] 1


x
[0] 0
[1] 1
[2] 2

y
[0] 0
[1] 1

""")