lucene-pylucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From va...@apache.org
Subject svn commit: r1426880 - in /lucene/pylucene/trunk: java/org/apache/pylucene/queryparser/classic/PythonMultiFieldQueryParser.java test/test_PyLucene.py test/test_PythonQueryParser.py
Date Sun, 30 Dec 2012 01:34:02 GMT
Author: vajda
Date: Sun Dec 30 01:34:02 2012
New Revision: 1426880

URL: http://svn.apache.org/viewvc?rev=1426880&view=rev
Log:
migrated test_PythonQueryParser.py

Modified:
    lucene/pylucene/trunk/java/org/apache/pylucene/queryparser/classic/PythonMultiFieldQueryParser.java
    lucene/pylucene/trunk/test/test_PyLucene.py
    lucene/pylucene/trunk/test/test_PythonQueryParser.py

Modified: lucene/pylucene/trunk/java/org/apache/pylucene/queryparser/classic/PythonMultiFieldQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/java/org/apache/pylucene/queryparser/classic/PythonMultiFieldQueryParser.java?rev=1426880&r1=1426879&r2=1426880&view=diff
==============================================================================
--- lucene/pylucene/trunk/java/org/apache/pylucene/queryparser/classic/PythonMultiFieldQueryParser.java
(original)
+++ lucene/pylucene/trunk/java/org/apache/pylucene/queryparser/classic/PythonMultiFieldQueryParser.java
Sun Dec 30 01:34:02 2012
@@ -13,7 +13,7 @@
  * ====================================================================
  */
 
-package org.apache.pylucene.queryParser.classic;
+package org.apache.pylucene.queryparser.classic;
 
 import java.util.List;
 

Modified: lucene/pylucene/trunk/test/test_PyLucene.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test/test_PyLucene.py?rev=1426880&r1=1426879&r2=1426880&view=diff
==============================================================================
--- lucene/pylucene/trunk/test/test_PyLucene.py (original)
+++ lucene/pylucene/trunk/test/test_PyLucene.py Sun Dec 30 01:34:02 2012
@@ -273,9 +273,8 @@ class Test_PyLuceneBase(object):
         try:
             reader = DirectoryReader.open(store)
             term_enum = MultiFields.getTerms(reader, "docid").iterator(None)
-            docids = []
-            for term in BytesRefIterator.cast_(term_enum):
-                docids.append(term.utf8ToString())
+            docids = [term.utf8ToString()
+                      for term in BytesRefIterator.cast_(term_enum)]
             self.assertEqual(len(docids), 2)
         finally:
             self.closeStore(store, reader)

Modified: lucene/pylucene/trunk/test/test_PythonQueryParser.py
URL: http://svn.apache.org/viewvc/lucene/pylucene/trunk/test/test_PythonQueryParser.py?rev=1426880&r1=1426879&r2=1426880&view=diff
==============================================================================
--- lucene/pylucene/trunk/test/test_PythonQueryParser.py (original)
+++ lucene/pylucene/trunk/test/test_PythonQueryParser.py Sun Dec 30 01:34:02 2012
@@ -13,7 +13,14 @@
 # ====================================================================
 
 from unittest import TestCase, main
-from lucene import *
+from PyLuceneTestCase import PyLuceneTestCase
+
+from org.apache.lucene.analysis.standard import StandardAnalyzer
+from org.apache.lucene.index import Term
+from org.apache.lucene.search import BooleanClause, TermQuery
+from org.apache.lucene.util import Version
+from org.apache.pylucene.queryparser.classic import \
+    PythonQueryParser, PythonMultiFieldQueryParser
 
 
 class BooleanTestMixin(object):
@@ -28,7 +35,7 @@ class BooleanTestMixin(object):
                                                              disableCoord)
 
 
-class PythonQueryParserTestCase(TestCase):
+class PythonQueryParserTestCase(PyLuceneTestCase):
 
     def testOverrideBooleanQuery(self):
 
@@ -38,11 +45,12 @@ class PythonQueryParserTestCase(TestCase
         
         qp = TestQueryParser(Version.LUCENE_CURRENT, 'all',
                              StandardAnalyzer(Version.LUCENE_CURRENT))
+
         q = qp.parse("foo bar")
         self.assertEquals(str(q), "all:foo all:bar all:extra_clause")
 
 
-class PythonMultiFieldQueryParserTestCase(TestCase):
+class PythonMultiFieldQueryParserTestCase(PyLuceneTestCase):
 
     def testOverrideBooleanQuery(self):
 
@@ -59,8 +67,8 @@ class PythonMultiFieldQueryParserTestCas
 
 
 if __name__ == "__main__":
-    import sys
-    initVM()
+    import sys, lucene
+    lucene.initVM()
     if '-loop' in sys.argv:
         sys.argv.remove('-loop')
         while True:



Mime
View raw message