-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1260 from twm/dependabot/pip/ruff-0.9.0
Bump ruff from 0.8.3 to 0.9.0
- Loading branch information
Showing
9 changed files
with
56 additions
and
49 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
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,4 +1,4 @@ | ||
# Copyright © 2018, 2020 Tom Most <[email protected]> | ||
# Copyright © 2018, 2020, 2025 Tom Most <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -404,7 +404,7 @@ def test_logger_namespace(self): | |
log.info("info\n{more}", more="info") | ||
log.error("err") | ||
|
||
self.assertEqual(("<6>[ns] info\n" "<6> info\n" "<3>[ns] err\n"), fout.getvalue()) | ||
self.assertEqual(("<6>[ns] info\n<6> info\n<3>[ns] err\n"), fout.getvalue()) | ||
|
||
def test_logger_namespace_failure(self): | ||
""" | ||
|
@@ -417,14 +417,14 @@ def test_logger_namespace_failure(self): | |
log.failure("Something went wrong", Failure(Exception("1\n2\n3"))) | ||
|
||
self.assertEqual( | ||
( | ||
"<2>[ns] Something went wrong\n" | ||
"<2> Traceback (most recent call last):\n" | ||
"<2> Failure: builtins.Exception: 1\n" | ||
"<2> 2\n" | ||
"<2> 3\n" | ||
), | ||
fout.getvalue(), | ||
[ | ||
"<2>[ns] Something went wrong", | ||
"<2> Traceback (most recent call last):", | ||
"<2> Failure: builtins.Exception: 1", | ||
"<2> 2", | ||
"<2> 3", | ||
], | ||
fout.getvalue().splitlines(), | ||
) | ||
|
||
def test_log_legacy(self): | ||
|
@@ -436,8 +436,14 @@ def test_log_legacy(self): | |
p.msg("m\ns\ng", logLevel=logging.DEBUG) | ||
|
||
self.assertEqual( | ||
("<6>[-] msg\n" "<6>[system] msg\n" "<7>[-] m\n" "<7> s\n" "<7> g\n"), | ||
fout.getvalue(), | ||
[ | ||
"<6>[-] msg", | ||
"<6>[system] msg", | ||
"<7>[-] m", | ||
"<7> s", | ||
"<7> g", | ||
], | ||
fout.getvalue().splitlines(), | ||
) | ||
|
||
def _get_stdlib_logger(self, name): | ||
|
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright © 2017, 2018, 2020, 2022 Tom Most <[email protected]> | ||
# Copyright © 2017, 2018, 2020, 2022, 2025 Tom Most <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -153,25 +153,28 @@ def test_object_replaced(self): | |
An ``<object>`` tag is replaced with its content, omitting any | ||
``<param>`` tags as well. | ||
""" | ||
html = '<object data="obsolete.swf" type="application/x-shockwave-flash">' '<param name="foo" value="bar">' "<p>Flash video</p>" "</object>" | ||
self.assertEqual("<p>Flash video", sanitize_html(html)) | ||
html = [ | ||
'<object data="obsolete.swf" type="application/x-shockwave-flash">', | ||
'<param name="foo" value="bar"><p>Flash video</p></object>', | ||
] | ||
self.assertEqual("<p>Flash video", sanitize_html("".join(html))) | ||
|
||
def test_object_nest_replaced(self): | ||
""" | ||
Nested ``<object>`` tags are recursively replaced with their content. | ||
""" | ||
html = ( | ||
"<p>" | ||
"<object>" | ||
'<param name="level" value="1">' | ||
"Level 1<br>" | ||
"<object>" | ||
'<param name="level" value="2">' | ||
"Level 2" | ||
"</object>" | ||
"</object>" | ||
"<p>", | ||
"<object>", | ||
'<param name="level" value="1">', | ||
"Level 1<br>", | ||
"<object>", | ||
'<param name="level" value="2">', | ||
"Level 2", | ||
"</object>", | ||
"</object>", | ||
) | ||
self.assertEqual("<p>Level 1<br>Level 2", sanitize_html(html)) | ||
self.assertEqual("<p>Level 1<br>Level 2", sanitize_html("".join(html))) | ||
|
||
def test_link_tag_dropped(self): | ||
""" | ||
|
@@ -219,9 +222,7 @@ def test_youtube_nocookie_embed_replaced(self): | |
""" | ||
A "privacy-enhanced" YouTube embed, which uses the youtube-nocookie.com domain, is replaced with a link. | ||
""" | ||
html = ( | ||
'<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/Q0CbN8sfihY"' ' frameborder="0" allowfullscreen></iframe>' | ||
) | ||
html = '<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/Q0CbN8sfihY" frameborder="0" allowfullscreen></iframe>' | ||
self.assertEqual( | ||
( | ||
'<a href="https://www.youtube.com/watch?v=Q0CbN8sfihY"' | ||
|
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,4 +1,4 @@ | ||
# Copyright © 2017, 2018, 2019, 2021, 2022, 2023 Tom Most <[email protected]> | ||
# Copyright © 2017, 2018, 2019, 2021, 2022, 2023, 2025 Tom Most <[email protected]> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
|
@@ -112,26 +112,26 @@ def test_login_redirect(self): | |
"/label/1234/all/1234/", | ||
"/feed/1/unread", | ||
"/feed/2/fave/", | ||
"/feed/3/all/4" "/feed/5/all/678/" "/labels/", | ||
"/feed/3/all/4", | ||
"/feed/5/all/678/", | ||
"/labels/", | ||
"/labels/add", | ||
"/feeds/", | ||
"/feeds/add/", | ||
"/article/1234/", | ||
] | ||
|
||
redirects = [] | ||
for next_ in nexts: | ||
response = c.post( | ||
"/login/", | ||
{ | ||
"next": next_, | ||
"username": "james", | ||
"password": "hunter2", | ||
}, | ||
) | ||
redirects.append(response["Location"]) | ||
|
||
self.assertEqual(nexts, redirects) | ||
with self.subTest("login", next=next_): | ||
response = c.post( | ||
"/login/", | ||
{ | ||
"next": next_, | ||
"username": "james", | ||
"password": "hunter2", | ||
}, | ||
) | ||
self.assertEqual(next_, response["Location"]) | ||
|
||
|
||
class LabelListTests(TestCase): | ||
|