Skip to content

Commit 574e00f

Browse files
authored
Merge pull request #8 from codingjoe/python-braces
Fix python-braces format
2 parents 40dbcaa + 982705a commit 574e00f

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

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: 4 additions & 1 deletion
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_brace(self):
134+
"""Test removal of formatters in a python brace string."""
132135
# str.format()
133136
conditions = (
134137
('First, thou shalt count to {0}',
@@ -152,7 +155,7 @@ def test_replace_formatters_python(self):
152155
)
153156
for condition in conditions:
154157
self.assertEqual(
155-
replace_formatters(condition[0], 'python'),
158+
replace_formatters(condition[0], 'python-brace'),
156159
condition[1],
157160
condition[2],
158161
)

0 commit comments

Comments
 (0)