-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always create description tag #372
Merged
wjt
merged 4 commits into
flathub-infra:master
from
razzeee:always-create-description-tag
May 20, 2024
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,13 +46,90 @@ def test_simple(self): | |
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
<release version="1.2.3" date="2019-01-01"/> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
) | ||
|
||
@unittest.expectedFailure | ||
def test_four_space_no_releases_element(self): | ||
# FIXME: This ends up indenting <releases> correctly, but | ||
# <release> and <description> incorrectly get the default 2-space | ||
Comment on lines
+60
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I'd forgotten about this one. I think it's such an edge case that we can accept the failure for now. |
||
# indent. | ||
self._do_test( | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<id>com.example.Workaround</id> | ||
<name>My history is a mystery</name> | ||
</component> | ||
""".strip(), | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<id>com.example.Workaround</id> | ||
<name>My history is a mystery</name> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
) | ||
|
||
def test_four_space_one_prior_release(self): | ||
self._do_test( | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<releases> | ||
<release version="1.2.3" date="2019-01-01"/> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
<release version="1.2.3" date="2019-01-01"/> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
) | ||
|
||
def test_four_space_many_prior_releases(self): | ||
self._do_test( | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<releases> | ||
<release version="1.2.3" date="2019-01-01"/> | ||
<release version="1.1.2" date="2018-01-01"/> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
<release version="1.2.3" date="2019-01-01"/> | ||
<release version="1.1.2" date="2018-01-01"/> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
) | ||
|
||
def test_mixed_indentation(self): | ||
"""This input uses 3-space indentation for one existing <release> and 4-space | ||
for another. Match the top one.""" | ||
|
@@ -70,7 +147,9 @@ def test_mixed_indentation(self): | |
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
<release version="1.2.3" date="2019-01-01"/> | ||
<release version="1.2.3" date="2019-01-01"/> | ||
</releases> | ||
|
@@ -119,7 +198,9 @@ def test_comment(self): | |
<component type="desktop"> | ||
<!-- I am the walrus --> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
<release version="1.2.3" date="2019-01-01"/> | ||
</releases> | ||
</component> | ||
|
@@ -137,14 +218,16 @@ def test_no_releases(self): | |
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
) | ||
|
||
def test_empty_releases(self): | ||
"""No whitespace is generated between <release /> and </releases>.""" | ||
"""No whitespace is generated between </release> and </releases>.""" | ||
self._do_test( | ||
""" | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
@@ -156,7 +239,9 @@ def test_empty_releases(self): | |
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop"> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
|
@@ -186,7 +271,9 @@ def test_double_comment_within_root(self): | |
--> | ||
<name>First element needed</name> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
</releases> | ||
</application> | ||
""".strip(), | ||
|
@@ -219,7 +306,9 @@ def test_comment_outside_root(self): | |
--> | ||
<application> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
</releases> | ||
</application> | ||
""".strip(), | ||
|
@@ -238,7 +327,9 @@ def test_amp_as_amp(self): | |
<component type="desktop"> | ||
<name>🍦 & 🎂</name> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
|
@@ -259,7 +350,9 @@ def test_amp_as_codepoint(self): | |
<component type="desktop"> | ||
<name>🦝 & 🍒</name> | ||
<releases> | ||
<release version="4.5.6" date="2020-02-02"/> | ||
<release version="4.5.6" date="2020-02-02"> | ||
<description></description> | ||
</release> | ||
</releases> | ||
</component> | ||
""".strip(), | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mypy objects to this because, while I know that
releases.text
is notNone
, mypy can't prove it.Fair enough but it makes the problem harder to fix…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess an
if
case might help? Pushed an approach.