Skip to content
Snippets Groups Projects
Unverified Commit 574e00f2 authored by Sébastien Helleu's avatar Sébastien Helleu Committed by GitHub
Browse files

Merge pull request #8 from codingjoe/python-braces

Fix python-braces format
parents 40dbcaa6 982705a1
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_brace(self):
"""Test removal of formatters in a python brace 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