-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy batch.py code to CLI and adjust to make it work
- Loading branch information
Showing
4 changed files
with
229 additions
and
15 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Rathausmarkt 1, 20095 Hamburg, Germany | ||
10 Downing Street, London, SW1A 2AA | ||
C/ de Mallorca, 401, 08013 Barcelona, Spain |
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import pathlib | ||
import pytest | ||
|
||
from opencage.command_line import main | ||
|
||
@pytest.fixture(autouse=True) | ||
def around(): | ||
yield | ||
pathlib.Path("test/fixtures/output.txt").unlink(True) | ||
|
||
def test_main(): | ||
main([ | ||
"--api-key", "5d3c52eae14b4d4a8372c818e076de82", | ||
"--input", "test/fixtures/forward.csv", | ||
"--output", "test/fixtures/output.txt", | ||
"--forward", | ||
]) | ||
|
||
assert pathlib.Path("test/fixtures/output.txt").exists() | ||
|
||
with open("test/fixtures/output.txt", "r") as f: | ||
lines = f.readlines() | ||
assert len(lines) == 3 | ||
assert lines[0].strip() == "Rathausmarkt 1,53.5439,10.0133,postcode,Germany,,,20095,,,7,\"20095, Germany\"" |