aboutsummaryrefslogtreecommitdiff
path: root/server/szurubooru/tests/func
diff options
context:
space:
mode:
authorShyam Sunder2020-09-01 14:06:22 -0400
committerShyam Sunder2020-09-01 14:07:39 -0400
commit0dd427755b601da8dadf9af1a34ecad03f8446f9 (patch)
tree7f7e072132a834f1ac64e973a4ef1fd8d5a46a94 /server/szurubooru/tests/func
parent67a5dd7c18758304d42716383eb9497a143142b9 (diff)
client+server: fix linter issues due to updated pre-commit hooks
Diffstat (limited to 'server/szurubooru/tests/func')
-rw-r--r--server/szurubooru/tests/func/test_diff.py24
-rw-r--r--server/szurubooru/tests/func/test_mime.py5
-rw-r--r--server/szurubooru/tests/func/test_net.py5
-rw-r--r--server/szurubooru/tests/func/test_posts.py50
4 files changed, 68 insertions, 16 deletions
diff --git a/server/szurubooru/tests/func/test_diff.py b/server/szurubooru/tests/func/test_diff.py
index 5ea5780..5e415b5 100644
--- a/server/szurubooru/tests/func/test_diff.py
+++ b/server/szurubooru/tests/func/test_diff.py
@@ -6,7 +6,11 @@ from szurubooru.func import diff
@pytest.mark.parametrize(
"old,new,expected",
[
- ([], [], None,),
+ (
+ [],
+ [],
+ None,
+ ),
(
[],
["added"],
@@ -17,7 +21,11 @@ from szurubooru.func import diff
[],
{"type": "list change", "added": [], "removed": ["removed"]},
),
- (["untouched"], ["untouched"], None,),
+ (
+ ["untouched"],
+ ["untouched"],
+ None,
+ ),
(
["untouched"],
["untouched", "added"],
@@ -37,7 +45,11 @@ def test_get_list_diff(old, new, expected):
@pytest.mark.parametrize(
"old,new,expected",
[
- ({}, {}, None,),
+ (
+ {},
+ {},
+ None,
+ ),
(
{"removed key": "removed value"},
{},
@@ -78,7 +90,11 @@ def test_get_list_diff(old, new, expected):
},
},
),
- ({"key": "untouched"}, {"key": "untouched"}, None,),
+ (
+ {"key": "untouched"},
+ {"key": "untouched"},
+ None,
+ ),
(
{"key": "untouched", "removed key": "removed value"},
{"key": "untouched"},
diff --git a/server/szurubooru/tests/func/test_mime.py b/server/szurubooru/tests/func/test_mime.py
index 4eb9b16..0d8f645 100644
--- a/server/szurubooru/tests/func/test_mime.py
+++ b/server/szurubooru/tests/func/test_mime.py
@@ -88,7 +88,10 @@ def test_is_image(input_mime_type, expected_state):
@pytest.mark.parametrize(
"input_path,expected_state",
- [("gif.gif", False), ("gif-animated.gif", True),],
+ [
+ ("gif.gif", False),
+ ("gif-animated.gif", True),
+ ],
)
def test_is_animated_gif(read_asset, input_path, expected_state):
assert mime.is_animated_gif(read_asset(input_path)) == expected_state
diff --git a/server/szurubooru/tests/func/test_net.py b/server/szurubooru/tests/func/test_net.py
index 8539a34..af53521 100644
--- a/server/szurubooru/tests/func/test_net.py
+++ b/server/szurubooru/tests/func/test_net.py
@@ -66,7 +66,10 @@ def test_download():
@pytest.mark.parametrize(
- "url", ["https://samples.ffmpeg.org/MPEG-4/video.mp4",]
+ "url",
+ [
+ "https://samples.ffmpeg.org/MPEG-4/video.mp4",
+ ],
)
def test_too_large_download(url):
pytest.xfail("Download limit not implemented yet")
diff --git a/server/szurubooru/tests/func/test_posts.py b/server/szurubooru/tests/func/test_posts.py
index acedf6f..d088b9b 100644
--- a/server/szurubooru/tests/func/test_posts.py
+++ b/server/szurubooru/tests/func/test_posts.py
@@ -232,7 +232,11 @@ def test_serialize_post(
"category": "test-cat1",
"usages": 1,
},
- {"names": ["tag3"], "category": "test-cat2", "usages": 1,},
+ {
+ "names": ["tag3"],
+ "category": "test-cat2",
+ "usages": 1,
+ },
],
"relations": [],
"notes": [],
@@ -452,7 +456,10 @@ def test_update_post_content_for_new_post(
config_injector(
{
"data_dir": str(tmpdir.mkdir("data")),
- "thumbnails": {"post_width": 300, "post_height": 300,},
+ "thumbnails": {
+ "post_width": 300,
+ "post_height": 300,
+ },
"secret": "test",
"allow_broken_uploads": False,
}
@@ -485,7 +492,10 @@ def test_update_post_content_to_existing_content(
{
"data_dir": str(tmpdir.mkdir("data")),
"data_url": "example.com",
- "thumbnails": {"post_width": 300, "post_height": 300,},
+ "thumbnails": {
+ "post_width": 300,
+ "post_height": 300,
+ },
"secret": "test",
"allow_broken_uploads": False,
}
@@ -509,7 +519,10 @@ def test_update_post_content_with_broken_content(
config_injector(
{
"data_dir": str(tmpdir.mkdir("data")),
- "thumbnails": {"post_width": 300, "post_height": 300,},
+ "thumbnails": {
+ "post_width": 300,
+ "post_height": 300,
+ },
"secret": "test",
"allow_broken_uploads": allow_broken_uploads,
}
@@ -533,7 +546,9 @@ def test_update_post_content_with_invalid_content(
config_injector, input_content
):
config_injector(
- {"allow_broken_uploads": True,}
+ {
+ "allow_broken_uploads": True,
+ }
)
post = model.Post()
with pytest.raises(posts.InvalidPostContentError):
@@ -547,7 +562,10 @@ def test_update_post_thumbnail_to_new_one(
config_injector(
{
"data_dir": str(tmpdir.mkdir("data")),
- "thumbnails": {"post_width": 300, "post_height": 300,},
+ "thumbnails": {
+ "post_width": 300,
+ "post_height": 300,
+ },
"secret": "test",
"allow_broken_uploads": False,
}
@@ -585,7 +603,10 @@ def test_update_post_thumbnail_to_default(
config_injector(
{
"data_dir": str(tmpdir.mkdir("data")),
- "thumbnails": {"post_width": 300, "post_height": 300,},
+ "thumbnails": {
+ "post_width": 300,
+ "post_height": 300,
+ },
"secret": "test",
"allow_broken_uploads": False,
}
@@ -622,7 +643,10 @@ def test_update_post_thumbnail_with_broken_thumbnail(
config_injector(
{
"data_dir": str(tmpdir.mkdir("data")),
- "thumbnails": {"post_width": 300, "post_height": 300,},
+ "thumbnails": {
+ "post_width": 300,
+ "post_height": 300,
+ },
"secret": "test",
"allow_broken_uploads": False,
}
@@ -663,7 +687,10 @@ def test_update_post_content_leaving_custom_thumbnail(
config_injector(
{
"data_dir": str(tmpdir.mkdir("data")),
- "thumbnails": {"post_width": 300, "post_height": 300,},
+ "thumbnails": {
+ "post_width": 300,
+ "post_height": 300,
+ },
"secret": "test",
"allow_broken_uploads": False,
}
@@ -1084,7 +1111,10 @@ def test_merge_posts_replaces_content(
"data_dir": str(tmpdir.mkdir("data")),
"data_url": "example.com",
"delete_source_files": False,
- "thumbnails": {"post_width": 300, "post_height": 300,},
+ "thumbnails": {
+ "post_width": 300,
+ "post_height": 300,
+ },
"secret": "test",
}
)

© 2015 - 2026 Jakob L. Kreuze