aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/pyre2/py3/tests/test_match_expand.txt
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-11-30 13:26:22 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-11-30 15:44:45 +0300
commit0a98fece5a9b54f16afeb3a94b3eb3105e9c3962 (patch)
tree291d72dbd7e9865399f668c84d11ed86fb190bbf /contrib/python/pyre2/py3/tests/test_match_expand.txt
parentcb2c8d75065e5b3c47094067cb4aa407d4813298 (diff)
downloadydb-0a98fece5a9b54f16afeb3a94b3eb3105e9c3962.tar.gz
YQ Connector:Use docker-compose in integrational tests
Diffstat (limited to 'contrib/python/pyre2/py3/tests/test_match_expand.txt')
-rw-r--r--contrib/python/pyre2/py3/tests/test_match_expand.txt29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/python/pyre2/py3/tests/test_match_expand.txt b/contrib/python/pyre2/py3/tests/test_match_expand.txt
new file mode 100644
index 0000000000..b3d5652c76
--- /dev/null
+++ b/contrib/python/pyre2/py3/tests/test_match_expand.txt
@@ -0,0 +1,29 @@
+Match Expand Tests
+==================
+
+Match objects have an .expand() method which allows them to
+expand templates as if the .sub() method was called on the pattern.
+
+ >>> import re2
+ >>> re2.set_fallback_notification(re2.FALLBACK_EXCEPTION)
+ >>> m = re2.match("(\\w+) (\\w+)\\W+(?P<title>\\w+)", "Isaac Newton, physicist")
+ >>> m.expand("\\2, \\1")
+ 'Newton, Isaac'
+ >>> m.expand("\\1 \\g<title>")
+ 'Isaac physicist'
+ >>> m.expand("\\2, \\1 \\2")
+ 'Newton, Isaac Newton'
+ >>> m.expand("\\3")
+ 'physicist'
+ >>> m.expand("\\1 \\g<foo>") # doctest: +IGNORE_EXCEPTION_DETAIL +ELLIPSIS
+ Traceback (most recent call last):
+ ...
+ IndexError: no such group 'foo'; available groups: ['title']
+ >>> m.expand("\\0")
+ '\x00'
+ >>> m.expand("\01")
+ '\x01'
+ >>> m.expand('\t\n\x0b\r\x0c\x07\x08\\B\\Z\x07\\A\\w\\W\\s\\S\\d\\D')
+ '\t\n\x0b\r\x0c\x07\x08\\B\\Z\x07\\A\\w\\W\\s\\S\\d\\D'
+
+ >>> re2.set_fallback_notification(re2.FALLBACK_QUIETLY)