mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-04 14:30:30 +03:00
metadata: remove STRING/INT conversion on output
The type conversion should all happen in post_parse_yaml_metadata whenever possible. Also, when `if` blocks end in `return`, it is clearer if no `elif` or `else` is used.
This commit is contained in:
parent
1bc9b41a2b
commit
b055559df7
2 changed files with 57 additions and 27 deletions
|
|
@ -1920,6 +1920,35 @@ class MetadataTest(unittest.TestCase):
|
|||
cm = metadata._app_to_yaml(metadata.App({'CurrentVersionCode': 0}))
|
||||
self.assertFalse('CurrentVersionCode' in cm)
|
||||
|
||||
def test_format_multiline(self):
|
||||
self.assertEqual(metadata._format_multiline('description'), 'description')
|
||||
|
||||
def test_format_multiline_empty(self):
|
||||
self.assertEqual(metadata._format_multiline(''), '')
|
||||
|
||||
def test_format_multiline_newline_char(self):
|
||||
self.assertEqual(metadata._format_multiline('one\\ntwo'), 'one\\ntwo')
|
||||
|
||||
def test_format_multiline_newlines(self):
|
||||
self.assertEqual(
|
||||
metadata._format_multiline(
|
||||
textwrap.dedent(
|
||||
"""
|
||||
one
|
||||
two
|
||||
three
|
||||
"""
|
||||
)
|
||||
),
|
||||
'\none\ntwo\nthree\n',
|
||||
)
|
||||
|
||||
def test_format_script_newline(self):
|
||||
self.assertEqual(metadata._format_script(['one\ntwo']), 'one\ntwo')
|
||||
|
||||
def test_format_script_newline_char(self):
|
||||
self.assertEqual(metadata._format_script(['one\\ntwo']), 'one\\ntwo')
|
||||
|
||||
def test_format_stringmap_empty(self):
|
||||
self.assertEqual(
|
||||
metadata._format_stringmap('🔥', 'test', dict()),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue