|
|
|
@ -247,3 +247,85 @@ Another line of endless sadness.
|
|
|
|
|
parameters=parameters)
|
|
|
|
|
original_object.join_template(template_object)
|
|
|
|
|
assert original_object.document_text == join_result
|
|
|
|
|
|
|
|
|
|
def test_format_regex_empty_text_tag(self):
|
|
|
|
|
parameters = ParametersContainer({'multiline': True, 'dotall': True})
|
|
|
|
|
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
|
|
|
|
|
# /path/to/template
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
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_regex_does_not_strip_values_in_tags(self):
|
|
|
|
|
parameters = ParametersContainer({'multiline': True, 'dotall': True})
|
|
|
|
|
original_text = '''#-------------------------------------------------------------------------------
|
|
|
|
|
# Modified by Calculate Utilities 4.0
|
|
|
|
|
# Processed template files:
|
|
|
|
|
# /path/to/ancient/template
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
Hello
|
|
|
|
|
|
|
|
|
|
World
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
World
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
template_text = r'''
|
|
|
|
|
<reg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
World</reg>
|
|
|
|
|
<text>WWWW</text>
|
|
|
|
|
<reg>\Z</reg>
|
|
|
|
|
<text>
|
|
|
|
|
|
|
|
|
|
Testing
|
|
|
|
|
</text>
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
join_result = '''#-------------------------------------------------------------------------------
|
|
|
|
|
# Modified by Calculate Utilities 4.0
|
|
|
|
|
# Processed template files:
|
|
|
|
|
# /path/to/ancient/template
|
|
|
|
|
# /path/to/template
|
|
|
|
|
#-------------------------------------------------------------------------------
|
|
|
|
|
Hello
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|