Skip to content

Commit 33e43d5

Browse files
committed
Fix some code style
1 parent 8c920ba commit 33e43d5

2 files changed

Lines changed: 23 additions & 21 deletions

File tree

msgcheck/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424

2525
from __future__ import print_function
2626

27-
import re
2827
from collections import defaultdict
28+
import re
2929

3030

3131
STR_FORMATTERS = defaultdict(list)
@@ -34,12 +34,12 @@
3434
(r'[\%]{2}', '%'),
3535
(r'\%([ hlL\d\.\-\+\#\*]+)?[cdieEfgGosuxXpn]', r''),
3636
),
37-
'python': [
37+
'python': (
3838
(r'[\%]{2}', '%'),
3939
(r'\%([.\d]+)?[bcdeEfFgGnosxX]', r''),
4040
(r'\%(\(([^)]*)\))([.\d]+)?[bcdeEfFgGnosxX]', r'\g<2>'),
4141
(r'\{([^\:\}]*)?(:[^\}]*)?\}', r''),
42-
]
42+
),
4343
})
4444

4545

tests/test_msgcheck.py

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,24 +120,26 @@ def test_replace_formatters_python(self):
120120
self.assertEqual(replace_formatters('%(sth)s', 'python'), 'sth')
121121
self.assertEqual(replace_formatters('%(sth)02f', 'python'), 'sth')
122122
# str.format()
123-
conditions = [
124-
(
125-
'First, thou shalt count to {0}', 'First, thou shalt count to ',
126-
'References first positional argument'),
127-
(
128-
'Bring me a {}', 'Bring me a ',
129-
'Implicitly references the first positional argument'),
130-
('From {} to {}', 'From to ', 'Same as "From {0} to {1}"'),
131-
(
132-
'My quest is {name}', 'My quest is ',
133-
'References keyword argument \'name\''),
134-
(
135-
'Weight in tons {0.weight}', 'Weight in tons ',
136-
'\'weight\' attribute of first positional arg'),
137-
(
138-
'Units destroyed: {players[0]}', 'Units destroyed: ',
139-
'First element of keyword argument \'players\'.'),
140-
]
123+
conditions = (
124+
('First, thou shalt count to {0}',
125+
'First, thou shalt count to ',
126+
'References first positional argument'),
127+
('Bring me a {}',
128+
'Bring me a ',
129+
'Implicitly references the first positional argument'),
130+
('From {} to {}',
131+
'From to ',
132+
'Same as "From {0} to {1}"'),
133+
('My quest is {name}',
134+
'My quest is ',
135+
'References keyword argument \'name\''),
136+
('Weight in tons {0.weight}',
137+
'Weight in tons ',
138+
'\'weight\' attribute of first positional arg'),
139+
('Units destroyed: {players[0]}',
140+
'Units destroyed: ',
141+
'First element of keyword argument \'players\'.'),
142+
)
141143
for condition in conditions:
142144
self.assertEqual(
143145
replace_formatters(condition[0], 'python'),

0 commit comments

Comments
 (0)