-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b8ae5f
commit 2a1d21a
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
|
||
from click.testing import CliRunner | ||
|
||
from camelot.cli import cli | ||
from camelot.utils import TemporaryDirectory | ||
|
||
|
||
testdir = os.path.dirname(os.path.abspath(__file__)) | ||
testdir = os.path.join(testdir, 'files') | ||
|
||
|
||
def test_cli_lattice(): | ||
with TemporaryDirectory() as tempdir: | ||
infile = os.path.join(testdir, 'foo.pdf') | ||
outfile = os.path.join(tempdir, 'foo.csv') | ||
runner = CliRunner() | ||
result = runner.invoke(cli, ['--format', 'csv', '--output', outfile, | ||
'lattice', infile]) | ||
assert result.exit_code == 0 | ||
assert result.output == 'Found 1 tables\n' | ||
|
||
|
||
def test_cli_stream(): | ||
with TemporaryDirectory() as tempdir: | ||
infile = os.path.join(testdir, 'budget.pdf') | ||
outfile = os.path.join(tempdir, 'budget.csv') | ||
runner = CliRunner() | ||
result = runner.invoke(cli, ['--format', 'csv', '--output', outfile, | ||
'stream', infile]) | ||
assert result.exit_code == 0 | ||
assert result.output == 'Found 1 tables\n' |