diff options
author | Benjamin Saller <bcsaller@objectrealms.net> | 2007-05-18 21:35:34 (GMT) |
---|---|---|
committer | Benjamin Saller <bcsaller@objectrealms.net> | 2007-05-18 21:35:34 (GMT) |
commit | e898535c1226ebe6bf3c080d195ec3b1b22f9cd0 (patch) | |
tree | 5adc68437fcf23a0af0cfd96c67ed45b653b000f /tests | |
parent | 06fa630258b5600f3c4068ea579aec23e9cdb1d3 (diff) |
verify indexing works with non-ascii files, all tests pass
Diffstat (limited to 'tests')
-rw-r--r-- | tests/query.txt | 4 | ||||
-rw-r--r-- | tests/sugar_demo_may17.txt | 6 | ||||
-rw-r--r-- | tests/test_conversion.py | 14 |
3 files changed, 22 insertions, 2 deletions
diff --git a/tests/query.txt b/tests/query.txt index 784e821..eef2735 100644 --- a/tests/query.txt +++ b/tests/query.txt @@ -226,6 +226,10 @@ True >>> qm.find(fulltext="amazed", author="Benjamin") == [a] True +>>> qm.update(a, file="test.doc") +>>> qm.find(fulltext="amazed", author="Benjamin") == [a] +True + Now for politeness we shut everything down >>> qm.stop() diff --git a/tests/sugar_demo_may17.txt b/tests/sugar_demo_may17.txt index 23fe1ef..0e35b91 100644 --- a/tests/sugar_demo_may17.txt +++ b/tests/sugar_demo_may17.txt @@ -54,4 +54,10 @@ Check content: 'some other content\n' >>> fp.close() +Set content as pdf: +>>> ds.update(uid, dict(title="Same entry with some content in pdf"), 'test.pdf') +>>> ds.update(uid, dict(title="Same entry with some content in doc"), 'test.doc') +>>> ds.update(uid, dict(title="Same entry with some content in odt"), 'test.odt') + + >>> del ds diff --git a/tests/test_conversion.py b/tests/test_conversion.py index fbb589b..aae6fc0 100644 --- a/tests/test_conversion.py +++ b/tests/test_conversion.py @@ -1,6 +1,6 @@ import unittest -from olpc.datastore.converter import Purify +from olpc.datastore.converter import Purify, converter from StringIO import StringIO class Test(unittest.TestCase): @@ -20,7 +20,17 @@ class Test(unittest.TestCase): # and that we are getting string # (not unicode) back assert isinstance(line, str) - + + def test_unicode(self): + # read each of the test files in doing conversion, + # there should be no unicode errors + fn_expectations = { + 'test.pdf' : 'Don\'t', + 'test.doc' : 'amazed.', + 'test.odt' : 'amazed.' + } + for fn, expect in fn_expectations.iteritems(): + assert expect in converter(fn).read() def test_suite(): |