This file is indexed.

/usr/share/pyshared/simpleparse/tests/mx_low.py is in python-simpleparse 2.1.0a1-6build1.

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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
"""Low-level matching tests for mx.TextTools"""
import unittest, pprint
from simpleparse.stt.TextTools import *

import string
from simpleparse.stt import TextTools
mxVersion = tuple(string.split( TextTools.__version__, '.')[:3])
from genericvalues import AnyInt, NullResult


class MXLowTests(unittest.TestCase):
	def doBasicTest(self, table, testvalue, expected, startPosition=0 ):
		result = tag( testvalue, table , startPosition)
		assert result == expected, '''\n\texpected:%s\n\tgot:%s\n'''%( expected, result )
	def testAllIn1( self ):
		"""Test simple AllIn command"""
		self.doBasicTest(
			(
				( "ab", AllIn, "ab", 0 ),
			),
			"abbaab",
			( 1,[("ab",0,6,None)],6),
		)
	def testAllIn2( self ):
		"""Test simple AllIn command ignore fail"""
		self.doBasicTest(
			(
				( "ab", AllIn, "ab", 1,1 ),
			),
			"c",
			( 1,[],0),
		)
	def testAllIn3( self ):
		"""Test simple AllIn command w 2 items"""
		self.doBasicTest(
			(
				( "ab", AllIn, "ab", 1,1 ),
				( "c", AllIn, "cde", 0 ),
			),
			"abbaabccdd",
			( 1,[
				("ab",0,6,None),
				("c",6,10,None),
				
			],10),
		)
	def testAllIn4( self ):
		"""Test simple AllIn command fail on second

		This should truncate the results list back to [], as well
		as returning 0 as length.  This is broken under
		mx.TextTools 2.1.0b1!
		"""
		self.doBasicTest(
			(
				( "ab", AllIn, "ab", 1,1 ),
				( "c", AllIn, "cde", 0 ),
			),
			"abbaab",
			( 0,[
			],AnyInt),
		)
	def testAllIn5( self ):
		"""Test simple AllIn command with None tagobj"""
		self.doBasicTest(
			(
				( None, AllIn, "ab", 0 ),
			),
			"abbaab",
			( 1,[],6),
		)
	def testAllNotIn1( self ):
		"""Test simple AllNotIn command"""
		self.doBasicTest(
			(
				( "ab", AllNotIn, "ab", 0 ),
			),
			"ccddee",
			( 1,[("ab",0,6,None)],6),
		)
	def testAllNotIn2( self ):
		"""Test simple AllNotIn command ignore fail"""
		self.doBasicTest(
			(
				( "ab", AllNotIn, "ab", 1,1 ),
			),
			"a",
			( 1,[],0),
		)
	def testAllNotIn3( self ):
		"""Test simple AllNotIn command w 2 items"""
		self.doBasicTest(
			(
				( "ab", AllNotIn, "ab", 1,1 ),
				( "c", AllNotIn, "cde", 0 ),
			),
			"ccddabbaab",
			( 1,[
				("ab",0,4,None),
				("c",4,10,None),
				
			],10),
		)
		

	def testIs1( self ):
		"""Test simple Is command"""
		self.doBasicTest(
			(
				( "ab", Is, "a", 0 ),
			),
			"abbaab",
			( 1,[("ab",0,1,None)],1),
		)
	def testIs2( self ):
		"""Test simple Is command ignore fail"""
		self.doBasicTest(
			(
				( "ab", Is, "a", 1,1),
			),
			"c",
			( 1,[],0),
		)
	
	def testIsIn1( self ):
		"""Test simple IsIn command"""
		self.doBasicTest(
			(
				( "ab", IsIn, "ab", 0 ),
			),
			"abbaab",
			( 1,[("ab",0,1,None)],1),
		)
	def testIsIn2( self ):
		"""Test simple IsIn command ignore fail"""
		self.doBasicTest(
			(
				( "ab", IsIn, "ab", 1,1),
			),
			"c",
			( 1,[],0),
		)

	def testIsNotIn1( self ):
		"""Test simple IsNotIn command"""
		self.doBasicTest(
			(
				( "ab", IsNotIn, "ab", 0 ),
			),
			"ccddee",
			( 1,[("ab",0,1,None)],1),
		)
	def testIsNotIn2( self ):
		"""Test simple IsNotIn command ignore fail"""
		self.doBasicTest(
			(
				( "ab", IsNotIn, "ab", 1,1),
			),
			"abb",
			( 1,[],0),
		)


	def testWord1( self ):
		"""Test simple Word command"""
		self.doBasicTest(
			(
				( "ab", Word, "ab", 0 ),
			),
			"ab",
			( 1,[("ab",0,2,None)],2),
		)
	def testWord2( self ):
		"""Test simple Word command ignore fail"""
		self.doBasicTest(
			(
				( "ab", Word, "ab", 1,1),
			),
			"cd",
			( 1,[],0),
		)
	def testWordStart1( self ):
		"""Test simple WordStart command"""
		self.doBasicTest(
			(
				( "ab", WordStart, "ab", 0 ),
			),
			"ddeeffab",
			( 1,[("ab",0,6,None)],6),
		)
	def testWordStart2( self ):
		"""Test simple WordStart command ignore fail"""
		self.doBasicTest(
			(
				( "ab", WordStart, "ab", 1,1),
			),
			"cdffgg",
			( 1,[],0),
		)
		
	def testWordEnd1( self ):
		"""Test simple WordEnd command"""
		self.doBasicTest(
			(
				( "ab", WordEnd, "ab", 0 ),
			),
			"ddeeffab",
			( 1,[("ab",0,8,None)],8),
		)
	def testWordEnd2( self ):
		"""Test simple WordEnd command ignore fail"""
		self.doBasicTest(
			(
				( "ab", WordEnd, "ab", 1,1),
			),
			"cdffgg",
			( 1,[],0),
		)

	def testAllInSet1( self ):
		"""Test simple AllInSet command"""
		self.doBasicTest(
			(
				( "ab", AllInSet, set("ab"), 0 ),
			),
			"abbaab",
			( 1,[("ab",0,6,None)],6),
		)
	def testAllInSet2( self ):
		"""Test simple AllInSet command ignore fail"""
		self.doBasicTest(
			(
				( "ab", AllInSet, set("ab"), 1,1 ),
			),
			"c",
			( 1,[],0),
		)

	def testIsInSet1( self ):
		"""Test simple IsInSet command"""
		self.doBasicTest(
			(
				( "ab", IsInSet, set("ab"), 0 ),
			),
			"abbaab",
			( 1,[("ab",0,1,None)],1),
		)
	def testIsInSet2( self ):
		"""Test simple IsInSet command ignore fail"""
		self.doBasicTest(
			(
				( "ab", IsInSet, set("ab"), 1,1),
			),
			"c",
			( 1,[],0),
		)
	if mxVersion >= ('2','1'):
		def testIsInCharSet1( self ):
			"""Test simple IsInCharSet command"""
			self.doBasicTest(
				(
					( "ab", IsInCharSet, CharSet("ab"), 0 ),
				),
				"abbaab",
				( 1,[("ab",0,1,None)],1),
			)
		def testIsInCharSet2( self ):
			"""Test simple IsInCharSet command ignore fail"""
			self.doBasicTest(
				(
					( "ab", IsInCharSet, CharSet("ab"), 1,1),
				),
				"c",
				( 1,[],0),
			)

		def testAllInCharSet1( self ):
			"""Test simple AllInSet command w/ CharSet object"""
			self.doBasicTest(
				(
					( "ab", AllInCharSet, CharSet("ab"), 0 ),
				),
				"abbaab",
				( 1,[("ab",0,6,None)],6),
			)
		def testAllInCharSet2( self ):
			"""Test simple AllInSet command ignore fail"""
			self.doBasicTest(
				(
					( "ab", AllInCharSet, CharSet("ab"), 1,1),
				),
				"ccd",
				( 1,[],0),
			)
	

		
def getSuite():
	return unittest.makeSuite(MXLowTests,'test')

if __name__ == "__main__":
	unittest.main(defaultTest="getSuite")