-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from jenshnielsen/test_sample_corpus
Add test of sample corpus to unittest suite
- Loading branch information
Showing
4 changed files
with
51 additions
and
2 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,6 @@ | ||
import pytest | ||
|
||
|
||
def pytest_addoption(parser): | ||
parser.addoption("--runslow", action="store_true", | ||
help="run slow tests") |
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 |
---|---|---|
@@ -1,9 +1,35 @@ | ||
import pytest | ||
|
||
from ...model.corpus import Corpus | ||
|
||
from ..fixtures import tiny_corpus | ||
from ..fixtures import tiny_corpus, sample_corpus, whole_corpus | ||
|
||
|
||
slow = pytest.mark.skipif( | ||
not pytest.config.getoption("--runslow"), | ||
reason="need --runslow option to run" | ||
) | ||
|
||
|
||
def test_tiny(): | ||
corpus = Corpus(source=tiny_corpus()) | ||
assert corpus.successes == 1 | ||
assert corpus.failures == 1 | ||
|
||
|
||
@slow | ||
def test_sample(): | ||
corpus = Corpus(source=sample_corpus()) | ||
assert corpus.successes == 36 | ||
assert corpus.failures == 3 | ||
|
||
|
||
@pytest.mark.skipif(not whole_corpus(), | ||
reason="Need to set oracc_corpus_path to point " | ||
"to the whole corpus, which is not bundled with " | ||
"pyoracc") | ||
@slow | ||
def test_whole(): | ||
corpus = Corpus(source=whole_corpus()) | ||
assert corpus.successes == 2474 | ||
assert corpus.failures == 394 |