update multi-apps
This commit is contained in:
@@ -2,6 +2,7 @@ import copy
|
||||
import importlib.util
|
||||
import json
|
||||
import sys
|
||||
import re
|
||||
from typing import Dict
|
||||
|
||||
|
||||
@@ -86,6 +87,18 @@ def compare_text_file(actual: str, expected: str, **options) -> float:
|
||||
with open(expected) as f2:
|
||||
expected_text = f2.read()
|
||||
|
||||
ignore_blanks = options.get('ignore_blanks', False)
|
||||
if ignore_blanks:
|
||||
actual_text = re.sub(r'[\t\n]', ' ', actual_text).strip()
|
||||
actual_text = re.sub(r'\s+', ' ', actual_text)
|
||||
expected_text = re.sub(r'[\t\n]', ' ', expected_text).strip()
|
||||
expected_text = re.sub(r'\s+', ' ', expected_text)
|
||||
|
||||
ignore_case = options.get('ignore_case', False)
|
||||
if ignore_case:
|
||||
actual_text = actual_text.lower()
|
||||
expected_text = expected_text.lower()
|
||||
|
||||
if actual_text == expected_text:
|
||||
return 1.0
|
||||
return 0.0
|
||||
|
||||
Reference in New Issue
Block a user