mirror of https://gitlab.com/tildes/tildes.git
Browse Source
Apply Black code formatter
Apply Black code formatter
This commit contains only changes that were made automatically by Black (except for some minor fixes to string un-wrapping and two format-disabling blocks in the user and group schemas). Some manual cleanup/adjustments will probably need to be made in a follow-up commit, but this one contains the result of running Black on the codebase without significant further manual tweaking.merge-requests/26/head
111 changed files with 2009 additions and 2523 deletions
-
22tildes/alembic/env.py
-
26tildes/alembic/versions/2512581c91b3_add_setting_to_open_links_in_new_tab.py
-
13tildes/alembic/versions/de83b8750123_add_setting_to_open_text_links_in_new_.py
-
35tildes/alembic/versions/f1ecbf24c212_added_user_tag_type_comment_notification.py
-
124tildes/alembic/versions/fab922a8bb04_update_comment_triggers_for_removals.py
-
21tildes/consumers/comment_user_mentions_generator.py
-
29tildes/consumers/topic_metadata_generator.py
-
57tildes/scripts/breached_passwords.py
-
51tildes/scripts/clean_private_data.py
-
50tildes/scripts/initialize_db.py
-
6tildes/setup.py
-
71tildes/tests/conftest.py
-
8tildes/tests/fixtures.py
-
64tildes/tests/test_comment.py
-
72tildes/tests/test_comment_user_mentions.py
-
14tildes/tests/test_datetime.py
-
41tildes/tests/test_group.py
-
10tildes/tests/test_id.py
-
167tildes/tests/test_markdown.py
-
22tildes/tests/test_markdown_field.py
-
36tildes/tests/test_messages.py
-
2tildes/tests/test_metrics.py
-
36tildes/tests/test_ratelimit.py
-
22tildes/tests/test_simplestring_field.py
-
58tildes/tests/test_string.py
-
36tildes/tests/test_title.py
-
44tildes/tests/test_topic.py
-
37tildes/tests/test_topic_permissions.py
-
22tildes/tests/test_topic_tags.py
-
6tildes/tests/test_triggers_comments.py
-
22tildes/tests/test_url.py
-
51tildes/tests/test_user.py
-
16tildes/tests/test_username.py
-
10tildes/tests/test_webassets.py
-
6tildes/tests/webtests/test_user_page.py
-
93tildes/tildes/__init__.py
-
6tildes/tildes/api.py
-
46tildes/tildes/auth.py
-
27tildes/tildes/database.py
-
20tildes/tildes/enums.py
-
26tildes/tildes/jinja.py
-
6tildes/tildes/json.py
-
16tildes/tildes/lib/amqp.py
-
12tildes/tildes/lib/cmark.py
-
26tildes/tildes/lib/database.py
-
30tildes/tildes/lib/datetime.py
-
3tildes/tildes/lib/hash.py
-
10tildes/tildes/lib/id.py
-
181tildes/tildes/lib/markdown.py
-
2tildes/tildes/lib/message.py
-
11tildes/tildes/lib/password.py
-
95tildes/tildes/lib/ratelimit.py
-
45tildes/tildes/lib/string.py
-
4tildes/tildes/lib/url.py
-
60tildes/tildes/metrics.py
-
97tildes/tildes/models/comment/comment.py
-
71tildes/tildes/models/comment/comment_notification.py
-
10tildes/tildes/models/comment/comment_notification_query.py
-
6tildes/tildes/models/comment/comment_query.py
-
29tildes/tildes/models/comment/comment_tag.py
-
23tildes/tildes/models/comment/comment_tree.py
-
20tildes/tildes/models/comment/comment_vote.py
-
34tildes/tildes/models/database_model.py
-
44tildes/tildes/models/group/group.py
-
6tildes/tildes/models/group/group_query.py
-
20tildes/tildes/models/group/group_subscription.py
-
135tildes/tildes/models/log/log.py
-
85tildes/tildes/models/message/message.py
-
37tildes/tildes/models/model_query.py
-
14tildes/tildes/models/pagination.py
-
174tildes/tildes/models/topic/topic.py
-
45tildes/tildes/models/topic/topic_query.py
-
26tildes/tildes/models/topic/topic_visit.py
-
20tildes/tildes/models/topic/topic_vote.py
-
70tildes/tildes/models/user/user.py
-
16tildes/tildes/models/user/user_group_settings.py
-
37tildes/tildes/models/user/user_invite_code.py
-
6tildes/tildes/resources/__init__.py
-
16tildes/tildes/resources/comment.py
-
11tildes/tildes/resources/group.py
-
11tildes/tildes/resources/message.py
-
9tildes/tildes/resources/topic.py
-
5tildes/tildes/resources/user.py
-
160tildes/tildes/routes.py
-
45tildes/tildes/schemas/fields.py
-
27tildes/tildes/schemas/group.py
-
58tildes/tildes/schemas/topic.py
-
13tildes/tildes/schemas/topic_listing.py
-
46tildes/tildes/schemas/user.py
-
2tildes/tildes/views/__init__.py
-
2tildes/tildes/views/api/v0/group.py
-
4tildes/tildes/views/api/v0/topic.py
-
2tildes/tildes/views/api/v0/user.py
-
167tildes/tildes/views/api/web/comment.py
-
21tildes/tildes/views/api/web/exceptions.py
-
41tildes/tildes/views/api/web/group.py
-
16tildes/tildes/views/api/web/message.py
-
172tildes/tildes/views/api/web/topic.py
-
139tildes/tildes/views/api/web/user.py
-
16tildes/tildes/views/decorators.py
@ -1,34 +1,34 @@ |
|||
def test_tags_whitespace_stripped(text_topic): |
|||
"""Ensure excess whitespace around tags gets stripped.""" |
|||
text_topic.tags = [' one', 'two ', ' three '] |
|||
assert text_topic.tags == ['one', 'two', 'three'] |
|||
text_topic.tags = [" one", "two ", " three "] |
|||
assert text_topic.tags == ["one", "two", "three"] |
|||
|
|||
|
|||
def test_tag_space_replacement(text_topic): |
|||
"""Ensure spaces in tags are converted to underscores internally.""" |
|||
text_topic.tags = ['one two', 'three four five'] |
|||
assert text_topic._tags == ['one_two', 'three_four_five'] |
|||
text_topic.tags = ["one two", "three four five"] |
|||
assert text_topic._tags == ["one_two", "three_four_five"] |
|||
|
|||
|
|||
def test_tag_consecutive_spaces(text_topic): |
|||
"""Ensure consecutive spaces/underscores in tags are removed.""" |
|||
text_topic.tags = ["one two", "three four", "five __ six"] |
|||
assert text_topic.tags == ['one two', 'three four', 'five six'] |
|||
assert text_topic.tags == ["one two", "three four", "five six"] |
|||
|
|||
|
|||
def test_duplicate_tags_removed(text_topic): |
|||
"""Ensure duplicate tags are removed (case-insensitive).""" |
|||
text_topic.tags = ['one', 'one', 'One', 'ONE', 'two', 'TWO'] |
|||
assert text_topic.tags == ['one', 'two'] |
|||
text_topic.tags = ["one", "one", "One", "ONE", "two", "TWO"] |
|||
assert text_topic.tags == ["one", "two"] |
|||
|
|||
|
|||
def test_empty_tags_removed(text_topic): |
|||
"""Ensure empty tags are removed.""" |
|||
text_topic.tags = ['', ' ', '_', 'one'] |
|||
assert text_topic.tags == ['one'] |
|||
text_topic.tags = ["", " ", "_", "one"] |
|||
assert text_topic.tags == ["one"] |
|||
|
|||
|
|||
def test_tags_lowercased(text_topic): |
|||
"""Ensure tags get converted to lowercase.""" |
|||
text_topic.tags = ['ONE', 'Two', 'thRee'] |
|||
assert text_topic.tags == ['one', 'two', 'three'] |
|||
text_topic.tags = ["ONE", "Two", "thRee"] |
|||
assert text_topic.tags == ["one", "two", "three"] |
@ -1,22 +1,22 @@ |
|||
from webassets.loaders import YAMLLoader |
|||
|
|||
|
|||
WEBASSETS_ENV = YAMLLoader('webassets.yaml').load_environment() |
|||
WEBASSETS_ENV = YAMLLoader("webassets.yaml").load_environment() |
|||
|
|||
|
|||
def test_scripts_file_first_in_bundle(): |
|||
"""Ensure that the main scripts.js file will be at the top.""" |
|||
js_bundle = WEBASSETS_ENV['javascript'] |
|||
js_bundle = WEBASSETS_ENV["javascript"] |
|||
|
|||
first_filename = js_bundle.resolve_contents()[0][0] |
|||
|
|||
assert first_filename == 'js/scripts.js' |
|||
assert first_filename == "js/scripts.js" |
|||
|
|||
|
|||
def test_styles_file_last_in_bundle(): |
|||
"""Ensure that the main styles.css file will be at the bottom.""" |
|||
css_bundle = WEBASSETS_ENV['css'] |
|||
css_bundle = WEBASSETS_ENV["css"] |
|||
|
|||
last_filename = css_bundle.resolve_contents()[-1][0] |
|||
|
|||
assert last_filename == 'css/styles.css' |
|||
assert last_filename == "css/styles.css" |
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue