Skip to content
Snippets Groups Projects
Commit 38e1ddec authored by Johannes Hoppe's avatar Johannes Hoppe
Browse files

Fix python-braces format

Python str.format() is marked as `#, python-brace-format` in *.po
(portable object) files.
parent 40dbcaa6
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -39,6 +39,8 @@ STR_FORMATTERS.update({
(r'[\%]{2}', '%'),
(r'\%([.\d]+)?[bcdeEfFgGnosxX]', r''),
(r'\%(\([^)]*\))([.\d]+)?[bcdeEfFgGnosxX]', r''),
),
'python-brace':(
(r'\{([^\:\}]*)?(:[^\}]*)?\}', r''),
),
})
Loading
Loading
Loading
Loading
@@ -129,6 +129,9 @@ class TestMsgCheck(unittest.TestCase): # pylint: disable=too-many-public-method
self.assertEqual(replace_formatters('%.02f', 'python'), '')
self.assertEqual(replace_formatters('%(sth)s', 'python'), '')
self.assertEqual(replace_formatters('%(sth)02f', 'python'), '')
def test_replace_formatters_python_braces(self):
"""Test removal of formatters in a python braces string."""
# str.format()
conditions = (
('First, thou shalt count to {0}',
Loading
Loading
@@ -152,7 +155,7 @@ class TestMsgCheck(unittest.TestCase): # pylint: disable=too-many-public-method
)
for condition in conditions:
self.assertEqual(
replace_formatters(condition[0], 'python'),
replace_formatters(condition[0], 'python-brace'),
condition[1],
condition[2],
)
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment