userver: testsuite.matching.Capture Class Reference
Loading...
Searching...
No Matches
testsuite.matching.Capture Class Reference

Detailed Description

Capture matched value(s).

Example:

.. code-block:: python

You can define matching rule out of pattern

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']

Or do it later

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 = []

Constructor & Destructor Documentation

◆ __init__()

testsuite.matching.Capture.__init__ ( self,
value = Any(),
_link_captured = None )

Definition at line 562 of file matching.py.

Member Function Documentation

◆ __call__()

testsuite.matching.Capture.__call__ ( self,
value )

Definition at line 585 of file matching.py.

◆ __eq__()

testsuite.matching.Capture.__eq__ ( self,
other )

Definition at line 579 of file matching.py.

◆ __testsuite_resolve_value__()

testsuite.matching.Capture.__testsuite_resolve_value__ ( self,
other,
report_error )

Definition at line 591 of file matching.py.

◆ __testsuite_visit__()

testsuite.matching.Capture.__testsuite_visit__ ( self,
visit )

Definition at line 588 of file matching.py.

◆ value()

testsuite.matching.Capture.value ( self)

Definition at line 570 of file matching.py.

◆ values_list()

testsuite.matching.Capture.values_list ( self)

Definition at line 576 of file matching.py.

Member Data Documentation

◆ _captured

testsuite.matching.Capture._captured = []
protected

Definition at line 565 of file matching.py.

◆ _value

testsuite.matching.Capture._value = value
protected

Definition at line 563 of file matching.py.


The documentation for this class was generated from the following file: