diff options
author | vitalyisaev <vitalyisaev@ydb.tech> | 2023-11-30 13:26:22 +0300 |
---|---|---|
committer | vitalyisaev <vitalyisaev@ydb.tech> | 2023-11-30 15:44:45 +0300 |
commit | 0a98fece5a9b54f16afeb3a94b3eb3105e9c3962 (patch) | |
tree | 291d72dbd7e9865399f668c84d11ed86fb190bbf /contrib/python/pyre2/py3/tests/test_sub.txt | |
parent | cb2c8d75065e5b3c47094067cb4aa407d4813298 (diff) | |
download | ydb-0a98fece5a9b54f16afeb3a94b3eb3105e9c3962.tar.gz |
YQ Connector:Use docker-compose in integrational tests
Diffstat (limited to 'contrib/python/pyre2/py3/tests/test_sub.txt')
-rw-r--r-- | contrib/python/pyre2/py3/tests/test_sub.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/contrib/python/pyre2/py3/tests/test_sub.txt b/contrib/python/pyre2/py3/tests/test_sub.txt new file mode 100644 index 0000000000..b41dd30d28 --- /dev/null +++ b/contrib/python/pyre2/py3/tests/test_sub.txt @@ -0,0 +1,31 @@ +Tests of substitution +===================== + +This first test is just looking to replace things between parentheses +with an empty string. + + + >>> import hashlib + >>> import gzip + >>> import re2 + >>> re2.set_fallback_notification(re2.FALLBACK_EXCEPTION) + >>> import warnings + >>> warnings.filterwarnings('ignore', category=DeprecationWarning) + + >>> with gzip.open('tests/wikipages.xml.gz', 'rb') as tmp: + ... data = tmp.read() + >>> print(hashlib.md5(re2.sub(b'\(.*?\)', b'', data)).hexdigest()) + b7a469f55ab76cd5887c81dbb0cfe6d3 + + >>> re2.set_fallback_notification(re2.FALLBACK_QUIETLY) + +Issue #26 re2.sub replacements with a match of "(.*)" hangs forever + + >>> re2.sub('(.*)', r'\1;replacement', 'original') + 'original;replacement;replacement' + + >>> re2.sub('(.*)', lambda x: x.group() + ';replacement', 'original') + 'original;replacement;replacement' + + >>> re2.subn("b*", lambda x: "X", "xyz", 4) + ('XxXyXzX', 4) |