diff options
| author | Cody Logan <clpo13@gmail.com> | 2019-01-08 15:35:31 -0800 |
|---|---|---|
| committer | Cody Logan <clpo13@gmail.com> | 2019-01-08 15:36:17 -0800 |
| commit | 75dba5470d4e22d3695c892277fd165d93e07bed (patch) | |
| tree | b8a2a9fc5fb9ba5b21e807322a98d393a90d0bb3 /test | |
| parent | 1fb93e6f0f3146a165723dd5920e38b7da5d89b4 (diff) | |
| download | wikiget-75dba5470d4e22d3695c892277fd165d93e07bed.tar.gz wikiget-75dba5470d4e22d3695c892277fd165d93e07bed.zip | |
Additional comments and clarifications
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_wikiget.py | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/test/test_wikiget.py b/test/test_wikiget.py index 2f1c8f5..8a30a37 100644 --- a/test/test_wikiget.py +++ b/test/test_wikiget.py @@ -9,6 +9,9 @@ from wikiget import wikiget def test_invalid_site_input(): + """ + Invalid site strings should not return regex match objects. + """ invalid_input = ["example.com", "vim.wikia.com", "en.wikipedia.com", "en.wikimpedia.org"] for i in invalid_input: @@ -17,6 +20,9 @@ def test_invalid_site_input(): def test_valid_site_input(): + """ + Valid site strings should return regex match objects. + """ valid_input = ["en.wikipedia.org", "commons.wikimedia.org", "de.wikipedia.org", "meta.wikimedia.org"] for i in valid_input: @@ -25,14 +31,23 @@ def test_valid_site_input(): def test_file_regex(): + """ + File regex should return a match object with match groups corresponding + to the file prefix and name. + :return: + """ i = "File:Example.jpg" file_match = wikiget.valid_file(i) - assert file_match.group(0) - assert file_match.group(1) == "File:" - assert file_match.group(2) == "Example.jpg" + assert file_match is not None + assert file_match.group(0) == "File:Example.jpg" # entire match + assert file_match.group(1) == "File:" # first group + assert file_match.group(2) == "Example.jpg" # second group def test_invalid_file_input(): + """ + Invalid file strings should not return regex match objects. + """ invalid_input = ["file:example", "example.jpg", "Foo Bar.gif", "Fil:Example.jpg"] for i in invalid_input: @@ -41,7 +56,11 @@ def test_invalid_file_input(): def test_valid_file_input(): - valid_input = ["Image:example.jpg", "file:example.jpg", "File:example.file-01.jpg", + """ + Valid file strings should return regex match objects. + """ + valid_input = ["Image:example.jpg", "file:example.jpg", + "File:example.file-01.jpg", "File:ß handwritten sample.gif"] for i in valid_input: file_match = wikiget.valid_file(i) |
