This file is indexed.

/usr/lib/python3/dist-packages/postgresql/test/test_installation.py is in python3-postgresql 1.1.0-1build1.

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
##
# .test.test_installation
##
import sys
import os
import unittest
from .. import installation as ins

class test_installation(unittest.TestCase):
	"""
	Most of this is exercised by TestCaseWithCluster, but do some
	explicit checks up front to help find any specific issues that
	do not naturally occur.
	"""
	def test_parse_configure_options(self):
		# Check expectations.
		self.assertEqual(
			list(ins.parse_configure_options("")), [],
		)
		self.assertEqual(
			list(ins.parse_configure_options("  ")), [],
		)
		self.assertEqual(
			list(ins.parse_configure_options("--foo --bar")),
			[('foo',True),('bar',True)]
		)
		self.assertEqual(
			list(ins.parse_configure_options("'--foo' '--bar'")),
			[('foo',True),('bar',True)]
		)
		self.assertEqual(
			list(ins.parse_configure_options("'--foo=A properly isolated string' '--bar'")),
			[('foo','A properly isolated string'),('bar',True)]
		)
		# hope they don't ever use backslash escapes.
		# This is pretty dirty, but it doesn't seem well defined anyways.
		self.assertEqual(
			list(ins.parse_configure_options("'--foo=A ''properly'' isolated string' '--bar'")),
			[('foo',"A 'properly' isolated string"),('bar',True)]
		)
		# handle some simple variations, but it's 
		self.assertEqual(
			list(ins.parse_configure_options("'--foo' \"--bar\"")),
			[('foo',True),('bar',True)]
		)
		# Show the failure.
		try:
			self.assertEqual(
				list(ins.parse_configure_options("'--foo' \"--bar=/A dir/file\"")),
				[('foo',True),('bar','/A dir/file')]
			)
		except AssertionError:
			pass
		else:
			self.fail("did not detect induced failure")

	def test_minimum(self):
		'version info'
		# Installation only "needs" the version information
		i = ins.Installation({'version' : 'PostgreSQL 2.2.3'})
		self.assertEqual(
			i.version, 'PostgreSQL 2.2.3'
		)
		self.assertEqual(
			i.version_info, (2,2,3,'final',0)
		)
		self.assertEqual(i.postgres, None)
		self.assertEqual(i.postmaster, None)

	def test_exec(self):
		# check the executable
		i = ins.pg_config_dictionary(
			sys.executable, '-m', __package__ + '.support', 'pg_config')
		# automatically lowers the key
		self.assertEqual(i['foo'], 'BaR')
		self.assertEqual(i['feh'], 'YEAH')
		self.assertEqual(i['version'], 'NAY')

if __name__ == '__main__':
	from types import ModuleType
	this = ModuleType("this")
	this.__dict__.update(globals())
	unittest.main(this)