Skip to content

Commit 50d34b3

Browse files
committed
Fix python-braces format
Python str.format() is marked as `#, python-brace-format` in *.po (portable object) files.
1 parent 40dbcaa commit 50d34b3

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

msgcheck/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
(r'[\%]{2}', '%'),
4040
(r'\%([.\d]+)?[bcdeEfFgGnosxX]', r''),
4141
(r'\%(\([^)]*\))([.\d]+)?[bcdeEfFgGnosxX]', r''),
42+
),
43+
'python-brace':(
4244
(r'\{([^\:\}]*)?(:[^\}]*)?\}', r''),
4345
),
4446
})

tests/test_msgcheck.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ def test_replace_formatters_python(self):
129129
self.assertEqual(replace_formatters('%.02f', 'python'), '')
130130
self.assertEqual(replace_formatters('%(sth)s', 'python'), '')
131131
self.assertEqual(replace_formatters('%(sth)02f', 'python'), '')
132+
133+
def test_replace_formatters_python_braces(self):
134+
"""Test removal of formatters in a python braces string."""
132135
# str.format()
133136
conditions = (
134137
('First, thou shalt count to {0}',

0 commit comments

Comments
 (0)