This file is indexed.

/usr/lib/python3/dist-packages/postgresql/test/test_exceptions.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
##
# .test.test_exceptions
##
import unittest
import postgresql.exceptions as pg_exc

class test_exceptions(unittest.TestCase):
	def test_pg_code_lookup(self):
		# in 8.4, pg started using the SQL defined error code for limits
		# Users *will* get whatever code PG sends, but it's important
		# that they have some way to abstract it. many-to-one map ftw.
		self.assertEqual(
			pg_exc.ErrorLookup('22020'), pg_exc.LimitValueError
		)

	def test_error_lookup(self):
		# An error code that doesn't exist yields pg_exc.Error
		self.assertEqual(
			pg_exc.ErrorLookup('00000'), pg_exc.Error
		)

		self.assertEqual(
			pg_exc.ErrorLookup('XX000'), pg_exc.InternalError
		)
		# check class fallback
		self.assertEqual(
			pg_exc.ErrorLookup('XX444'), pg_exc.InternalError
		)

		# SEARV is a very large class, so there are many
		# sub-"codeclass" exceptions used to group the many
		# SEARV errors. Make sure looking up 42000 actually
		# gives the SEARVError
		self.assertEqual(
			pg_exc.ErrorLookup('42000'), pg_exc.SEARVError
		)
		self.assertEqual(
			pg_exc.ErrorLookup('08P01'), pg_exc.ProtocolError
		)

	def test_warning_lookup(self):
		self.assertEqual(
			pg_exc.WarningLookup('01000'), pg_exc.Warning
		)
		self.assertEqual(
			pg_exc.WarningLookup('02000'), pg_exc.NoDataWarning
		)
		self.assertEqual(
			pg_exc.WarningLookup('01P01'), pg_exc.DeprecationWarning
		)
		self.assertEqual(
			pg_exc.WarningLookup('01888'), pg_exc.Warning
		)

if __name__ == '__main__':
	unittest.main()