Back to index

plone3  3.1.7
Public Member Functions
ExtendedPathIndex.tests.testExtendedPathIndex.TestPathIndex Class Reference
Inheritance diagram for ExtendedPathIndex.tests.testExtendedPathIndex.TestPathIndex:
Inheritance graph
[legend]
Collaboration diagram for ExtendedPathIndex.tests.testExtendedPathIndex.TestPathIndex:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testEmpty
def testUnIndex
def testReindex
def testUnIndexError
def testRoot_1
def testRoot_2
def testSimpleTests
def testComplexOrTests
def testComplexANDTests

Detailed Description

Test ExtendedPathIndex objects 

Definition at line 13 of file testExtendedPathIndex.py.


Member Function Documentation

Definition at line 135 of file testExtendedPathIndex.py.

00135 
00136     def testComplexANDTests(self):
00137         self._populateIndex()
00138         tests = [
00139             (['aa','bb'], 1, []),
00140             ([('aa',0), ('bb',1)], 0, [4,5,6]),
00141             ([('aa',0), ('cc',2)], 0, [3,6,9]),
00142         ]
00143 
00144         for lst, level, results in tests:
00145             res = self._index._apply_index(
00146                             {"path": {'query': lst, "level": level, "operator": "and"}})
00147             lst = list(res[0].keys())
00148             self.assertEqual(lst, results)
00149 

Here is the call graph for this function:

Definition at line 121 of file testExtendedPathIndex.py.

00121 
00122     def testComplexOrTests(self):
00123         self._populateIndex()
00124         tests = [
00125             (['aa','bb'], 1, [1,2,3,4,5,6,10,11,12,13,14,15]),
00126             (['aa','bb','xx'], 1, [1,2,3,4,5,6,10,11,12,13,14,15]),
00127             ([('cc',1), ('cc',2)], 0, [3,6,7,8,9,12,15,16,17,18]),
00128         ]
00129 
00130         for lst, level, results in tests:
00131             res = self._index._apply_index(
00132                             {"path": {'query': lst, "level": level, "operator": "or"}})
00133             lst = list(res[0].keys())
00134             self.assertEqual(lst, results)

Here is the call graph for this function:

Definition at line 16 of file testExtendedPathIndex.py.

00016 
00017     def testEmpty(self):
00018         self.assertEqual(self._index.numObjects() ,0)
00019         self.assertEqual(self._index.getEntryForObject(1234), None)
00020         self._index.unindex_object( 1234 ) # nothrow
00021         self.assertEqual(self._index._apply_index({"suxpath": "xxx"}), None)

Definition at line 33 of file testExtendedPathIndex.py.

00033 
00034     def testReindex(self):
00035         self._populateIndex()
00036         self.assertEqual(self._index.numObjects(), 18)
00037 
00038         o = epitc.Dummy('/foo/bar')
00039         self._index.index_object(19, o)
00040         self.assertEqual(self._index.numObjects(), 19)
00041         self._index.index_object(19, o)
00042         self.assertEqual(self._index.numObjects(), 19)

Here is the call graph for this function:

Definition at line 52 of file testExtendedPathIndex.py.

00052 
00053     def testRoot_1(self):
00054         self._populateIndex()
00055         tests = ( ("/", 0, range(1,19)), )
00056 
00057         for comp, level, results in tests:
00058             for path in [comp, "/"+comp, "/"+comp+"/"]:
00059                 res = self._index._apply_index(
00060                                     {"path": {'query': path, "level": level}})
00061                 lst = list(res[0].keys())
00062                 self.assertEqual(lst, results)
00063 
00064         for comp, level, results in tests:
00065             for path in [comp, "/"+comp, "/"+comp+"/"]:
00066                 res = self._index._apply_index(
00067                                     {"path": {'query': ((path, level),)}})
00068                 lst = list(res[0].keys())
00069                 self.assertEqual(lst, results)

Here is the call graph for this function:

Definition at line 70 of file testExtendedPathIndex.py.

00070 
00071     def testRoot_2(self):
00072         self._populateIndex()
00073         tests = ( ("/", 0, range(1,19)), )
00074 
00075         for comp,level,results in tests:
00076             for path in [comp, "/"+comp, "/"+comp+"/"]:
00077                 res = self._index._apply_index(
00078                                     {"path": {'query': path, "level": level}})
00079                 lst = list(res[0].keys())
00080                 self.assertEqual(lst, results)
00081 
00082         for comp, level, results in tests:
00083             for path in [comp, "/"+comp, "/"+comp+"/"]:
00084                 res = self._index._apply_index(
00085                                     {"path": {'query': ((path, level),)}})
00086                 lst = list(res[0].keys())
00087                 self.assertEqual(lst, results)

Here is the call graph for this function:

Definition at line 88 of file testExtendedPathIndex.py.

00088 
00089     def testSimpleTests(self):
00090         self._populateIndex()
00091         tests = [
00092             ("aa", 0, [1,2,3,4,5,6,7,8,9]),
00093             ("aa", 1, [1,2,3,10,11,12] ),
00094             ("bb", 0, [10,11,12,13,14,15,16,17,18]),
00095             ("bb", 1, [4,5,6,13,14,15]),
00096             ("bb/cc", 0, [16,17,18]),
00097             ("bb/cc", 1, [6,15]),
00098             ("bb/aa", 0, [10,11,12]),
00099             ("bb/aa", 1, [4,13]),
00100             ("aa/cc", -1, [3,7,8,9,12]),
00101             ("bb/bb", -1, [5,13,14,15]),
00102             ("18.html", 3, [18]),
00103             ("18.html", -1, [18]),
00104             ("cc/18.html", -1, [18]),
00105             ("cc/18.html", 2, [18]),
00106         ]
00107 
00108         for comp, level, results in tests:
00109             for path in [comp, "/"+comp, "/"+comp+"/"]:
00110                 res = self._index._apply_index(
00111                                     {"path": {'query': path, "level": level}})
00112                 lst = list(res[0].keys())
00113                 self.assertEqual(lst, results)
00114 
00115         for comp, level, results in tests:
00116             for path in [comp, "/"+comp, "/"+comp+"/"]:
00117                 res = self._index._apply_index(
00118                                     {"path": {'query': ((path, level),)}})
00119                 lst = list(res[0].keys())
00120                 self.assertEqual(lst, results)

Here is the call graph for this function:

Definition at line 22 of file testExtendedPathIndex.py.

00022 
00023     def testUnIndex(self):
00024         self._populateIndex()
00025         self.assertEqual(self._index.numObjects(), 18)
00026 
00027         for k in self._values.keys():
00028             self._index.unindex_object(k)
00029 
00030         self.assertEqual(self._index.numObjects(), 0)
00031         self.assertEqual(len(self._index._index), 0)
00032         self.assertEqual(len(self._index._unindex), 0)

Here is the call graph for this function:

Definition at line 43 of file testExtendedPathIndex.py.

00043 
00044     def testUnIndexError(self):
00045         self._populateIndex()
00046         # this should not raise an error
00047         self._index.unindex_object(-1)
00048 
00049         # nor should this
00050         self._index._unindex[1] = "/broken/thing"
00051         self._index.unindex_object(1)

Here is the call graph for this function:


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