-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(parsers,project): doctests + error handling
- Loading branch information
Showing
3 changed files
with
78 additions
and
3 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
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,27 @@ | ||
"""Test the project module.""" | ||
import pytest | ||
|
||
from gimie.extractors import GIT_PROVIDERS | ||
from gimie.project import get_parsers, get_extractor | ||
from gimie.parsers import PARSERS | ||
|
||
|
||
def test_get_parsers(): | ||
|
||
repo = "https://example.org/group/project" | ||
for name, parser in PARSERS.items(): | ||
assert type(get_parsers(repo, [name])[0]) == parser | ||
|
||
# Should raise error if parser not found | ||
with pytest.raises(ValueError): | ||
get_parsers(repo, ["bad_parser"]) | ||
|
||
|
||
def test_get_extractor(): | ||
|
||
repo = "https://example.org/group/project" | ||
for prov, extractor in GIT_PROVIDERS.items(): | ||
assert type(get_extractor(repo, prov)) == extractor | ||
|
||
with pytest.raises(ValueError): | ||
get_extractor(repo, "bad_provider") |