Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • flashcode/msgcheck
1 result
Show changes
Commits on Source (6)
Loading
Loading
@@ -6,6 +6,7 @@ python:
- "3.4"
- "3.5"
- "3.6"
# - "3.7"
 
cache:
- pip
Loading
Loading
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
@@ -106,7 +106,7 @@ class TestMsgCheck(unittest.TestCase): # pylint: disable=too-many-public-method
# the file has 9 errors (`noqa` was skipped)
self.assertEqual(len(result[0][1]), 9)
 
def test_replace_formatters_c(self):
def test_replace_fmt_c(self):
"""Test removal of formatters in a C string."""
self.assertEqual(replace_formatters('%s', 'c'), '')
self.assertEqual(replace_formatters('%%', 'c'), '%')
Loading
Loading
@@ -120,7 +120,7 @@ class TestMsgCheck(unittest.TestCase): # pylint: disable=too-many-public-method
replace_formatters('%.3fTest%s%d%%%.03f%luhere% s', 'c'),
'Test%here')
 
def test_replace_formatters_python(self):
def test_replace_fmt_python(self):
"""Test removal of formatters in a python string."""
# str.__mod__()
self.assertEqual(replace_formatters('%s', 'python'), '')
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_fmt_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