Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions
AdvancedQuery.tests.testAdvancedQuery.TestIndexIndependant Class Reference
Inheritance diagram for AdvancedQuery.tests.testAdvancedQuery.TestIndexIndependant:
Inheritance graph
[legend]
Collaboration diagram for AdvancedQuery.tests.testAdvancedQuery.TestIndexIndependant:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testMakeAdvancedQuery
def testStr
def testRanking_Sum
def testRanking_Max

Private Member Functions

def _checkRank

Detailed Description

tests independent from index type.

Definition at line 86 of file testAdvancedQuery.py.


Member Function Documentation

def AdvancedQuery.tests.testAdvancedQuery.TestIndexIndependant._checkRank (   self,
  ranker,
  rs,
  should 
) [private]

Definition at line 138 of file testAdvancedQuery.py.

00138 
00139   def _checkRank(self, ranker, rs, should):
00140     all = And()
00141     C = self.catalog; eval = C.evalAdvancedQuery
00142     rl = []; c = C._catalog
00143     for r in eval(all, (ranker(*rs), 'I1', 'I2')):
00144       rl.append(c.paths[r.data_record_id_])
00145       rl.append(`r.data_record_score_[0]`)
00146     self.assertEqual(''.join(rl), should)
00147 
00148 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 88 of file testAdvancedQuery.py.

00088 
00089   def testMakeAdvancedQuery(self):
00090     C = self.catalog
00091     q = C.makeAdvancedQuery({'I1':'a', 'I2': {'query':'A'},})
00092     self._check(C.evalAdvancedQuery(q), '1')
00093     q = C.makeAdvancedQuery({'I1':('a','b'), 'I1_usage': 'range:min:max',})
00094     self._check(C.evalAdvancedQuery(q), '1234')

Here is the call graph for this function:

Definition at line 126 of file testAdvancedQuery.py.

00126 
00127   def testRanking_Max(self):
00128     self._checkRank(
00129                RankByQueries_Max,
00130                ((In('I1', ('b', 'c')),1), (Eq('I2','A'),1)),
00131                '112141615130'
00132                )
00133     self._checkRank(
00134                RankByQueries_Max,
00135                ((Eq('I1', 'b'),2), (Eq('I2','A'),1)),
00136                '224211513060'
00137                )

Here is the call graph for this function:

Definition at line 109 of file testAdvancedQuery.py.

00109 
00110   def testRanking_Sum(self):
00111     self._checkRank(
00112                RankByQueries_Sum,
00113                ((In('I1', ('b', 'c')),1), (Eq('I2','A'),1)),
00114                '221141615130'
00115                )
00116     self._checkRank(
00117                RankByQueries_Sum,
00118                ((Eq('I1', 'b'),1), (Eq('I2','X'),1)),
00119                '214110306050'
00120                )
00121     self._checkRank(
00122                RankByQueries_Sum,
00123                ((Eq('I1', 'x'),1), (Eq('I2','B'),1)),
00124                '314110206050'
00125                )

Here is the call graph for this function:

Definition at line 95 of file testAdvancedQuery.py.

00095 
00096   def testStr(self):
00097     self.assertEqual(str(Eq('I1','a')), "I1 = 'a'")
00098     self.assertEqual(str(Le('I1',1)), 'I1 <= 1')
00099     self.assertEqual(str(Ge('I1',1)), 'I1 >= 1')
00100     self.assertEqual(str(MatchGlob('I1',1)), 'I1 =~ 1')
00101     self.assertEqual(str(MatchRegexp('I1',1)), 'I1 =~~ 1')
00102     self.assertEqual(str(Generic('I1',1)), 'I1 ~~ 1')
00103     self.assertEqual(str(In('I1',(1,2))), 'I1 in (1, 2)')
00104     self.assertEqual(str(Between('I1',1,2)), '1 <= I1 <= 2')
00105     self.assertEqual(str(Indexed('I1')), 'Indexed(I1)')
00106     self.assertEqual(str(~Le('I1',1)), '~(I1 <= 1)')
00107     self.assertEqual(str(Le('I1',1) & Eq('I2',2)), '(I1 <= 1 & I2 = 2)')
00108     self.assertEqual(str(Le('I1',1) | Eq('I2',2) | Eq('I3',3)), '(I1 <= 1 | I2 = 2 | I3 = 3)' )


The documentation for this class was generated from the following file: