Mercurial > p > roundup > code
comparison test/test_indexer.py @ 2977:9c8de04a76b1
unit test fixes
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 29 Nov 2004 02:55:47 +0000 |
| parents | 93f03c6714d8 |
| children | 2fee36128471 |
comparison
equal
deleted
inserted
replaced
| 2976:e03ef8a8df7f | 2977:9c8de04a76b1 |
|---|---|
| 16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | 16 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | 17 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | 18 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 # SOFTWARE. | 19 # SOFTWARE. |
| 20 | 20 |
| 21 # $Id: test_indexer.py,v 1.4 2004-03-19 04:47:59 richard Exp $ | 21 # $Id: test_indexer.py,v 1.5 2004-11-29 02:55:47 richard Exp $ |
| 22 | 22 |
| 23 import os, unittest, shutil | 23 import os, unittest, shutil |
| 24 | 24 |
| 25 from roundup.backends.indexer_dbm import Indexer | 25 from roundup.backends.indexer_dbm import Indexer |
| 26 | 26 |
| 33 self.dex = Indexer('test-index') | 33 self.dex = Indexer('test-index') |
| 34 self.dex.load_index() | 34 self.dex.load_index() |
| 35 | 35 |
| 36 def test_basics(self): | 36 def test_basics(self): |
| 37 self.dex.add_text('testing1', 'a the hello world') | 37 self.dex.add_text('testing1', 'a the hello world') |
| 38 self.assertEqual(self.dex.words, {'HELLO': {1: 1}, 'THE': {1: 1}, | 38 self.assertEqual(self.dex.words, {'HELLO': {1: 1}, 'WORLD': {1: 1}}) |
| 39 'WORLD': {1: 1}}) | |
| 40 self.dex.add_text('testing2', 'blah blah the world') | 39 self.dex.add_text('testing2', 'blah blah the world') |
| 41 self.assertEqual(self.dex.words, {'BLAH': {2: 2}, 'HELLO': {1: 1}, | 40 self.assertEqual(self.dex.words, {'BLAH': {2: 2}, 'HELLO': {1: 1}, |
| 42 'THE': {2: 1, 1: 1}, 'WORLD': {2: 1, 1: 1}}) | 41 'WORLD': {2: 1, 1: 1}}) |
| 43 self.assertEqual(self.dex.find(['world']), {2: 'testing2', | 42 self.assertEqual(self.dex.find(['world']), {2: 'testing2', |
| 44 1: 'testing1'}) | 43 1: 'testing1'}) |
| 45 self.assertEqual(self.dex.find(['blah']), {2: 'testing2'}) | 44 self.assertEqual(self.dex.find(['blah']), {2: 'testing2'}) |
| 46 self.assertEqual(self.dex.find(['blah', 'hello']), {}) | 45 self.assertEqual(self.dex.find(['blah', 'hello']), {}) |
| 47 self.dex.save_index() | 46 self.dex.save_index() |
