Skip to content

Commit 7228cea

Browse files
committed
Refactor test for msgmerge with compendium-overwrite option
* Implemented a helper function `_get_expected` to standardize the expected PO file structure. * Renamed the option `c-overwrite` to `compendium-overwrite`
1 parent 99ac987 commit 7228cea

2 files changed

Lines changed: 129 additions & 144 deletions

File tree

babel/messages/frontend.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ class MessageMerge(CommandMixin):
10051005
('input-files', None, ''),
10061006
('directory=', 'D', ''),
10071007
('compendium=', 'C', ''),
1008-
('c-overwrite', '', ''),
1008+
('compendium-overwrite', '', ''),
10091009
('no-compendium-comment', '', ''),
10101010
('update', 'U', ''),
10111011
('output-file=', 'o', ''),
@@ -1057,7 +1057,7 @@ class MessageMerge(CommandMixin):
10571057
'no-wrap',
10581058
'sort-output',
10591059
'sort-by-file',
1060-
'c-overwrite',
1060+
'compendium-overwrite',
10611061
'backup',
10621062
'no-compendium-comment',
10631063
]
@@ -1071,7 +1071,7 @@ def initialize_options(self):
10711071
self.directory = None
10721072

10731073
self.compendium = None #~
1074-
self.c_overwrite = False #
1074+
self.compendium_overwrite = False #
10751075
self.no_compendium_comment = None #
10761076

10771077
self.update = None #
@@ -1135,8 +1135,8 @@ def run(self):
11351135

11361136
for message in compendium_catalog:
11371137
current = catalog[message.id]
1138-
if message.id in catalog and (not current.string or current.fuzzy or self.c_overwrite):
1139-
if self.c_overwrite and not current.fuzzy and current.string:
1138+
if message.id in catalog and (not current.string or current.fuzzy or self.compendium_overwrite):
1139+
if self.compendium_overwrite and not current.fuzzy and current.string:
11401140
catalog.obsolete[message.id] = current.clone()
11411141

11421142
current.string = message.string

0 commit comments

Comments
 (0)