This file is indexed.

/usr/lib/python3/dist-packages/pydap/tests/test_D1.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
"""
This is a simple example from the DODS Test Server.

    http://test.opendap.org:8080/dods/dts/D1

"""
import unittest

import numpy as np
from webob.request import Request

from pydap.handlers.lib import BaseHandler
from pydap.client import open_url
from pydap.tests.datasets import D1


class TestD1(unittest.TestCase):
    def setUp(self):
        # create WSGI app
        self.app = BaseHandler(D1)

    def test_dds(self):
        self.assertEqual(Request.blank('/.dds').get_response(self.app).text,
            '''Dataset {
    Sequence {
        String instrument_id;
        String location;
        Float64 latitude;
        Float64 longitude;
    } Drifters;
} EOSDB%2EDBO;
''')

    def test_ascii(self):
        resp = Request.blank('/.asc').get_response(self.app)
        content = resp.text
        self.assertEqual(content,
            '''Dataset {
    Sequence {
        String instrument_id;
        String location;
        Float64 latitude;
        Float64 longitude;
    } Drifters;
} EOSDB%2EDBO;
---------------------------------------------
Drifters.instrument_id, Drifters.location, Drifters.latitude, Drifters.longitude
"This is a data test string (pass 1).", "This is a data test string (pass 0).", 1000, 999.95
"This is a data test string (pass 3).", "This is a data test string (pass 2).", 999.95, 999.55
"This is a data test string (pass 5).", "This is a data test string (pass 4).", 999.8, 998.75
"This is a data test string (pass 7).", "This is a data test string (pass 6).", 999.55, 997.55
"This is a data test string (pass 9).", "This is a data test string (pass 8).", 999.2, 995.95

''')

    def test_data(self):
        dataset = open_url('http://localhost:8001/', application=self.app)
        data = list(dataset.Drifters.iterdata())
        self.assertEqual(data, D1.Drifters.data.tolist())

    def test_filtering(self):
        dataset = open_url('http://localhost:8001/', application=self.app)
        drifters = dataset.Drifters
        selection = np.rec.fromrecords(
            list(drifters[drifters.longitude < 999].iterdata()), names=list(drifters.keys()))

        data = np.rec.fromrecords(
                D1.Drifters.data.tolist(), names=list(drifters.keys()))
        filtered = data[data['longitude'] < 999]

        np.testing.assert_array_equal(filtered, selection)

    def test_filtering_child(self):
        dataset = open_url('http://localhost:8001/', application=self.app)
        drifters = dataset.Drifters
        selection = np.array(
            list(drifters[drifters.longitude < 999]['location']))

        data = np.rec.fromrecords(
                D1.Drifters.data.tolist(), names=list(drifters.keys()))
        filtered = data[data['longitude'] < 999]['location']

        np.testing.assert_array_equal(filtered, selection)