10 from urlparse import urlsplit |
10 from urlparse import urlsplit |
11 from rql import parse |
11 from rql import parse |
12 |
12 |
13 from cubicweb.rset import NotAnEntity, ResultSet, attr_desc_iterator |
13 from cubicweb.rset import NotAnEntity, ResultSet, attr_desc_iterator |
14 |
14 |
15 |
15 |
16 def pprelcachedict(d): |
16 def pprelcachedict(d): |
17 res = {} |
17 res = {} |
18 for k, (rset, related) in d.items(): |
18 for k, (rset, related) in d.items(): |
19 res[k] = sorted(v.eid for v in related) |
19 res[k] = sorted(v.eid for v in related) |
20 return sorted(res.items()) |
20 return sorted(res.items()) |
21 |
21 |
22 |
22 |
23 class AttrDescIteratorTC(TestCase): |
23 class AttrDescIteratorTC(TestCase): |
24 """TestCase for cubicweb.rset.attr_desc_iterator""" |
24 """TestCase for cubicweb.rset.attr_desc_iterator""" |
25 |
25 |
26 def test_relations_description(self): |
26 def test_relations_description(self): |
27 """tests relations_description() function""" |
27 """tests relations_description() function""" |
28 queries = { |
28 queries = { |
29 'Any U,L,M where U is CWUser, U login L, U mail M' : [(1, 'login', 'subject'), (2, 'mail', 'subject')], |
29 'Any U,L,M where U is CWUser, U login L, U mail M' : [(1, 'login', 'subject'), (2, 'mail', 'subject')], |
30 'Any U,L,M where U is CWUser, L is Foo, U mail M' : [(2, 'mail', 'subject')], |
30 'Any U,L,M where U is CWUser, L is Foo, U mail M' : [(2, 'mail', 'subject')], |
33 'Any C where C is Company, C employs P' : [], |
33 'Any C where C is Company, C employs P' : [], |
34 } |
34 } |
35 for rql, relations in queries.items(): |
35 for rql, relations in queries.items(): |
36 result = list(attr_desc_iterator(parse(rql).children[0])) |
36 result = list(attr_desc_iterator(parse(rql).children[0])) |
37 self.assertEquals((rql, result), (rql, relations)) |
37 self.assertEquals((rql, result), (rql, relations)) |
38 |
38 |
39 def test_relations_description_indexed(self): |
39 def test_relations_description_indexed(self): |
40 """tests relations_description() function""" |
40 """tests relations_description() function""" |
41 queries = { |
41 queries = { |
42 'Any C,U,P,L,M where C is Company, C employs P, U is CWUser, U login L, U mail M' : |
42 'Any C,U,P,L,M where C is Company, C employs P, U is CWUser, U login L, U mail M' : |
43 {0: [(2,'employs', 'subject')], 1: [(3,'login', 'subject'), (4,'mail', 'subject')]}, |
43 {0: [(2,'employs', 'subject')], 1: [(3,'login', 'subject'), (4,'mail', 'subject')]}, |
47 result = list(attr_desc_iterator(parse(rql).children[0], var_index)) |
47 result = list(attr_desc_iterator(parse(rql).children[0], var_index)) |
48 self.assertEquals(result, relations) |
48 self.assertEquals(result, relations) |
49 |
49 |
50 |
50 |
51 |
51 |
52 class ResultSetTC(EnvBasedTC): |
52 class ResultSetTC(EnvBasedTC): |
53 |
53 |
54 def setUp(self): |
54 def setUp(self): |
55 super(ResultSetTC, self).setUp() |
55 super(ResultSetTC, self).setUp() |
56 self.rset = ResultSet([[12, 'adim'], [13, 'syt']], |
56 self.rset = ResultSet([[12, 'adim'], [13, 'syt']], |
57 'Any U,L where U is CWUser, U login L', |
57 'Any U,L where U is CWUser, U login L', |
65 if info1[3] != info2[3]: |
65 if info1[3] != info2[3]: |
66 params1 = dict(pair.split('=') for pair in info1[3].split('&')) |
66 params1 = dict(pair.split('=') for pair in info1[3].split('&')) |
67 params2 = dict(pair.split('=') for pair in info1[3].split('&')) |
67 params2 = dict(pair.split('=') for pair in info1[3].split('&')) |
68 self.assertDictEquals(params1, params2) |
68 self.assertDictEquals(params1, params2) |
69 |
69 |
70 |
70 |
71 def test_build_url(self): |
71 def test_build_url(self): |
72 req = self.request() |
72 req = self.request() |
73 baseurl = req.base_url() |
73 baseurl = req.base_url() |
74 self.compare_urls(req.build_url('view', vid='foo', rql='yo'), |
74 self.compare_urls(req.build_url('view', vid='foo', rql='yo'), |
75 '%sview?vid=foo&rql=yo' % baseurl) |
75 '%sview?vid=foo&rql=yo' % baseurl) |
77 '%stask/title/go' % baseurl) |
77 '%stask/title/go' % baseurl) |
78 #self.compare_urls(req.build_url('view', _restpath='/task/title/go'), |
78 #self.compare_urls(req.build_url('view', _restpath='/task/title/go'), |
79 # '%stask/title/go' % baseurl) |
79 # '%stask/title/go' % baseurl) |
80 # empty _restpath should not crash |
80 # empty _restpath should not crash |
81 self.compare_urls(req.build_url('view', _restpath=''), baseurl) |
81 self.compare_urls(req.build_url('view', _restpath=''), baseurl) |
82 |
82 |
83 |
83 |
84 def test_resultset_build(self): |
84 def test_resultset_build(self): |
85 """test basic build of a ResultSet""" |
85 """test basic build of a ResultSet""" |
86 rs = ResultSet([1,2,3], 'CWGroup X', description=['CWGroup', 'CWGroup', 'CWGroup']) |
86 rs = ResultSet([1,2,3], 'CWGroup X', description=['CWGroup', 'CWGroup', 'CWGroup']) |
87 self.assertEquals(rs.rowcount, 3) |
87 self.assertEquals(rs.rowcount, 3) |
88 self.assertEquals(rs.rows, [1,2,3]) |
88 self.assertEquals(rs.rows, [1,2,3]) |
100 rs2 = rs.limit(2, offset=1) |
100 rs2 = rs.limit(2, offset=1) |
101 self.assertEquals(rs2.rows, [[13000, 'syt'], [14000, 'nico']]) |
101 self.assertEquals(rs2.rows, [[13000, 'syt'], [14000, 'nico']]) |
102 self.assertEquals(rs2.get_entity(0, 0).row, 0) |
102 self.assertEquals(rs2.get_entity(0, 0).row, 0) |
103 self.assertEquals(rs.limit(2, offset=2).rows, [[14000, 'nico']]) |
103 self.assertEquals(rs.limit(2, offset=2).rows, [[14000, 'nico']]) |
104 self.assertEquals(rs.limit(2, offset=3).rows, []) |
104 self.assertEquals(rs.limit(2, offset=3).rows, []) |
105 |
105 |
106 |
106 |
107 def test_resultset_filter(self): |
107 def test_resultset_filter(self): |
108 rs = ResultSet([[12000, 'adim'], [13000, 'syt'], [14000, 'nico']], |
108 rs = ResultSet([[12000, 'adim'], [13000, 'syt'], [14000, 'nico']], |
109 'Any U,L where U is CWUser, U login L', |
109 'Any U,L where U is CWUser, U login L', |
110 description=[['CWUser', 'String']] * 3) |
110 description=[['CWUser', 'String']] * 3) |
111 rs.req = self.request() |
111 rs.req = self.request() |
112 rs.vreg = self.env.vreg |
112 rs.vreg = self.env.vreg |
113 def test_filter(entity): |
113 def test_filter(entity): |
114 return entity.login != 'nico' |
114 return entity.login != 'nico' |
115 |
115 |
116 rs2 = rs.filtered_rset(test_filter) |
116 rs2 = rs.filtered_rset(test_filter) |
117 self.assertEquals(len(rs2), 2) |
117 self.assertEquals(len(rs2), 2) |
118 self.assertEquals([login for _, login in rs2], ['adim', 'syt']) |
118 self.assertEquals([login for _, login in rs2], ['adim', 'syt']) |
119 |
119 |
120 def test_resultset_transform(self): |
120 def test_resultset_transform(self): |
121 rs = ResultSet([[12, 'adim'], [13, 'syt'], [14, 'nico']], |
121 rs = ResultSet([[12, 'adim'], [13, 'syt'], [14, 'nico']], |
122 'Any U,L where U is CWUser, U login L', |
122 'Any U,L where U is CWUser, U login L', |
123 description=[['CWUser', 'String']] * 3) |
123 description=[['CWUser', 'String']] * 3) |
124 rs.req = self.request() |
124 rs.req = self.request() |
126 return row[1:], desc[1:] |
126 return row[1:], desc[1:] |
127 rs2 = rs.transformed_rset(test_transform) |
127 rs2 = rs.transformed_rset(test_transform) |
128 |
128 |
129 self.assertEquals(len(rs2), 3) |
129 self.assertEquals(len(rs2), 3) |
130 self.assertEquals(list(rs2), [['adim'],['syt'],['nico']]) |
130 self.assertEquals(list(rs2), [['adim'],['syt'],['nico']]) |
131 |
131 |
132 def test_resultset_sort(self): |
132 def test_resultset_sort(self): |
133 rs = ResultSet([[12000, 'adim'], [13000, 'syt'], [14000, 'nico']], |
133 rs = ResultSet([[12000, 'adim'], [13000, 'syt'], [14000, 'nico']], |
134 'Any U,L where U is CWUser, U login L', |
134 'Any U,L where U is CWUser, U login L', |
135 description=[['CWUser', 'String']] * 3) |
135 description=[['CWUser', 'String']] * 3) |
136 rs.req = self.request() |
136 rs.req = self.request() |
137 rs.vreg = self.env.vreg |
137 rs.vreg = self.env.vreg |
138 |
138 |
139 rs2 = rs.sorted_rset(lambda e:e['login']) |
139 rs2 = rs.sorted_rset(lambda e:e['login']) |
140 self.assertEquals(len(rs2), 3) |
140 self.assertEquals(len(rs2), 3) |
141 self.assertEquals([login for _, login in rs2], ['adim', 'nico', 'syt']) |
141 self.assertEquals([login for _, login in rs2], ['adim', 'nico', 'syt']) |
142 # make sure rs is unchanged |
142 # make sure rs is unchanged |
143 self.assertEquals([login for _, login in rs], ['adim', 'syt', 'nico']) |
143 self.assertEquals([login for _, login in rs], ['adim', 'syt', 'nico']) |
144 |
144 |
145 rs2 = rs.sorted_rset(lambda e:e['login'], reverse=True) |
145 rs2 = rs.sorted_rset(lambda e:e['login'], reverse=True) |
146 self.assertEquals(len(rs2), 3) |
146 self.assertEquals(len(rs2), 3) |
147 self.assertEquals([login for _, login in rs2], ['syt', 'nico', 'adim']) |
147 self.assertEquals([login for _, login in rs2], ['syt', 'nico', 'adim']) |
148 # make sure rs is unchanged |
148 # make sure rs is unchanged |
149 self.assertEquals([login for _, login in rs], ['adim', 'syt', 'nico']) |
149 self.assertEquals([login for _, login in rs], ['adim', 'syt', 'nico']) |
163 'Any U, L, T WHERE U is CWUser, U login L,'\ |
163 'Any U, L, T WHERE U is CWUser, U login L,'\ |
164 'D created_by U, D title T', |
164 'D created_by U, D title T', |
165 description=[['CWUser', 'String', 'String']] * 5) |
165 description=[['CWUser', 'String', 'String']] * 5) |
166 rs.req = self.request() |
166 rs.req = self.request() |
167 rs.vreg = self.env.vreg |
167 rs.vreg = self.env.vreg |
168 |
168 |
169 rsets = rs.split_rset(lambda e:e['login']) |
169 rsets = rs.split_rset(lambda e:e['login']) |
170 self.assertEquals(len(rsets), 3) |
170 self.assertEquals(len(rsets), 3) |
171 self.assertEquals([login for _, login,_ in rsets[0]], ['adim', 'adim']) |
171 self.assertEquals([login for _, login,_ in rsets[0]], ['adim', 'adim']) |
172 self.assertEquals([login for _, login,_ in rsets[1]], ['syt']) |
172 self.assertEquals([login for _, login,_ in rsets[1]], ['syt']) |
173 self.assertEquals([login for _, login,_ in rsets[2]], ['nico', 'nico']) |
173 self.assertEquals([login for _, login,_ in rsets[2]], ['nico', 'nico']) |
174 # make sure rs is unchanged |
174 # make sure rs is unchanged |
175 self.assertEquals([login for _, login,_ in rs], ['adim', 'adim', 'syt', 'nico', 'nico']) |
175 self.assertEquals([login for _, login,_ in rs], ['adim', 'adim', 'syt', 'nico', 'nico']) |
176 |
176 |
177 rsets = rs.split_rset(lambda e:e['login'], return_dict=True) |
177 rsets = rs.split_rset(lambda e:e['login'], return_dict=True) |
178 self.assertEquals(len(rsets), 3) |
178 self.assertEquals(len(rsets), 3) |
179 self.assertEquals([login for _, login,_ in rsets['nico']], ['nico', 'nico']) |
179 self.assertEquals([login for _, login,_ in rsets['nico']], ['nico', 'nico']) |
180 self.assertEquals([login for _, login,_ in rsets['adim']], ['adim', 'adim']) |
180 self.assertEquals([login for _, login,_ in rsets['adim']], ['adim', 'adim']) |
181 self.assertEquals([login for _, login,_ in rsets['syt']], ['syt']) |
181 self.assertEquals([login for _, login,_ in rsets['syt']], ['syt']) |
196 [u'Adim chez les pinguins', |
196 [u'Adim chez les pinguins', |
197 u'Jardiner facile', |
197 u'Jardiner facile', |
198 u'Le carrelage en 42 leçons', |
198 u'Le carrelage en 42 leçons', |
199 u'La tarte tatin en 15 minutes', |
199 u'La tarte tatin en 15 minutes', |
200 u"L'épluchage du castor commun"]) |
200 u"L'épluchage du castor commun"]) |
201 |
201 |
202 def test_cached_syntax_tree(self): |
202 def test_cached_syntax_tree(self): |
203 """make sure syntax tree is cached""" |
203 """make sure syntax tree is cached""" |
204 rqlst1 = self.rset.syntax_tree() |
204 rqlst1 = self.rset.syntax_tree() |
205 rqlst2 = self.rset.syntax_tree() |
205 rqlst2 = self.rset.syntax_tree() |
206 self.assert_(rqlst1 is rqlst2) |
206 self.assert_(rqlst1 is rqlst2) |
214 self.assertRaises(KeyError, e.__getitem__, 'creation_date') |
214 self.assertRaises(KeyError, e.__getitem__, 'creation_date') |
215 self.assertEquals(pprelcachedict(e._related_cache), []) |
215 self.assertEquals(pprelcachedict(e._related_cache), []) |
216 e.complete() |
216 e.complete() |
217 self.assertEquals(e['firstname'], 'adrien') |
217 self.assertEquals(e['firstname'], 'adrien') |
218 self.assertEquals(pprelcachedict(e._related_cache), []) |
218 self.assertEquals(pprelcachedict(e._related_cache), []) |
219 |
219 |
220 def test_get_entity_advanced(self): |
220 def test_get_entity_advanced(self): |
221 self.add_entity('Bookmark', title=u'zou', path=u'/view') |
221 self.add_entity('Bookmark', title=u'zou', path=u'/view') |
222 self.execute('SET X bookmarked_by Y WHERE X is Bookmark, Y login "anon"') |
222 self.execute('SET X bookmarked_by Y WHERE X is Bookmark, Y login "anon"') |
223 rset = self.execute('Any X,Y,XT,YN WHERE X bookmarked_by Y, X title XT, Y login YN') |
223 rset = self.execute('Any X,Y,XT,YN WHERE X bookmarked_by Y, X title XT, Y login YN') |
224 |
224 |
225 e = rset.get_entity(0, 0) |
225 e = rset.get_entity(0, 0) |
226 self.assertEquals(e.row, 0) |
226 self.assertEquals(e.row, 0) |
227 self.assertEquals(e.col, 0) |
227 self.assertEquals(e.col, 0) |
228 self.assertEquals(e['title'], 'zou') |
228 self.assertEquals(e['title'], 'zou') |
229 self.assertRaises(KeyError, e.__getitem__, 'path') |
229 self.assertRaises(KeyError, e.__getitem__, 'path') |
230 with traced_selection(): |
230 self.assertEquals(e.view('text'), 'zou') |
231 self.assertEquals(e.view('text'), 'zou') |
|
232 self.assertEquals(pprelcachedict(e._related_cache), []) |
231 self.assertEquals(pprelcachedict(e._related_cache), []) |
233 |
232 |
234 e = rset.get_entity(0, 1) |
233 e = rset.get_entity(0, 1) |
235 self.assertEquals(e.row, 0) |
234 self.assertEquals(e.row, 0) |
236 self.assertEquals(e.col, 1) |
235 self.assertEquals(e.col, 1) |
237 self.assertEquals(e['login'], 'anon') |
236 self.assertEquals(e['login'], 'anon') |
238 self.assertRaises(KeyError, e.__getitem__, 'firstname') |
237 self.assertRaises(KeyError, e.__getitem__, 'firstname') |
241 e.complete() |
240 e.complete() |
242 self.assertEquals(e['firstname'], None) |
241 self.assertEquals(e['firstname'], None) |
243 self.assertEquals(e.view('text'), 'anon') |
242 self.assertEquals(e.view('text'), 'anon') |
244 self.assertEquals(pprelcachedict(e._related_cache), |
243 self.assertEquals(pprelcachedict(e._related_cache), |
245 []) |
244 []) |
246 |
245 |
247 self.assertRaises(NotAnEntity, rset.get_entity, 0, 2) |
246 self.assertRaises(NotAnEntity, rset.get_entity, 0, 2) |
248 self.assertRaises(NotAnEntity, rset.get_entity, 0, 3) |
247 self.assertRaises(NotAnEntity, rset.get_entity, 0, 3) |
249 |
248 |
250 def test_get_entity_relation_cache_compt(self): |
249 def test_get_entity_relation_cache_compt(self): |
251 rset = self.execute('Any X,S WHERE X in_state S, X login "anon"') |
250 rset = self.execute('Any X,S WHERE X in_state S, X login "anon"') |
272 # second level of recursion |
271 # second level of recursion |
273 s = u.in_state[0] |
272 s = u.in_state[0] |
274 self.assertEquals(s['name'], 'activated') |
273 self.assertEquals(s['name'], 'activated') |
275 self.assertRaises(KeyError, s.__getitem__, 'description') |
274 self.assertRaises(KeyError, s.__getitem__, 'description') |
276 |
275 |
277 |
276 |
278 def test_get_entity_cache_with_left_outer_join(self): |
277 def test_get_entity_cache_with_left_outer_join(self): |
279 eid = self.execute('INSERT CWUser E: E login "joe", E upassword "joe", E in_group G ' |
278 eid = self.execute('INSERT CWUser E: E login "joe", E upassword "joe", E in_group G ' |
280 'WHERE G name "users"')[0][0] |
279 'WHERE G name "users"')[0][0] |
281 rset = self.execute('Any X,E WHERE X eid %(x)s, X primary_email E?', {'x': eid}) |
280 rset = self.execute('Any X,E WHERE X eid %(x)s, X primary_email E?', {'x': eid}) |
282 e = rset.get_entity(0, 0) |
281 e = rset.get_entity(0, 0) |
285 self.assertEquals(e.related_cache('primary_email', 'subject', True), []) |
284 self.assertEquals(e.related_cache('primary_email', 'subject', True), []) |
286 # related rset should be an empty rset |
285 # related rset should be an empty rset |
287 cached = e.related_cache('primary_email', 'subject', False) |
286 cached = e.related_cache('primary_email', 'subject', False) |
288 self.assertIsInstance(cached, ResultSet) |
287 self.assertIsInstance(cached, ResultSet) |
289 self.assertEquals(cached.rowcount, 0) |
288 self.assertEquals(cached.rowcount, 0) |
290 |
289 |
291 |
290 |
292 def test_get_entity_union(self): |
291 def test_get_entity_union(self): |
293 e = self.add_entity('Bookmark', title=u'manger', path=u'path') |
292 e = self.add_entity('Bookmark', title=u'manger', path=u'path') |
294 rset = self.execute('Any X,N ORDERBY N WITH X,N BEING ' |
293 rset = self.execute('Any X,N ORDERBY N WITH X,N BEING ' |
295 '((Any X,N WHERE X is Bookmark, X title N)' |
294 '((Any X,N WHERE X is Bookmark, X title N)' |
301 for entity in rset.entities(): # test get_entity for each row actually |
300 for entity in rset.entities(): # test get_entity for each row actually |
302 etype, n = expected[entity.row] |
301 etype, n = expected[entity.row] |
303 self.assertEquals(entity.id, etype) |
302 self.assertEquals(entity.id, etype) |
304 attr = etype == 'Bookmark' and 'title' or 'name' |
303 attr = etype == 'Bookmark' and 'title' or 'name' |
305 self.assertEquals(entity[attr], n) |
304 self.assertEquals(entity[attr], n) |
306 |
305 |
307 def test_related_entity_optional(self): |
306 def test_related_entity_optional(self): |
308 e = self.add_entity('Bookmark', title=u'aaaa', path=u'path') |
307 e = self.add_entity('Bookmark', title=u'aaaa', path=u'path') |
309 rset = self.execute('Any B,U,L WHERE B bookmarked_by U?, U login L') |
308 rset = self.execute('Any B,U,L WHERE B bookmarked_by U?, U login L') |
310 entity, rtype = rset.related_entity(0, 2) |
309 entity, rtype = rset.related_entity(0, 2) |
311 self.assertEquals(entity, None) |
310 self.assertEquals(entity, None) |
312 self.assertEquals(rtype, None) |
311 self.assertEquals(rtype, None) |
313 |
312 |
314 def test_related_entity_union_subquery(self): |
313 def test_related_entity_union_subquery(self): |
315 e = self.add_entity('Bookmark', title=u'aaaa', path=u'path') |
314 e = self.add_entity('Bookmark', title=u'aaaa', path=u'path') |
316 rset = self.execute('Any X,N ORDERBY N WITH X,N BEING ' |
315 rset = self.execute('Any X,N ORDERBY N WITH X,N BEING ' |
317 '((Any X,N WHERE X is CWGroup, X name N)' |
316 '((Any X,N WHERE X is CWGroup, X name N)' |
318 ' UNION ' |
317 ' UNION ' |
328 ' UNION ' |
327 ' UNION ' |
329 ' (Any X,N WHERE X is Bookmark, X title N))') |
328 ' (Any X,N WHERE X is Bookmark, X title N))') |
330 entity, rtype = rset.related_entity(0, 1) |
329 entity, rtype = rset.related_entity(0, 1) |
331 self.assertEquals(entity.eid, e.eid) |
330 self.assertEquals(entity.eid, e.eid) |
332 self.assertEquals(rtype, 'title') |
331 self.assertEquals(rtype, 'title') |
333 |
332 |
334 def test_entities(self): |
333 def test_entities(self): |
335 rset = self.execute('Any U,G WHERE U in_group G') |
334 rset = self.execute('Any U,G WHERE U in_group G') |
336 # make sure we have at least one element |
335 # make sure we have at least one element |
337 self.failUnless(rset) |
336 self.failUnless(rset) |
338 self.assertEquals(set(e.e_schema.type for e in rset.entities(0)), |
337 self.assertEquals(set(e.e_schema.type for e in rset.entities(0)), |
339 set(['CWUser',])) |
338 set(['CWUser',])) |
340 self.assertEquals(set(e.e_schema.type for e in rset.entities(1)), |
339 self.assertEquals(set(e.e_schema.type for e in rset.entities(1)), |
341 set(['CWGroup',])) |
340 set(['CWGroup',])) |
342 |
341 |
343 def test_printable_rql(self): |
342 def test_printable_rql(self): |
344 rset = self.execute(u'CWEType X WHERE X final FALSE, X meta FALSE') |
343 rset = self.execute(u'CWEType X WHERE X final FALSE, X meta FALSE') |
345 self.assertEquals(rset.printable_rql(), |
344 self.assertEquals(rset.printable_rql(), |
346 'Any X WHERE X final FALSE, X meta FALSE, X is CWEType') |
345 'Any X WHERE X final FALSE, X meta FALSE, X is CWEType') |
347 |
346 |
348 |
347 |
349 def test_searched_text(self): |
348 def test_searched_text(self): |
350 rset = self.execute(u'Any X WHERE X has_text "foobar"') |
349 rset = self.execute(u'Any X WHERE X has_text "foobar"') |
351 self.assertEquals(rset.searched_text(), 'foobar') |
350 self.assertEquals(rset.searched_text(), 'foobar') |
352 rset = self.execute(u'Any X WHERE X has_text %(text)s', {'text' : 'foo'}) |
351 rset = self.execute(u'Any X WHERE X has_text %(text)s', {'text' : 'foo'}) |
353 self.assertEquals(rset.searched_text(), 'foo') |
352 self.assertEquals(rset.searched_text(), 'foo') |
354 |
353 |
355 |
354 |
356 if __name__ == '__main__': |
355 if __name__ == '__main__': |
357 unittest_main() |
356 unittest_main() |