Repository: chezou/tabula-py (python)

Issue:
`guess=False` when `stream` or `lattice` is True
Since tabula app works independently between guess, stream, and lattice, it should be better to off when `stream` or `lattice` option is on.

Pull request:
Make stream and lattice exclusive with guess option
Fix #134

Patch:
diff --git a/tabula/wrapper.py b/tabula/wrapper.py
index 254693c..638fd26 100644
--- a/tabula/wrapper.py
+++ b/tabula/wrapper.py
@@ -2,10 +2,6 @@
 
 This module extract tables from PDF into pandas DataFrame. Currently, the
 implementation of this module uses subprocess.
-
-Todo:
-  * Use py4j and handle multiple tables in a page
-
 '''
 
 import io
@@ -439,6 +435,17 @@ def build_options(kwargs=None):
                 __options += ["--area", __area]
 
     guess = kwargs.get('guess', True)
+
+    lattice = kwargs.get('lattice') or kwargs.get('spreadsheet')
+    if lattice:
+        guess = False
+        __options.append("--lattice")
+
+    stream = kwargs.get('stream') or kwargs.get('nospreadsheet')
+    if stream:
+        guess = False
+        __options.append("--stream")
+
     if guess and not multiple_areas:
         __options.append("--guess")
 
@@ -450,14 +457,6 @@ def build_options(kwargs=None):
     if output_path:
         __options += ["--outfile", output_path]
 
-    lattice = kwargs.get('lattice') or kwargs.get('spreadsheet')
-    if lattice:
-        __options.append("--lattice")
-
-    stream = kwargs.get('stream') or kwargs.get('nospreadsheet')
-    if stream:
-        __options.append("--stream")
-
     columns = kwargs.get('columns')
     if columns:
         __columns = ",".join(map(str, columns))


Test patch:
diff --git a/tests/test_read_pdf_table.py b/tests/test_read_pdf_table.py
index d0102b6..cd09dbf 100644
--- a/tests/test_read_pdf_table.py
+++ b/tests/test_read_pdf_table.py
@@ -43,10 +43,10 @@ class TestReadPdfTable(unittest.TestCase):
         expected_csv2 = 'tests/resources/data_2-3.csv'
         expected_df2 = pd.read_csv(expected_csv2)
         self.assertTrue(tabula.read_pdf(pdf_path, pages=1).equals(pd.read_csv(expected_csv1)))
-        self.assertTrue(tabula.read_pdf(pdf_path, pages='2-3', stream=True,
-                                        guess=False).equals(expected_df2))
+        self.assertTrue(tabula.read_pdf(pdf_path, pages='2-3', stream=True).equals(expected_df2))
+        self.assertTrue(tabula.read_pdf(pdf_path, pages=(2, 3), stream=True).equals(expected_df2))
         self.assertTrue(tabula.read_pdf(pdf_path, pages=(2, 3), stream=True,
-                                        guess=False).equals(expected_df2))
+                                        guess=True).equals(expected_df2))
 
     def test_read_pdf_file_like_obj(self):
         pdf_path = 'tests/resources/data.pdf'