|
|
|
@ -320,6 +320,64 @@ WorldWWWW
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Testing
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
original_object = RegexFormat(original_text, '/path/to/template',
|
|
|
|
|
add_header=True, already_changed=True,
|
|
|
|
|
parameters=parameters)
|
|
|
|
|
template_object = RegexFormat(template_text, '/path/to/template',
|
|
|
|
|
parameters=parameters)
|
|
|
|
|
original_object.join_template(template_object)
|
|
|
|
|
assert original_object.document_text == join_result
|
|
|
|
|
|
|
|
|
|
def test_format_with_empty_comment_parameter(self):
|
|
|
|
|
parameters = ParametersContainer({'multiline': True,
|
|
|
|
|
'dotall': True,
|
|
|
|
|
'comment': ''})
|
|
|
|
|
original_text = '''
|
|
|
|
|
Hello
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
template_text = r'''
|
|
|
|
|
<reg>Hello</reg>
|
|
|
|
|
<text></text>
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
join_result = '''
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
original_object = RegexFormat(original_text, '/path/to/template',
|
|
|
|
|
add_header=True, already_changed=True,
|
|
|
|
|
parameters=parameters)
|
|
|
|
|
template_object = RegexFormat(template_text, '/path/to/template',
|
|
|
|
|
parameters=parameters)
|
|
|
|
|
original_object.join_template(template_object)
|
|
|
|
|
assert original_object.document_text == join_result
|
|
|
|
|
|
|
|
|
|
def test_format_with_empty_comment_parameter_and_with_header_in_original_document(self):
|
|
|
|
|
parameters = ParametersContainer({'multiline': True,
|
|
|
|
|
'dotall': True,
|
|
|
|
|
'comment': ''})
|
|
|
|
|
original_text = '''#-------------------------------------------------------------------------------
|
|
|
|
|
# Modified by Calculate Utilities 4.0
|
|
|
|
|
# Processed template files:
|
|
|
|
|
# /path/to/ancient/template
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
Hello
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
template_text = r'''
|
|
|
|
|
<reg>Hello</reg>
|
|
|
|
|
<text></text>
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
join_result = '''#-------------------------------------------------------------------------------
|
|
|
|
|
# Modified by Calculate Utilities 4.0
|
|
|
|
|
# Processed template files:
|
|
|
|
|
# /path/to/ancient/template
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
original_object = RegexFormat(original_text, '/path/to/template',
|
|
|
|
|