Mercurial > p > roundup > code
diff test/test_indexer.py @ 5960:0db2621b6fee
Add test for issue1344046 and maybe issue1195739
Python3 should be properly indexing unicode words while python2
doesn't. Add test (xfail for python 2) for this. So far I have passing
on python3 (tested 4 of 6 indexers) and fail on 2 of 6 and xpass on 2
of 6 under python2.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 29 Oct 2019 21:33:10 -0400 |
| parents | f8893e1cde0d |
| children | f6c58a7b535c |
line wrap: on
line diff
--- a/test/test_indexer.py Thu Oct 24 22:16:03 2019 -0400 +++ b/test/test_indexer.py Tue Oct 29 21:33:10 2019 -0400 @@ -51,6 +51,13 @@ "Skipping Whoosh indexer tests: 'whoosh' not installed")) +import sys +if sys.version_info[0] > 2: + unicode_fails_py2 = lambda func, *args, **kwargs: func +else: + unicode_fails_py2 = pytest.mark.xfail( + reason="Unicode indexing expected to fail under python 2") + class db: class config(dict): DATABASE = 'test-index' @@ -158,6 +165,15 @@ self.dex.add_text(('test', str(i), 'many'), 'many') self.assertEqual(len(self.dex.find(['many'])), 123) + @unicode_fails_py2 + def test_unicode(self): + """Test with unicode words. see: + https://issues.roundup-tracker.org/issue1344046""" + + self.dex.add_text(('test', '1', 'a'), u'Spr\xfcnge') + self.assertSeqEqual(self.dex.find([u'Spr\xfcnge']), + [('test', '1', 'a')]) + def tearDown(self): shutil.rmtree('test-index')
