Skip to content

Commit e85c54c

Browse files
committed
Don't check translation of mapping keys in Python string formatters
1 parent efc66ab commit e85c54c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

msgcheck/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
'python': (
3939
(r'[\%]{2}', '%'),
4040
(r'\%([.\d]+)?[bcdeEfFgGnosxX]', r''),
41-
(r'\%(\(([^)]*)\))([.\d]+)?[bcdeEfFgGnosxX]', r'\g<2>'),
41+
(r'\%(\([^)]*\))([.\d]+)?[bcdeEfFgGnosxX]', r''),
4242
(r'\{([^\:\}]*)?(:[^\}]*)?\}', r''),
4343
),
4444
})

tests/test_msgcheck.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ def test_replace_formatters_python(self):
127127
self.assertEqual(replace_formatters('%b', 'python'), '')
128128
self.assertEqual(replace_formatters('%%', 'python'), '%')
129129
self.assertEqual(replace_formatters('%.02f', 'python'), '')
130-
self.assertEqual(replace_formatters('%(sth)s', 'python'), 'sth')
131-
self.assertEqual(replace_formatters('%(sth)02f', 'python'), 'sth')
130+
self.assertEqual(replace_formatters('%(sth)s', 'python'), '')
131+
self.assertEqual(replace_formatters('%(sth)02f', 'python'), '')
132132
# str.format()
133133
conditions = (
134134
('First, thou shalt count to {0}',

0 commit comments

Comments
 (0)