aboutsummaryrefslogtreecommitdiff
path: root/tests/test_parse.py
diff options
context:
space:
mode:
authorCody Logan <cody@lokken.dev>2023-11-01 13:11:35 -0700
committerCody Logan <cody@lokken.dev>2023-11-01 13:11:35 -0700
commitbf7d8c97620471fed7e9276462984b1f33b512d0 (patch)
tree006e0a99b4e9c06028e9192cf6da33a68b59329f /tests/test_parse.py
parent235b3e6a723e3e18962212c7d2c0f19619c2fa6f (diff)
downloadwikiget-bf7d8c97620471fed7e9276462984b1f33b512d0.tar.gz
wikiget-bf7d8c97620471fed7e9276462984b1f33b512d0.zip
Condense parser construction logic
Diffstat (limited to 'tests/test_parse.py')
-rw-r--r--tests/test_parse.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/test_parse.py b/tests/test_parse.py
index 3cad21c..8d8b6a6 100644
--- a/tests/test_parse.py
+++ b/tests/test_parse.py
@@ -35,7 +35,7 @@ class TestGetDest:
When a filename is passed to get_dest, it should create a File object with the
correct name and dest and the default site.
"""
- args = construct_parser().parse_args(["File:Example.jpg"])
+ args = construct_parser(["File:Example.jpg"])
return get_dest(args.FILE, args)
def test_get_dest_name_with_filename(self, file_with_filename: File) -> None:
@@ -53,9 +53,7 @@ class TestGetDest:
When a URL is passed to get_dest, it should create a File object with the
correct name and dest and the site from the URL.
"""
- args = construct_parser().parse_args(
- ["https://en.wikipedia.org/wiki/File:Example.jpg"]
- )
+ args = construct_parser(["https://en.wikipedia.org/wiki/File:Example.jpg"])
return get_dest(args.FILE, args)
def test_get_dest_name_with_url(self, file_with_url: File) -> None:
@@ -71,7 +69,7 @@ class TestGetDest:
"""
The get_dest function should raise a ParseError if the filename is invalid.
"""
- args = construct_parser().parse_args(["Example.jpg"])
+ args = construct_parser(["Example.jpg"])
with pytest.raises(ParseError):
_ = get_dest(args.FILE, args)
@@ -82,7 +80,7 @@ class TestGetDest:
If a URL is passed to get_dest and a site is also given on the command line,
the site in the URL should be used and a warning log message created.
"""
- args = construct_parser().parse_args(
+ args = construct_parser(
[
"https://commons.wikimedia.org/wiki/File:Example.jpg",
"--site",