Capture matched value(s).
Example:
.. code-block:: python
capture_foo = matching.Capture(matching.any_string) pattern = {'foo': capture_foo} assert pattern == {'foo': 'bar'} assert capture_foo.value == 'bar' assert capture_foo.values_list == ['bar']
capture_foo = matching.Capture() pattern = {'foo': capture_foo(matching.any_string)} assert pattern == {'foo': 'bar'} assert capture_foo.value == 'bar' assert capture_foo.values_list == ['bar']
Definition at line 540 of file matching.py.
Public Member Functions | |
| __init__ (self, value=Any(), _link_captured=None) | |
| value (self) | |
| values_list (self) | |
| __eq__ (self, other) | |
| __call__ (self, value) | |
| __testsuite_visit__ (self, visit) | |
| __testsuite_resolve_value__ (self, other, report_error) | |
Protected Attributes | |
| _value = value | |
| list | _captured = [] |
| testsuite.matching.Capture.__init__ | ( | self, | |
| value = Any(), | |||
| _link_captured = None ) |
Definition at line 562 of file matching.py.
| testsuite.matching.Capture.__call__ | ( | self, | |
| value ) |
Definition at line 585 of file matching.py.
| testsuite.matching.Capture.__eq__ | ( | self, | |
| other ) |
Definition at line 579 of file matching.py.
| testsuite.matching.Capture.__testsuite_resolve_value__ | ( | self, | |
| other, | |||
| report_error ) |
Definition at line 591 of file matching.py.
| testsuite.matching.Capture.__testsuite_visit__ | ( | self, | |
| visit ) |
Definition at line 588 of file matching.py.
| testsuite.matching.Capture.value | ( | self | ) |
Definition at line 570 of file matching.py.
| testsuite.matching.Capture.values_list | ( | self | ) |
Definition at line 576 of file matching.py.
|
protected |
Definition at line 565 of file matching.py.
|
protected |
Definition at line 563 of file matching.py.